@@ -78,6 +78,30 @@ func TestCRDsFromFile(t *testing.T) {
7878
7979// TestCRDsFromUrl pulls the CRD YAML file from a URL and generates it in each language
8080func TestCRDsFromUrl (t * testing.T ) {
81+ validateNodeCompiles := func (t * testing.T , path string ) {
82+ withDir (t , path , func () {
83+ runRequireNoError (t , exec .Command ("npm" , "install" ))
84+ runRequireNoError (t , exec .Command ("npm" , "run" , "build" ))
85+ })
86+ }
87+
88+ validateGolangCompiles := func (t * testing.T , path string ) {
89+ withDir (t , path , func () {
90+ runRequireNoError (t , exec .Command ("go" , "mod" , "init" , "fakepackage" ))
91+ runRequireNoError (t , exec .Command ("go" , "mod" , "tidy" ))
92+ runRequireNoError (t , exec .Command ("go" , "vet" , "./..." ))
93+ })
94+ }
95+
96+ // TODO: Also run compilation tests for dotnet, java and python.
97+ compileValidationFn := map [string ]func (t * testing.T , path string ){
98+ "nodejs" : validateNodeCompiles ,
99+ "go" : validateGolangCompiles ,
100+ "python" : nil ,
101+ "java" : nil ,
102+ "dotnet" : nil ,
103+ }
104+
81105 tests := []struct {
82106 name string
83107 url string
@@ -98,6 +122,41 @@ func TestCRDsFromUrl(t *testing.T) {
98122 name : "Contours" ,
99123 url : "https://raw.githubusercontent.com/projectcontour/contour-operator/f8c07498803d062e30c255976270cbc82cd619b0/config/crd/bases/operator.projectcontour.io_contours.yaml" ,
100124 },
125+ {
126+ // https://github.com/pulumi/crd2pulumi/issues/141
127+ name : "ElementDeployment" ,
128+ url : "https://raw.githubusercontent.com/element-hq/ess-starter-edition-core/d7e792bf8a872f06f02f59d807a1c16ee933862b/roles/elementdeployment/files/elementdeployment-schema.yaml" ,
129+ },
130+ {
131+ // https://github.com/pulumi/crd2pulumi/issues/142
132+ name : "Keycloak" ,
133+ url : "https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/25.0.4/kubernetes/keycloaks.k8s.keycloak.org-v1.yml" ,
134+ },
135+ {
136+ // https://github.com/pulumi/crd2pulumi/issues/115
137+ name : "CertManager" ,
138+ url : "https://gist.githubusercontent.com/RouxAntoine/b7dfb9ce327a4ad40a76ff6552c7fd5e/raw/4b5922da11643e14d04e6b52f7a0fca982e4dace/1-crds.yaml" ,
139+ },
140+ {
141+ // https://github.com/pulumi/crd2pulumi/issues/104
142+ name : "TracingPolicies" ,
143+ url : "https://raw.githubusercontent.com/cilium/tetragon/v1.2.0/install/kubernetes/tetragon/crds-yaml/cilium.io_tracingpolicies.yaml" ,
144+ },
145+ {
146+ // https://github.com/pulumi/crd2pulumi/issues/104
147+ name : "Argo Rollouts" ,
148+ url : "https://raw.githubusercontent.com/argoproj/argo-rollouts/74c1a947ab36670ae01a45993a0c5abb44af4677/manifests/crds/rollout-crd.yaml" ,
149+ },
150+ {
151+ // https://github.com/pulumi/crd2pulumi/issues/92
152+ name : "Grafana" ,
153+ url : "https://raw.githubusercontent.com/bitnami/charts/main/bitnami/grafana-operator/crds/grafanas.integreatly.org.yaml" ,
154+ },
155+ {
156+ // https://github.com/pulumi/crd2pulumi/issues/70
157+ name : "Percona" ,
158+ url : "https://raw.githubusercontent.com/percona/percona-server-mongodb-operator/main/deploy/crd.yaml" ,
159+ },
101160 }
102161
103162 for _ , tt := range tests {
@@ -106,7 +165,7 @@ func TestCRDsFromUrl(t *testing.T) {
106165 lang := lang
107166 t .Run (lang , func (t * testing.T ) {
108167 t .Parallel ()
109- execCrd2Pulumi (t , lang , tt .url , nil )
168+ execCrd2Pulumi (t , lang , tt .url , compileValidationFn [ lang ] )
110169 })
111170 }
112171 })
0 commit comments