mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 10:00:06 +00:00
Style: clean up dry-run (#7007)
Some checks failed
Webhook Upgrade Validation / webhook-upgrade-check (push) Failing after 13m45s
Some checks failed
Webhook Upgrade Validation / webhook-upgrade-check (push) Failing after 13m45s
- Remove trailing whitespace on dryrun outputs - Fixed the relevant plugin-test outputs - Refactor to avoid partial lines that codecov flags out Signed-off-by: Bryan Leong <leong.bryan@gmail.com>
This commit is contained in:
@@ -161,7 +161,7 @@ var _ = Describe("Application Auto update", Ordered, func() {
|
|||||||
Eventually(func() error {
|
Eventually(func() error {
|
||||||
appRev := &v1beta1.ApplicationRevision{}
|
appRev := &v1beta1.ApplicationRevision{}
|
||||||
return k8sClient.Get(ctx, client.ObjectKey{Name: "app-with-auto-update-v2", Namespace: namespace}, appRev)
|
return k8sClient.Get(ctx, client.ObjectKey{Name: "app-with-auto-update-v2", Namespace: namespace}, appRev)
|
||||||
}, 60*time.Second, 2*time.Second).Should(BeNil())
|
}, 90*time.Second, 2*time.Second).Should(BeNil())
|
||||||
|
|
||||||
By("Execute a live-diff command for previous two application versions")
|
By("Execute a live-diff command for previous two application versions")
|
||||||
output, err := e2e.Exec(fmt.Sprintf("%s live-diff --revision app-with-auto-update-v2,app-with-auto-update-v1", velaCommandPrefix))
|
output, err := e2e.Exec(fmt.Sprintf("%s live-diff --revision app-with-auto-update-v2,app-with-auto-update-v1", velaCommandPrefix))
|
||||||
@@ -203,7 +203,7 @@ func randomNamespaceName(basic string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dryRunResult1 = `---
|
var dryRunResult1 = `---
|
||||||
# Application(app-with-auto-update) -- Component(test)
|
# Application(app-with-auto-update) -- Component(test)
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
@@ -226,7 +226,7 @@ metadata:
|
|||||||
---`
|
---`
|
||||||
|
|
||||||
var dryRunResult2 = `---
|
var dryRunResult2 = `---
|
||||||
# Application(app-with-auto-update) -- Component(test)
|
# Application(app-with-auto-update) -- Component(test)
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ spec:
|
|||||||
`
|
`
|
||||||
|
|
||||||
var dryRunResult = `---
|
var dryRunResult = `---
|
||||||
# Application(test-vela-app) -- Component(express-server)
|
# Application(test-vela-app) -- Component(express-server)
|
||||||
---
|
---
|
||||||
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
@@ -598,7 +598,7 @@ spec:
|
|||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
|
|
||||||
---
|
---
|
||||||
## From the trait test-ingress
|
## From the trait test-ingress
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
@@ -621,7 +621,7 @@ spec:
|
|||||||
app.oam.dev/component: express-server
|
app.oam.dev/component: express-server
|
||||||
|
|
||||||
---
|
---
|
||||||
## From the trait test-ingress
|
## From the trait test-ingress
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
|
|||||||
@@ -178,7 +178,8 @@ func (d *Option) PrintDryRun(buff *bytes.Buffer, appName string, comps []*types.
|
|||||||
components[comp.Name] = comp.ComponentOutput
|
components[comp.Name] = comp.ComponentOutput
|
||||||
}
|
}
|
||||||
for _, c := range comps {
|
for _, c := range comps {
|
||||||
if _, err := fmt.Fprintf(buff, "---\n# Application(%s) -- Component(%s) \n---\n\n", appName, c.Name); err != nil {
|
_, err := fmt.Fprintf(buff, "---\n# Application(%s) -- Component(%s)\n---\n\n", appName, c.Name)
|
||||||
|
if err != nil {
|
||||||
return errors.Wrap(err, "fail to write buff")
|
return errors.Wrap(err, "fail to write buff")
|
||||||
}
|
}
|
||||||
result, err := yaml.Marshal(components[c.Name])
|
result, err := yaml.Marshal(components[c.Name])
|
||||||
@@ -191,9 +192,9 @@ func (d *Option) PrintDryRun(buff *bytes.Buffer, appName string, comps []*types.
|
|||||||
traitType := t.GetLabels()[oam.TraitTypeLabel]
|
traitType := t.GetLabels()[oam.TraitTypeLabel]
|
||||||
switch {
|
switch {
|
||||||
case traitType == definition.AuxiliaryWorkload:
|
case traitType == definition.AuxiliaryWorkload:
|
||||||
buff.WriteString("## From the auxiliary workload \n")
|
buff.WriteString("## From the auxiliary workload\n")
|
||||||
case traitType != "":
|
case traitType != "":
|
||||||
fmt.Fprintf(buff, "## From the trait %s \n", traitType)
|
fmt.Fprintf(buff, "## From the trait %s\n", traitType)
|
||||||
}
|
}
|
||||||
result, err := yaml.Marshal(t)
|
result, err := yaml.Marshal(t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -205,7 +206,8 @@ func (d *Option) PrintDryRun(buff *bytes.Buffer, appName string, comps []*types.
|
|||||||
buff.WriteString("\n")
|
buff.WriteString("\n")
|
||||||
}
|
}
|
||||||
for _, plc := range policies {
|
for _, plc := range policies {
|
||||||
if _, err := fmt.Fprintf(buff, "---\n# Application(%s) -- Policy(%s) \n---\n\n", appName, plc.GetName()); err != nil {
|
_, err := fmt.Fprintf(buff, "---\n# Application(%s) -- Policy(%s)\n---\n\n", appName, plc.GetName())
|
||||||
|
if err != nil {
|
||||||
return errors.Wrap(err, "fail to write buff")
|
return errors.Wrap(err, "fail to write buff")
|
||||||
}
|
}
|
||||||
result, err := yaml.Marshal(plc)
|
result, err := yaml.Marshal(plc)
|
||||||
|
|||||||
Reference in New Issue
Block a user