Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Use new test fixture in Cassandra controls#291

Merged
jetstack-bot merged 1 commit intojetstack:masterfrom
wallrj:use-new-test-fixture
Mar 27, 2018
Merged

Use new test fixture in Cassandra controls#291
jetstack-bot merged 1 commit intojetstack:masterfrom
wallrj:use-new-test-fixture

Conversation

@wallrj
Copy link
Contributor

@wallrj wallrj commented Mar 20, 2018

I'm trying to get rid of the Cassandra specific test fixture in ./pkg/controllers/cassandra/testing
In this branch I've switched:

  • ServiceAccounts
  • Roles
  • RoleBindings

I'll deal with Pilot and NodePool controls in separate branches.

Release note:

NONE

}
_, err = client.Create(newRole)
if k8sErrors.IsAlreadyExists(err) {
return nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments here as in the role package 😄

if err != nil {
t.Fatal(err)
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same again

ServiceLister corelisters.ServiceLister
ServiceAccountLister corelisters.ServiceAccountLister
RoleBindingLister rbaclisters.RoleBindingLister
RoleLister rbaclisters.RoleLister
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought (not for this PR): this list is going to get long 🙃

@munnerz
Copy link
Contributor

munnerz commented Mar 27, 2018

/test e2e

@munnerz
Copy link
Contributor

munnerz commented Mar 27, 2018

/test e2e v1.10

@munnerz
Copy link
Contributor

munnerz commented Mar 27, 2018

/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.
@wallrj wallrj force-pushed the use-new-test-fixture branch from d291064 to 758ec1a Compare March 27, 2018 12:44
@jetstack-bot
Copy link
Collaborator

jetstack-bot commented Mar 27, 2018

@wallrj: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
navigator-e2e-v1-10 758ec1a link /test e2e v1.10

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.

Details

Instructions 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.

@munnerz munnerz closed this Mar 27, 2018
@munnerz munnerz reopened this Mar 27, 2018
@munnerz
Copy link
Contributor

munnerz commented Mar 27, 2018

/lgtm
/approve

@jetstack-bot
Copy link
Collaborator

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jetstack-bot jetstack-bot merged commit 95381ef into jetstack:master Mar 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants