-
Notifications
You must be signed in to change notification settings - Fork 717
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
Remove User CRD #948
Remove User CRD #948
Conversation
jenkins test this please |
Todo in some other PRs (I will create them after this one is merged):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good 👍 For me the only open question before merging is about the ownership of the user secret (see my comments)
...controller/apmserverelasticsearchassociation/apmserverelasticsearchassociation_controller.go
Outdated
Show resolved
Hide resolved
} | ||
|
||
// ChecksUser checks that a secret contains the required fields expected by the user reconciler. | ||
func ChecksUser(t *testing.T, secret *corev1.Secret, expectedUsername string, expectedRoles []string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this introduce a dependency to testing
in production code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question !
Functions in *_test.go
files are not available for import by other tests. Looks like there is no easy way to share some code between tests.
I did some tests and it looks like there is not dependency as long as the function is not explicitly used in some production code.
For example if ChecksUser
is explicitly called elsewhere in the production code the binary is 1MB bigger and all the test tooling seems to be embedded in the binary:
$ strings elastic-operator|grep -i 'testing\.'
*testing.T
**testing.T
*[]*testing.T
*testing.common
**testing.common
*testing.matcher
*func(*testing.T)
*testing.indenter
...
If the function ChecksUser
is shared by some tests but not in the production code (like in this PR):
$ strings elastic-operator|grep -i 'testing\.'
testing.init
/usr/local/Cellar/go/1.11.4/libexec/src/testing/testing.go
$
it is the same result with the code on the current master branch btw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Nice analysis!
operators/pkg/controller/elasticsearch/elasticsearch_controller.go
Outdated
Show resolved
Hide resolved
jenkins test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great work!
jenkins test this please |
Fixes:
Still a WIP:
Todo in an other PR: