ctl: add integration test case that exercises actual object conversion

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2020-05-29 14:09:25 +01:00
parent 485e2e59a4
commit 81654a9195
2 changed files with 39 additions and 0 deletions

View File

@ -29,6 +29,7 @@ const (
testdataResource1 = "./testdata/convert_resource1.yaml"
testdataResource2 = "./testdata/convert_resource2.yaml"
testdataResource3 = "./testdata/convert_resource3.yaml"
testdataResourceWithOrganizationV1alpha2 = "./testdata/convert_resource_with_organization_v1alpha2.yaml"
targetv1alpha2 = "cert-manager.io/v1alpha2"
targetv1alpha3 = "cert-manager.io/v1alpha3"
@ -82,6 +83,29 @@ func TestCtlConvert(t *testing.T) {
targetVersion: targetv1alpha3,
expErr: true,
},
"an object in v1alpha2 that uses a field that has been renamed in v1alpha3 should be converted properly": {
input: testdataResourceWithOrganizationV1alpha2,
targetVersion: targetv1alpha3,
expOutput: `
apiVersion: cert-manager.io/v1alpha3
kind: Certificate
metadata:
creationTimestamp: null
name: ca-issuer
namespace: sandbox
spec:
commonName: my-csi-app
isCA: true
subject:
organizations:
- hello world
issuerRef:
group: cert-manager.io
kind: Issuer
name: selfsigned-issuer
secretName: ca-key-pair
status: {}`,
},
}
for name, test := range tests {

View File

@ -0,0 +1,15 @@
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
name: ca-issuer
namespace: sandbox
spec:
isCA: true
secretName: ca-key-pair
organization:
- "hello world"
commonName: my-csi-app
issuerRef:
name: selfsigned-issuer
kind: Issuer
group: cert-manager.io