Skip to content

Commit

Permalink
chore: Remove duplicate tests
Browse files Browse the repository at this point in the history
Signed-off-by: Diego Alfonso <[email protected]>
  • Loading branch information
odinnordico committed May 29, 2023
1 parent 10677d1 commit 181248e
Showing 1 changed file with 7 additions and 106 deletions.
113 changes: 7 additions & 106 deletions pkg/commands/workload_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8225,7 +8225,8 @@ To get status: "tanzu apps workload get my-workload"
d.Annotations(map[string]string{apis.LocalSourceProxyAnnotationName: "my-old-image"})
}).SpecDie(func(d *diecartov1alpha1.WorkloadSpecDie) {
d.Source(&cartov1alpha1.Source{
Image: "my-lsp-image@sha256:1234567890",
Image: "my-lsp-image@sha256:1234567890",
Subpath: "my-subpath",
})
}),
},
Expand Down Expand Up @@ -8259,6 +8260,7 @@ To get status: "tanzu apps workload get my-workload"
11, 9 |spec:
12 - | source:
13 - | image: my-lsp-image@sha256:1234567890
14 - | subPath: my-subpath
10 + | image: my-image
👍 Updated workload "my-workload"
Expand All @@ -8270,7 +8272,7 @@ To get status: "tanzu apps workload get my-workload"
{
Name: "update from image to lsp",
Skip: runtm.GOOS == "windows",
Args: []string{workloadName, flags.LocalPathFlagName, localSource, flags.YesFlagName},
Args: []string{workloadName, flags.LocalPathFlagName, localSource, flags.SubPathFlagName, subpath, flags.YesFlagName},
GivenObjects: []client.Object{
parent.
SpecDie(func(d *diecartov1alpha1.WorkloadSpecDie) {
Expand All @@ -8292,7 +8294,8 @@ To get status: "tanzu apps workload get my-workload"
},
Spec: cartov1alpha1.WorkloadSpec{
Source: &cartov1alpha1.Source{
Image: ":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69",
Image: ":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69",
Subpath: subpath,
},
},
},
Expand All @@ -8316,6 +8319,7 @@ Publishing source in "%s" to "local-source-proxy.tap-local-source-system.svc.clu
10 - | image: my-image
12 + | source:
13 + | image: :default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69
14 + | subPath: testdata/local-source/subpath
👍 Updated workload "my-workload"
To see logs: "tanzu apps workload tail my-workload --timestamp --since 1h"
Expand Down Expand Up @@ -9115,60 +9119,6 @@ No source code is changed
To see logs: "tanzu apps workload tail my-workload --timestamp --since 1h"
To get status: "tanzu apps workload get my-workload"
`, localSource),
},
{
Name: "update image to local source with subpath using flags",
Skip: runtm.GOOS == "windows",
Args: []string{workloadName, flags.LocalPathFlagName, localSource, flags.SubPathFlagName, subpath, flags.YesFlagName},
GivenObjects: []client.Object{
parent.
MetadataDie(func(d *diemetav1.ObjectMetaDie) {
d.Labels(map[string]string{apis.WorkloadTypeLabelName: "web"})
}).SpecDie(func(d *diecartov1alpha1.WorkloadSpecDie) {
d.Image(":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69")
}),
},
KubeConfigTransport: clitesting.NewFakeTransportFromResponse(respCreator(http.StatusOK, `{"statuscode": "200", "message": "any ignored message"}`, myWorkloadHeader)),
ExpectUpdates: []client.Object{
parent.
MetadataDie(func(d *diemetav1.ObjectMetaDie) {
d.Annotations(map[string]string{apis.LocalSourceProxyAnnotationName: ":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69"})
d.Labels(map[string]string{apis.WorkloadTypeLabelName: "web"})
}).SpecDie(func(d *diecartov1alpha1.WorkloadSpecDie) {
d.Source(
&cartov1alpha1.Source{
Image: ":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69",
Subpath: subpath,
},
)
}),
},
ExpectOutput: fmt.Sprintf(`
Publishing source in "%s" to "local-source-proxy.tap-local-source-system.svc.cluster.local/source:default-my-workload"...
📥 Published source
🔎 Update workload:
1, 1 |---
2, 2 |apiVersion: carto.run/v1alpha1
3, 3 |kind: Workload
4, 4 |metadata:
5 + | annotations:
6 + | local-source-proxy.apps.tanzu.vmware.com: :default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69
5, 7 | labels:
6, 8 | apps.tanzu.vmware.com/workload-type: web
7, 9 | name: my-workload
8, 10 | namespace: default
9, 11 |spec:
10 - | image: :default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69
12 + | source:
13 + | image: :default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69
14 + | subPath: testdata/local-source/subpath
👍 Updated workload "my-workload"
To see logs: "tanzu apps workload tail my-workload --timestamp --since 1h"
To get status: "tanzu apps workload get my-workload"
`, localSource),
},
{
Expand Down Expand Up @@ -9283,55 +9233,6 @@ To get status: "tanzu apps workload get my-workload"
To see logs: "tanzu apps workload tail my-workload --timestamp --since 1h"
To get status: "tanzu apps workload get my-workload"
`,
},
{
Name: "update local source to image using flags",
Args: []string{workloadName, flags.ImageFlagName, ":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69", flags.YesFlagName},
GivenObjects: []client.Object{
parent.
MetadataDie(func(d *diemetav1.ObjectMetaDie) {
d.Annotations(map[string]string{apis.LocalSourceProxyAnnotationName: ":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69"})
d.Labels(map[string]string{apis.WorkloadTypeLabelName: "web"})
}).SpecDie(func(d *diecartov1alpha1.WorkloadSpecDie) {
d.Source(
&cartov1alpha1.Source{
Image: ":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69",
Subpath: subpath,
},
)
}),
},
ExpectUpdates: []client.Object{
parent.
MetadataDie(func(d *diemetav1.ObjectMetaDie) {
d.Labels(map[string]string{apis.WorkloadTypeLabelName: "web"})
}).SpecDie(func(d *diecartov1alpha1.WorkloadSpecDie) {
d.Image(":default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69")
}),
},
ExpectOutput: `
🔎 Update workload:
1, 1 |---
2, 2 |apiVersion: carto.run/v1alpha1
3, 3 |kind: Workload
4, 4 |metadata:
5 - | annotations:
6 - | local-source-proxy.apps.tanzu.vmware.com: :default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69
7, 5 | labels:
8, 6 | apps.tanzu.vmware.com/workload-type: web
9, 7 | name: my-workload
10, 8 | namespace: default
11, 9 |spec:
12 - | source:
13 - | image: :default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69
14 - | subPath: testdata/local-source/subpath
10 + | image: :default-my-workload@sha256:978be33a7f0cbe89bf48fbb438846047a28e1298d6d10d0de2d64bdc102a9e69
👍 Updated workload "my-workload"
To see logs: "tanzu apps workload tail my-workload --timestamp --since 1h"
To get status: "tanzu apps workload get my-workload"
`,
},
}
Expand Down

0 comments on commit 181248e

Please sign in to comment.