pulumi-kubernetes icon indicating copy to clipboard operation
pulumi-kubernetes copied to clipboard

Fix a couple tests not running on CI

Open blampe opened this issue 9 months ago • 1 comments

I noticed as part of https://github.com/pulumi/pulumi-kubernetes/pull/2953 that the tests/convert and tests/provider directories aren't currently getting exercised in CI, and as a result one of them is failing on master:

❯ go test -short -v -cover -timeout 2h ./...
=== RUN   TestTerraformConvert
    convert_test.go:37: output: Converting from terraform...
        Converting to yaml...
        warning: using pulumi-language-yaml from $PATH at /opt/homebrew/bin/pulumi-language-yaml
    convert_test.go:45:
        	Error Trace:	/Users/bryce/src/pulumi-kubernetes/tests/convert/convert_test.go:45
        	Error:      	Not equal:
        	            	expected: "resources:\n  nginx:\n    type: kubernetes:apps/v1:Deployment\n    properties:\n      metadata:\n        name: scalable-nginx-example\n        labels:\n          app: ScalableNginxExample\n      spec:\n        replicas: 2\n        selector:\n          matchLabels:\n            app: ScalableNginxExample\n        template:\n          metadata:\n            labels:\n              app: ScalableNginxExample\n          spec:\n            containers:\n              - image: nginx:1.7.8\n                name: example\n                ports:\n                  - containerPort: 80\n                resources:\n                  limits:\n                    cpu: '0.5'\n                    memory: 512Mi\n                  requests:\n                    cpu: 250m\n                    memory: 50Mi\n  nginxResource:\n    type: kubernetes:core/v1:Service\n    properties:\n      metadata:\n        name: nginx-example\n      spec:\n        selector:\n          app: ${nginx.spec.template.metadata.labels.app}\n        ports:\n          - nodePort: 30201\n            port: 80\n            targetPort: 80\n        type: NodePort\n"
        	            	actual  : "resources:\n  nginx:\n    type: kubernetes:apps/v1:Deployment\n    properties:\n      metadata:\n        name: scalable-nginx-example\n        labels:\n          app: ScalableNginxExample\n      spec:\n        replicas: 2\n        selector:\n          matchLabels:\n            app: ScalableNginxExample\n        template:\n          metadata:\n            labels:\n              app: ScalableNginxExample\n          spec:\n            containers:\n              - image: nginx:1.7.8\n                name: example\n                ports:\n                  - containerPort: 80\n                resources:\n                  limits:\n                    cpu: '0.5'\n                    memory: 512Mi\n                  requests:\n                    cpu: 250m\n                    memory: 50Mi\n  nginxService:\n    type: kubernetes:core/v1:Service\n    name: nginx\n    properties:\n      metadata:\n        name: nginx-example\n      spec:\n        selector:\n          app: ${nginx.spec.template.metadata.labels.app}\n        ports:\n          - nodePort: 30201\n            port: 80\n            targetPort: 80\n        type: NodePort\n"

        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -30,4 +30,5 @@
        	            	                     memory: 50Mi
        	            	-  nginxResource:
        	            	+  nginxService:
        	            	     type: kubernetes:core/v1:Service
        	            	+    name: nginx
        	            	     properties:
        	Test:       	TestTerraformConvert
--- FAIL: TestTerraformConvert (1.04s)
FAIL
coverage: [no statements]
FAIL	github.com/pulumi/pulumi-kubernetes/tests/v4/convert	1.179s
FAIL

This PR moves tests/provider and tests/convert under sdk/java, which is currently executed in CI but doesn't contain any tests. We also fix the convert test along the way.

"sdk/java" is admittedly an odd namespace to put these under, but our CI targets don't give us much flexibility at the moment, and at the end of the day it's just an arbitrary way of sharding things.

blampe avatar Apr 29 '24 21:04 blampe

Does the PR have any schema changes?

Looking good! No breaking changes found. No new resources/functions.

github-actions[bot] avatar Apr 29 '24 21:04 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 29.86%. Comparing base (09be004) to head (ce021e6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2982   +/-   ##
=======================================
  Coverage   29.86%   29.86%           
=======================================
  Files          63       63           
  Lines        8353     8353           
=======================================
  Hits         2495     2495           
  Misses       5634     5634           
  Partials      224      224           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 07 '24 18:05 codecov[bot]

Going to merge this - I've got a bunch of YAML tests starting to pile up and I definitely want to run them on CI!

As mentioned in chat, I'd prefer we live with the slightly awkward naming instead of baking an exception for Kubernetes into ci-mgmt. We can and should instead re-think how we do this sharding in the first place.

blampe avatar May 09 '24 17:05 blampe