Skip to content

Commit bad0c99

Browse files
committed
tests: fix mocked CRDs to be valid
Our mocked CRDs for testing purposes were very minimal and not completely valid since previous codegen logic only needed a subset of fields. As we have updated our implementation to do codegen on an OpenAPI spec, we need fully formed CRD manifests for this conversion to occur.
1 parent edd281a commit bad0c99

File tree

6 files changed

+13
-4
lines changed

6 files changed

+13
-4
lines changed

tests/crds/k8sversion/mock_crd.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ spec:
99
scope: Namespaced
1010
versions:
1111
- test:
12+
served: true
13+
storage: true
1214
name: test
1315
schema:
1416
openAPIV3Schema:
1517
properties:
1618
testProperty:
17-
type: string`
19+
type: string

tests/crds/regression/hyphenated-symbols/hyphen-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ spec:
1111
scope: Namespaced
1212
versions:
1313
- name: HyphenTest
14+
served: true
15+
storage: true
1416
schema:
1517
openAPIV3Schema:
1618
type: object

tests/crds/regression/hyphenated-symbols2/hyphen-test2.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ spec:
1010
scope: Namespaced
1111
versions:
1212
- hyphentest2:
13+
storage: true
14+
served: true
1315
name: hyphentest2
1416
schema:
1517
openAPIV3Schema:

tests/crds/underscored-types/networkpolicy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ spec:
2121
- anp
2222
- anps
2323
singular: networkpolicy
24-
preserveUnknownFields: true
2524
scope: Namespaced
2625
versions:
2726
- name: v1alpha1
2827
schema:
2928
openAPIV3Schema:
29+
type: object
3030
properties:
3131
spec:
3232
type: object

tests/crds_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func TestKubernetesVersionNodeJs(t *testing.T) {
158158

159159
version, err := exec.Command("node", "bin/index.js").Output()
160160
require.NoError(t, err)
161-
assert.Equal(t, "4.5.5\n", string(version))
161+
assert.Equal(t, "4.18.0\n", string(version))
162162
})
163163
}
164164

@@ -185,9 +185,10 @@ func appendFile(t *testing.T, filename, content string) {
185185
}
186186

187187
func runRequireNoError(t *testing.T, cmd *exec.Cmd) {
188+
t.Helper()
188189
bytes, err := cmd.CombinedOutput()
189190
if err != nil {
190-
t.Log(bytes)
191+
t.Log(string(bytes))
191192
}
192193
require.NoError(t, err)
193194
}

tests/unneeded_go_files_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ spec:
2121
scope: Namespaced
2222
versions:
2323
- test:
24+
storage: true
25+
served: true
2426
name: test
2527
schema:
2628
openAPIV3Schema:

0 commit comments

Comments
 (0)