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

Lint files with 'integration' build flag #1508

Merged
merged 17 commits into from May 18, 2020
Merged

Conversation

nfnt
Copy link
Member

@nfnt nfnt commented May 12, 2020

What this PR does / why we need it:
golangci-lint has to be instructed to not skip code that has build tags. By adding integration to the build-tags property, we ensure that integration tests are linted.

'golangci-lint' has to be instructed to not skip code that has build tags. By adding 'integration' to the 'build-tags' property, we ensure that integration tests are linted.

Signed-off-by: Jan Schlicht <jan@d2iq.com>
@nfnt nfnt self-assigned this May 12, 2020
Copy link
Member

@ANeumann82 ANeumann82 left a comment

Choose a reason for hiding this comment

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

Nice find :)

@kensipe
Copy link
Member

kensipe commented May 13, 2020

not sure if we have a flaky test... :(

=== RUN   TestRestartController
 
2020/05/12 08:55:06 Given an existing instance 'foo-instance' and operator 'foo-operator'
 
2020/05/12 08:55:06 And a deploy plan that was already run
 
Instance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not found    TestRestartController: instance_controller_test.go:96: 
 
        	Error Trace:	instance_controller_test.go:96
 
        	Error:      	Condition never satisfied
 
        	Test:       	TestRestartController
 
2020/05/12 08:55:11 When we stop the manager
 
2020/05/12 08:55:11 And update the instance parameter value
 
    TestRestartController: instance_controller_test.go:104: 
 
        	Error Trace:	instance_controller_test.go:104
 
        	Error:      	Received unexpected error:
 
        	            	Instance.kudo.dev "foo-instance" not found
 
        	Test:       	TestRestartController
 
    TestRestartController: instance_controller_test.go:106: 
 
        	Error Trace:	instance_controller_test.go:106
 
        	Error:      	Received unexpected error:
 
        	            	Operation cannot be fulfilled on instances.kudo.dev "foo-instance": StorageError: invalid object, Code: 4, Key: /registry/kudo.dev/instances/default/foo-instance, ResourceVersion: 0, AdditionalErrorMsg: Precondition failed: UID in precondition: 8c6d887b-aa54-4bf4-b72c-d424f80eebbf, UID in object meta: 
 
        	Test:       	TestRestartController
 
2020/05/12 08:55:11 And restart the manager again
 
2020/05/12 08:55:11 Then an update plan should be triggered instead of deploy plan
 
Instance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not foundInstance.kudo.dev "foo-instance" not found    TestRestartController: instance_controller_test.go:112: 
 
        	Error Trace:	instance_controller_test.go:112
 
        	Error:      	Condition never satisfied
 
        	Test:       	TestRestartController
 
--- FAIL: TestRestartController (10.10s)
 

restarted test

@nfnt
Copy link
Member Author

nfnt commented May 14, 2020

@kensipe These are errors from asserting the resources are deleted. It's not a flake, but also very unlikely that it's uncovering a bug in KUDO. I'll check what needs to be done to assert resource deletion while also making sure that only existing resources are deleted.

Jan Schlicht added 6 commits May 14, 2020 10:47
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
@nfnt nfnt force-pushed the nfnt/lint-integration-tests branch from 7b78d99 to 6814fab Compare May 14, 2020 11:29
Signed-off-by: Jan Schlicht <jan@d2iq.com>
@nfnt nfnt force-pushed the nfnt/lint-integration-tests branch from 6814fab to 4228e4e Compare May 14, 2020 11:46
Jan Schlicht added 3 commits May 14, 2020 14:05
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
@nfnt
Copy link
Member Author

nfnt commented May 14, 2020

I'll have to give up on init_integration_test.go for now. There are some dependencies on the order of the resources to be deleted. Furthermore, it seems that ignoring these error in the past resulted in test cases depending on resources created by prior test cases. As least that's how I interpret the current test results. The whole test suite needs to be refactored to ensure that resources are use in the way they're supposed to be used. Fixed.

Signed-off-by: Jan Schlicht <jan@d2iq.com>
@nfnt nfnt force-pushed the nfnt/lint-integration-tests branch from 1b57618 to ffa3373 Compare May 15, 2020 08:14
Jan Schlicht added 3 commits May 15, 2020 10:38
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Signed-off-by: Jan Schlicht <jan@d2iq.com>
@nfnt nfnt force-pushed the nfnt/lint-integration-tests branch 3 times, most recently from 708034f to 351654c Compare May 15, 2020 11:53
@nfnt nfnt force-pushed the nfnt/lint-integration-tests branch 3 times, most recently from d6cc595 to 447ebc6 Compare May 18, 2020 09:22
Signed-off-by: Jan Schlicht <jan@d2iq.com>
@nfnt nfnt force-pushed the nfnt/lint-integration-tests branch from 447ebc6 to 6b13823 Compare May 18, 2020 09:27
Signed-off-by: Jan Schlicht <jan@d2iq.com>
Copy link
Contributor

@zen-dog zen-dog left a comment

Choose a reason for hiding this comment

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

Nice work! 🚢

@nfnt nfnt merged commit 98a90e6 into master May 18, 2020
@nfnt nfnt deleted the nfnt/lint-integration-tests branch May 18, 2020 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants