fake recorder added to tests fix#1807
Draft
limak9182 wants to merge 1 commit intofeature/database-controllersfrom
Draft
fake recorder added to tests fix#1807limak9182 wants to merge 1 commit intofeature/database-controllersfrom
limak9182 wants to merge 1 commit intofeature/database-controllersfrom
Conversation
Contributor
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Issues in our tests while running
make test:It looks like the issue was in the test code itself:
While adding event's functionality I introduced Recorder in the Postgres<Database/Cluster>Reconciler struct, but we haven't reflected that in our test code.
------------------------------ PostgresCluster Controller /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:34 When reconciling a resource /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:35 should successfully reconcile the resource /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:70 > Enter [BeforeEach] When reconciling a resource - /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:46 @ 04/01/26 09:20:48.909 STEP: creating the custom resource for the Kind PostgresCluster - /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:47 @ 04/01/26 09:20:48.91 [FAILED] Expected success, but got an error: <*errors.StatusError | 0x140020235e0>: PostgresCluster.enterprise.splunk.com "test-resource" is invalid: spec.class: Invalid value: "": spec.class in body should be at least 1 chars long { ErrStatus: { TypeMeta: {Kind: "", APIVersion: ""}, ListMeta: { SelfLink: "", ResourceVersion: "", Continue: "", RemainingItemCount: nil, }, Status: "Failure", Message: "PostgresCluster.enterprise.splunk.com \"test-resource\" is invalid: spec.class: Invalid value: \"\": spec.class in body should be at least 1 chars long", Reason: "Invalid", Details: { Name: "test-resource", Group: "enterprise.splunk.com", Kind: "PostgresCluster", UID: "", Causes: [ { Type: "FieldValueInvalid", Message: "Invalid value: \"\": spec.class in body should be at least 1 chars long", Field: "spec.class", }, ], RetryAfterSeconds: 0, }, Code: 422, }, } In [BeforeEach] at: /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:57 @ 04/01/26 09:20:48.914 Full Stack Trace github.com/splunk/splunk-operator/internal/controller.init.func17.1.1() /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:57 +0x164 < Exit [BeforeEach] When reconciling a resource - /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:46 @ 04/01/26 09:20:48.914 (5ms) > Enter [AfterEach] When reconciling a resource - /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:61 @ 04/01/26 09:20:48.915 [FAILED] Unexpected error: <*errors.StatusError | 0x14002bcc460>: postgresclusters.enterprise.splunk.com "test-resource" not found { ErrStatus: { TypeMeta: {Kind: "", APIVersion: ""}, ListMeta: { SelfLink: "", ResourceVersion: "", Continue: "", RemainingItemCount: nil, }, Status: "Failure", Message: "postgresclusters.enterprise.splunk.com \"test-resource\" not found", Reason: "NotFound", Details: { Name: "test-resource", Group: "enterprise.splunk.com", Kind: "postgresclusters", UID: "", Causes: nil, RetryAfterSeconds: 0, }, Code: 404, }, } occurred In [AfterEach] at: /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:65 @ 04/01/26 09:20:48.917 Full Stack Trace github.com/splunk/splunk-operator/internal/controller.init.func17.1.2() /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:65 +0xe0 < Exit [AfterEach] When reconciling a resource - /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:61 @ 04/01/26 09:20:48.918 (3ms) • [FAILED] [0.008 seconds] PostgresCluster Controller /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:34 When reconciling a resource [BeforeEach] /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:46 should successfully reconcile the resource /Users/kubych/repos/splunk-operator/internal/controller/postgrescluster_controller_test.go:70 ------------------------------And fix for it is to add class name for example test provided by kubebuilder.
Key Changes
Highlight the updates in specific files
Testing and Verification
Now it's all green:
Related Issues
Jira tickets, GitHub issues, Support tickets...
PR Checklist