Use new test fixture in Cassandra controls#291
Conversation
| } | ||
| _, err = client.Create(newRole) | ||
| if k8sErrors.IsAlreadyExists(err) { | ||
| return nil |
There was a problem hiding this comment.
We should probably return an error here still, as the resource may not/probably isn't like newRole (because it already exists). Then on the next sync, the IsNotFound check will be run again and the appropriate action taken.
| type testT struct { | ||
| kubeObjects []runtime.Object | ||
| cluster *v1alpha1.CassandraCluster | ||
| fixtureManipulator func(*testing.T, *framework.StateFixture) |
There was a problem hiding this comment.
FYI, I introduced something similar in cert-manager: https://github.com/jetstack/cert-manager/pull/309/files#diff-db7d66ec1a20f75e1ea91f197b370598R27
Mine introduces a PreFn and CheckFn which is passed the fixture structure so it can be manipulated/prepared 😄
| SyncError: fmt.Errorf("simulated sync error"), | ||
| } | ||
| f.RunExpectError() | ||
| "no error if not yet listed": { |
There was a problem hiding this comment.
What test case is this checking? Where the resource exists in the client, but hasn't been seen by the lister yet?
Seems to me like we would expect to get an error in that case, as we'd attempt to create the resource (and then it fails as it already exists). Then, the next sync will occur after a period of time long enough for the lister to be up to date.
| } | ||
| _, err = client.Create(newRoleBinding) | ||
| if k8sErrors.IsAlreadyExists(err) { | ||
| return nil |
There was a problem hiding this comment.
Same comments here as in the role package 😄
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| }, |
| ServiceLister corelisters.ServiceLister | ||
| ServiceAccountLister corelisters.ServiceAccountLister | ||
| RoleBindingLister rbaclisters.RoleBindingLister | ||
| RoleLister rbaclisters.RoleLister |
There was a problem hiding this comment.
thought (not for this PR): this list is going to get long 🙃
|
/test e2e |
|
/test e2e v1.10 |
|
/retest |
* service * serviceaccount * role * rolebinding Also: * Check the ownership of all these objects in case some other controller has added a similarly named object to the namespace. Return an error in case of a clash. * Add documentation about the supplementary resources created by Navigator.
d291064 to
758ec1a
Compare
|
@wallrj: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: munnerz The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I'm trying to get rid of the Cassandra specific test fixture in
./pkg/controllers/cassandra/testingIn this branch I've switched:
I'll deal with Pilot and NodePool controls in separate branches.
Release note: