Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement e2e controller tests for the multi-version sample used in the docs #3878

Open
camilamacedo86 opened this issue Apr 27, 2024 · 1 comment
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@camilamacedo86
Copy link
Member

camilamacedo86 commented Apr 27, 2024

Description

See that we have the tutorial: https://book.kubebuilder.io/multiversion-tutorial/tutorial
All code used in this tutorial came from the sample in: https://github.com/kubernetes-sigs/kubebuilder/tree/master/docs/book/src/multiversion-tutorial/testdata/project

This sample is tested via the unit-test when we push a PR with changes.
Then, note that currently the EnvTest tests to test the reconciliation is commented:

https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/book/src/multiversion-tutorial/testdata/project/internal/controller/cronjob_controller_test.go#L87-L102

If we uncomment this line we will check in the CI/or when we run make tests for this project the following error:

"controllerGroup": "batch.tutorial.kubebuilder.io", "controllerKind": "CronJob", "CronJob": {"name":"test-resource","namespace":"default"}, "namespace": "default", "name": "test-resource", "reconcileID": "0504dde2-9a69-4126-829d-cd143fc79f8f", "active jobs": 0, "successful jobs": 0, "failed jobs": 0}
  2024-04-26T07:47:09Z	ERROR	unable to list child Jobs	{"error": "field label \".metadata.controller\" not supported for Job"}
  tutorial.kubebuilder.io/project/internal/controller.(*CronJobReconciler).Reconcile
  	/Users/runner/work/kubebuilder/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/internal/controller/cronjob_controller.go:132
  tutorial.kubebuilder.io/project/internal/controller.glob..func1.1.3
  	/Users/runner/work/kubebuilder/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/internal/controller/cronjob_controller_test.go:94
  github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3
  	/Users/runner/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.14.0/internal/node.go:463
  github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3
  	/Users/runner/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.14.0/internal/suite.go:889
2024-04-26T07:47:09Z	DEBUG	job count	{"controller": "cronjob", "controllerGroup": "batch.tutorial.kubebuilder.io", "controllerKind": "CronJob", "CronJob": {"name":"test-resource","namespace":"default"}, "namespace": "default", "name": "test-resource", "reconcileID": "eb8800f5-c534-4025-a99e-0988b0d9321a", "active jobs": 0, "successful jobs": 0, "failed jobs": 0}
  [FAILED] in [It] - /Users/runner/work/kubebuilder/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/internal/controller/cronjob_controller_test.go:97 @ 04/26/24 07:47:09.663
  STEP: Cleaning up the specific resource instance of CronJob @ 04/26/24 07:47:09.663
  2024-04-26T07:47:09Z	DEBUG	no upcoming scheduled times, sleeping until next	{"controller": "cronjob", "controllerGroup": "batch.tutorial.kubebuilder.io", "controllerKind": "CronJob", "CronJob": {"name":"test-resource","namespace":"default"}, "namespace": "default", "name": "test-resource", "reconcileID": "eb8800f5-c534-4025-a99e-0988b0d9321a", "now": "2024-04-26T07:47:09Z", "next run": "2024-04-26T07:48:00Z"}
  << Timeline

  [FAILED] Unexpected error:
      <*errors.StatusError | 0x14000263b80>: 
      field label ".metadata.controller" not supported for Job
      {
          ErrStatus: {
              TypeMeta: {Kind: "", APIVersion: ""},
              ListMeta: {
                  SelfLink: "",
                  ResourceVersion: "",
                  Continue: "",
                  RemainingItemCount: nil,
              },
              Status: "Failure",
              Message: "field label \".metadata.controller\" not supported for Job",
              Reason: "BadRequest",
              Details: nil,
              Code: 400,
          },
      }
  occurred
  In [It] at: /Users/runner/work/kubebuilder/kubebuilder/docs/book/src/multiversion-tutorial/testdata/project/internal/controller/cronjob_controller_test.go:97 @\

Example: https://github.com/kubernetes-sigs/kubebuilder/actions/runs/8844368662/job/24286141139#step:5:474

What we need to do:

Extra Labels

No response

@camilamacedo86 camilamacedo86 added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. labels Apr 27, 2024
@omerap12
Copy link

Maybe I can help with that
/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants