Skip to content
Prev Previous commit
Next Next commit
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.
  • Loading branch information
rquitales committed Sep 13, 2024
commit 5ff3ade8fc200f63f6918c5e546533d4bb6598cf
4 changes: 3 additions & 1 deletion tests/crds/k8sversion/mock_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ spec:
scope: Namespaced
versions:
- test:
served: true
storage: true
name: test
schema:
openAPIV3Schema:
properties:
testProperty:
type: string`
type: string
2 changes: 2 additions & 0 deletions tests/crds/regression/hyphenated-symbols/hyphen-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ spec:
scope: Namespaced
versions:
- name: HyphenTest
served: true
storage: true
schema:
openAPIV3Schema:
type: object
Expand Down
2 changes: 2 additions & 0 deletions tests/crds/regression/hyphenated-symbols2/hyphen-test2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ spec:
scope: Namespaced
versions:
- hyphentest2:
storage: true
served: true
name: hyphentest2
schema:
openAPIV3Schema:
Expand Down
2 changes: 1 addition & 1 deletion tests/crds/underscored-types/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ spec:
- anp
- anps
singular: networkpolicy
preserveUnknownFields: true
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
Expand Down
5 changes: 3 additions & 2 deletions tests/crds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func TestKubernetesVersionNodeJs(t *testing.T) {

version, err := exec.Command("node", "bin/index.js").Output()
require.NoError(t, err)
assert.Equal(t, "4.5.5\n", string(version))
assert.Equal(t, "4.18.0\n", string(version))
})
}

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

func runRequireNoError(t *testing.T, cmd *exec.Cmd) {
t.Helper()
bytes, err := cmd.CombinedOutput()
if err != nil {
t.Log(bytes)
t.Log(string(bytes))
}
require.NoError(t, err)
}
2 changes: 2 additions & 0 deletions tests/unneeded_go_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
scope: Namespaced
versions:
- test:
storage: true
served: true
name: test
schema:
openAPIV3Schema:
Expand Down