Skip to content

[bug] make test-unit fails due to helm dependency on cert-manager #364

@jaypipes

Description

@jaypipes

Just trying to run make test-unit in a clean checkout from main (@c3b1aa2) and running into a failure trying to load api/v1alpha1/webhook_test_suite.go:

·> make test-unit
test -s /home/jaypipes/src/github.com/temporalio/temporal-worker-controller/bin/setup-envtest || GOBIN=/home/jaypipes/src/github.com/temporalio/temporal-worker-controller/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
KUBEBUILDER_ASSETS="/home/jaypipes/src/github.com/temporalio/temporal-worker-controller/bin/k8s/1.29.0-linux-amd64" go test ./... -coverprofile cover.out
# github.com/temporalio/temporal-worker-controller/internal/testhelpers/testlogr
go: no such tool "covdata"
# github.com/temporalio/temporal-worker-controller/cmd
go: no such tool "covdata"
# github.com/temporalio/temporal-worker-controller/hack/demohelper
go: no such tool "covdata"
Running Suite: Webhook Suite - /home/jaypipes/src/github.com/temporalio/temporal-worker-controller/api/v1alpha1
===============================================================================================================
Random Seed: 1779991798

Will run 11 of 11 specs
------------------------------
[BeforeSuite] [FAILED] [0.032 seconds]
[BeforeSuite] 
/home/jaypipes/src/github.com/temporalio/temporal-worker-controller/api/v1alpha1/webhook_suite_test.go:56

  Timeline >>
  STEP: bootstrapping test environment @ 05/28/26 14:09:58.042
  [FAILED] in [BeforeSuite] - /home/jaypipes/src/github.com/temporalio/temporal-worker-controller/api/v1alpha1/webhook_suite_test.go:165 @ 05/28/26 14:09:58.074
  << Timeline

  [FAILED] helm template failed — is helm installed?
  Unexpected error:
      <*exec.ExitError | 0x31d14c306920>: 
      exit status 1
      {
          ProcessState: {
              pid: 418028,
              status: 256,
              rusage: {
                  Utime: {Sec: 0, Usec: 32882},
                  Stime: {Sec: 0, Usec: 10334},
                  Maxrss: 89688,
                  Ixrss: 0,
                  Idrss: 0,
                  Isrss: 0,
                  Minflt: 4399,
                  Majflt: 6,
                  Nswap: 0,
                  Inblock: 1432,
                  Oublock: 0,
                  Msgsnd: 0,
                  Msgrcv: 0,
                  Nsignals: 0,
                  Nvcsw: 531,
                  Nivcsw: 31,
              },
          },
          Stderr: [69, 114, 114, 111, 114, 58, 32, 65, 110, 32, 101, 114, 114, 111, 114, 32, 111, 99, 99, 117, 114, 114, 101, 100, 32, 119, 104, 105, 108, 101, 32, 99, 104, 101, 99, 107, 105, 110, 103, 32, 102, 111, 114, 32, 99, 104, 97, 114, 116, 32, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 46, 32, 89, 111, 117, 32, 109, 97, 121, 32, 110, 101, 101, 100, 32, 116, 111, 32, 114, 117, 110, 32, 96, 104, 101, 108, 109, 32, 100, 101, 112, 101, 110, 100, 101, 110, 99, 121, 32, 98, 117, 105, 108, 100, 96, 32, 116, 111, 32, 102, 101, 116, 99, 104, 32, 109, 105, 115, 115, 105, 110, 103, 32, 100, 101, 112, 101, 110, 100, 101, 110, 99, 105, 101, 115, 58, 32, 102, 111, 117, 110, 100, 32, 105, 110, 32, 67, 104, 97, 114, 116, 46, 121, 97, 109, 108, 44, 32, 98, 117, 116, 32, 109, 105, 115, 115, 105, 110, 103, 32, 105, 110, 32, 99, 104, 97, 114, 116, 115, 47, 32, 100, 105, 114, 101, 99, 116, 111, 114, 121, 58, 32, 99, 101, 114, 116, 45, 109, 97, 110, 97, 103, 101, 114, 10],
      }
  occurred
  In [BeforeSuite] at: /home/jaypipes/src/github.com/temporalio/temporal-worker-controller/api/v1alpha1/webhook_suite_test.go:165 @ 05/28/26 14:09:58.074
------------------------------

Summarizing 1 Failure:
  [FAIL] [BeforeSuite] 
  /home/jaypipes/src/github.com/temporalio/temporal-worker-controller/api/v1alpha1/webhook_suite_test.go:165

Ran 0 of 11 Specs in 0.032 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
--- FAIL: TestAPIs (0.03s)
FAIL
coverage: 22.6% of statements
FAIL	github.com/temporalio/temporal-worker-controller/api/v1alpha1	0.150s
ok  	github.com/temporalio/temporal-worker-controller/internal/controller	0.125s	coverage: 56.0% of statements
ok  	github.com/temporalio/temporal-worker-controller/internal/controller/clientpool	0.075s	coverage: 59.3% of statements
ok  	github.com/temporalio/temporal-worker-controller/internal/controller/k8s.io/utils	0.006s	coverage: 100.0% of statements
?   	github.com/temporalio/temporal-worker-controller/internal/defaults	[no test files]
ok  	github.com/temporalio/temporal-worker-controller/internal/k8s	0.169s	coverage: 89.2% of statements
ok  	github.com/temporalio/temporal-worker-controller/internal/planner	0.018s	coverage: 94.0% of statements
ok  	github.com/temporalio/temporal-worker-controller/internal/temporal	0.015s	coverage: 7.9% of statements
ok  	github.com/temporalio/temporal-worker-controller/internal/testhelpers	0.029s	coverage: 39.1% of statements

Changing this line of webhook_suite_test.go from this:

Expect(err).NotTo(HaveOccurred(), "helm template failed — is helm installed?")

to this:

	if err != nil {
		Expect(err).NotTo(HaveOccurred(), string(err.(*exec.ExitError).Stderr))
	}

allowed me to see what the actual error was:

·> make test-unit
test -s /home/jaypipes/src/github.com/temporalio/temporal-worker-controller/bin/setup-envtest || GOBIN=/home/jaypipes/src/github.com/temporalio/temporal-worker-controller/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
KUBEBUILDER_ASSETS="/home/jaypipes/src/github.com/temporalio/temporal-worker-controller/bin/k8s/1.29.0-linux-amd64" go test ./... -coverprofile cover.out
# github.com/temporalio/temporal-worker-controller/hack/demohelper
go: no such tool "covdata"
# github.com/temporalio/temporal-worker-controller/cmd
go: no such tool "covdata"
# github.com/temporalio/temporal-worker-controller/internal/testhelpers/testlogr
go: no such tool "covdata"
Running Suite: Webhook Suite - /home/jaypipes/src/github.com/temporalio/temporal-worker-controller/api/v1alpha1
===============================================================================================================
Random Seed: 1779992168

Will run 11 of 11 specs
------------------------------
[BeforeSuite] [FAILED] [0.027 seconds]
[BeforeSuite] 
/home/jaypipes/src/github.com/temporalio/temporal-worker-controller/api/v1alpha1/webhook_suite_test.go:57

  Timeline >>
  STEP: bootstrapping test environment @ 05/28/26 14:16:08.308
  [FAILED] in [BeforeSuite] - /home/jaypipes/src/github.com/temporalio/temporal-worker-controller/api/v1alpha1/webhook_suite_test.go:166 @ 05/28/26 14:16:08.335
  << Timeline

  [FAILED] Error: An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: found in Chart.yaml, but missing in charts/ directory: cert-manager

I tried to change the executing command from this:

	out, err := exec.Command("helm", "template", "test", chartPath, "--show-only", "templates/webhook.yaml").Output()

to this:

	out, err := exec.Command("helm", "template", "test", chartPath, "--set", "certmanager.install=false", "--show-only", "templates/webhook.yaml").Output()

But that did not work because Helm is stupid and helm template doesn't have the same dependency disablement behaviour as helm install :(

So I think we're going to need to change the strategy for testing these webhook YAML artifacts.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions