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

Unit test fails in golang:1.13-alpine due to path assumption #2640

Closed
bnevis-i opened this issue Jul 24, 2020 · 0 comments · Fixed by #2641
Closed

Unit test fails in golang:1.13-alpine due to path assumption #2640

bnevis-i opened this issue Jul 24, 2020 · 0 comments · Fixed by #2641
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bnevis-i
Copy link
Collaborator

🐞 Bug Report

Affected Services

security-file-token-provider (security-secretstore-setup)

Description and Minimal Reproduction

Currently in the Jenkins job, the tests run on the physical host. In the new pipeline everything runs in the context of the golang:1.13-alpine image. When I switched to this the go test command started failing in this test:

00:03:26.562  --- FAIL: TestCreatesFile (0.00s)
00:03:26.562      tokenprovider_linux_test.go:55: 
00:03:26.562          	Error Trace:	tokenprovider_linux_test.go:55
00:03:26.562          	Error:      	Received unexpected error:
00:03:26.562          	            	open /tmp/tokenprovider_linux_test.dat: no such file or directory
00:03:26.562          	Test:       	TestCreatesFile
00:03:26.562  FAIL
00:03:26.562  coverage: 26.2% of statements
00:03:26.562  FAIL	github.com/edgexfoundry/edgex-go/internal/security/secretstore	0.034s

After lots of trial and error I traced to the issue to this line in this file: internal/security/secretstore/tokenprovider_linux_test.go

TokenProvider:     "/usr/bin/touch"
docker run --rm -it golang:1.13-alpine sh
$ /usr/bin/touch
sh: /usr/bin/touch: not found

In alpine touch is not at this path.

@bnevis-i bnevis-i added the bug Something isn't working label Jul 24, 2020
@bnevis-i bnevis-i added this to the Hanoi milestone Jul 24, 2020
@bnevis-i bnevis-i self-assigned this Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant