Skip to content

Test Failures with latest version of sigs.k8s.io/controller-runtime  #7882

@lakshmimsft

Description

@lakshmimsft

Steps to reproduce

  1. Checkout branch of latest dependabot PR with updates to sigs.k8s.io/controller-runtime eg. Bump the all group with 9 updates #7878
  2. run
           go get -u sigs.k8s.io/controller-runtime@latest
           go get -u k8s.io/client-go@latest

ensure go.mod is updated with sigs.k8s.io/controller-runtime v0.19.0 and k8s.io/client-go v0.31.0
4. run go mod tidy
5. run make build. Update code for errors (remove field WarningHandler as indicated in build errors):

        pkg/ucp/dataprovider/factory.go:67:3: unknown field WarningHandler in struct literal of type client.Options
        pkg/ucp/dataprovider/factory.go:67:33: undefined: runtimeclient.WarningHandlerOptions   
  1. make build should now run fine.
  2. run make test. this should return errors similar to for ~9 unit tests testing reconciler:
=== FAIL: pkg/controller/reconciler Test_DeploymentReconciler_ChangeEnvironmentAndApplication (0.00s)
    deployment_reconciler_test.go:81: 
                Error Trace:    ../pkg/controller/reconciler/deployment_reconciler_test.go:81
                                                        ../pkg/controller/reconciler/deployment_reconciler_test.go:142
                Error:          Received unexpected error:
                                controller with name deployment already exists. Controller names must be unique to avoid multiple controllers reporting to the same metric
                Test:           Test_DeploymentReconciler_ChangeEnvironmentAndApplication

=== FAIL: pkg/controller/reconciler Test_DeploymentReconciler_RadiusEnabled_ThenRadiusDisabled (0.00s)
    deployment_reconciler_test.go:81: 
                Error Trace:    ../pkg/controller/reconciler/deployment_reconciler_test.go:81
                                                        ../pkg/controller/reconciler/deployment_reconciler_test.go:216
                Error:          Received unexpected error:
                                controller with name deployment already exists. Controller names must be unique to avoid multiple controllers reporting to the same metric
                Test:           Test_DeploymentReconciler_RadiusEnabled_ThenRadiusDisabled

Observed behavior

Unit Tests for controller failing with latest version of sigs.k8s.io/controller-runtime and related dependencies

Desired behavior

Unit tests should not fail

Workaround

Currently, we have not yet updated the codebase to the latest version of sigs.k8s.io/controller-runtime and it's related dependencies.

rad Version

The latest version of the envtest tool used for unit testing in the controller-runtime project appears to be v0.17.0. We need to investigate if there is an incompatibility issue or if a code update is needed to ensure unit tests run successfully.

Operating system

No response

Additional context

No response

Would you like to support us?

  • Yes, I would like to support you

AB#13145

Metadata

Metadata

Labels

bugSomething is broken or not working as expectedimportantThis item is a high priority Issue we intend to address as soon as possibletriagedThis issue has been reviewed and triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions