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

Travis job fails because check_workspace detects dirty working directory #120

Closed
asobti opened this issue Nov 20, 2018 · 3 comments
Closed

Comments

@asobti
Copy link
Owner

asobti commented Nov 20, 2018

Not sure what is causing this. Double checked to confirm go fmt does not result in any changes.
Eg: https://travis-ci.org/asobti/kube-monkey/jobs/457331794

@asobti
Copy link
Owner Author

asobti commented Nov 20, 2018

Modifed check_workspace.sh to list dirty files and it shows the following

$ .travis/check_workspace.sh
Dirty workspace detected. This typically indicates 'go fmt' changed some files? 
 Run 'make' locally to verify.
 M victims/victims_test.go
The command ".travis/check_workspace.sh" exited with 1

https://travis-ci.org/asobti/kube-monkey/jobs/457334783

but running make gofmt locally shows no changes to any file. Might be a version mismatch.

Temporarily disabling check_workspace.sh
#122

asobti pushed a commit that referenced this issue Nov 20, 2018
@asobti
Copy link
Owner Author

asobti commented Nov 20, 2018

This check only fails for Go 1.10.x:
https://travis-ci.org/asobti/kube-monkey/jobs/457341114

but succeeds for Go 1.11.x
https://travis-ci.org/asobti/kube-monkey/jobs/457341115

@dilyar85
Copy link

I found the problem is that gofmt has been updated the way formatting items of a list.
Go 1.10 and Go 1.11 will produce different results after doing gofmt on the file victims/victims_test.go:

--- (Go-1.11)/victims/victims_test.go 
+++ (Go-1.10)/victims/victims_test.go
@@ -362,17 +362,17 @@ func TestGetDeleteOptsForPod(t *testing.T) {
 
 	tcs := []TestCase{
 		{
-			name:                   "nil pod TerminationGracePeriod",
+			name: "nil pod TerminationGracePeriod",
 			terminationGracePeriod: nil,
 			expectedGracePeriod:    defaultGracePeriod,
 		},
 		{
-			name:                   "pod TerminateGracePeriod lower than configured grace period",
+			name: "pod TerminateGracePeriod lower than configured grace period",
 			terminationGracePeriod: newInt64Pointer(*defaultGracePeriod - int64(1)),
 			expectedGracePeriod:    defaultGracePeriod,
 		},
 		{
-			name:                   "pod TerminationGracePeriod higher than configured grace period",
+			name: "pod TerminationGracePeriod higher than configured grace period",
 			terminationGracePeriod: newInt64Pointer(*defaultGracePeriod + int64(1)),
 			expectedGracePeriod:    newInt64Pointer(*defaultGracePeriod + int64(1)),
 		},

I suggest if we want to enforce gofmt via Travis CI, we should stick to exactly one version of gofmt.

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

No branches or pull requests

3 participants