Tests fail if /etc/alpine-release exists
- Dominant language
- Go
- Stars
- 11k
- Forks
- 792
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 48
Description
Hello, I noticed this test failure:
```
--- FAIL: TestParseApkInstalled_Shuffled (0.00s)
apk-installed_test.go:92: Did not expect apk-tools@2.12.10-r1 (Alpine:v3.21, 0188f510baadbae393472103427b9c1875117136, )
apk-installed_test.go:92: Did not find apk-tools@2.12.10-r1 (Alpine, 0188f510baadbae393472103427b9c1875117136, )
--- FAIL: TestParseApkInstalled_Single (0.00s)
apk-installed_test.go:72: Did not expect apk-tools@2.12.10-r1 (Alpine:v3.21, 0188f510baadbae393472103427b9c1875117136, )
apk-installed_test.go:72: Did not find apk-tools@2.12.10-r1 (Alpine, 0188f510baadbae393472103427b9c1875117136, )
--- FAIL: TestParseApkInstalled_Multiple (0.00s)
apk-installed_test.go:112: Did not expect alpine-baselayout-data@3.4.0-r0 (Alpine:v3.21, bd965a7ebf7fd8f07d7a0cc0d7375bf3e4eb9b24, )
apk-installed_test.go:112: Did not expect musl@1.2.3-r4 (Alpine:v3.21, f93af038c3de7146121c2ea8124ba5ce29b4b058, )
apk-installed_test.go:112: Did not expect busybox@1.35.0-r29 (Alpine:v3.21, 1dbf7a793afae640ea643a055b6dd4f430ac116b, )
apk-installed_test.go:112: Did not find alpine-baselayout-data@3.4.0-r0 (Alpine, bd965a7ebf7fd8f07d7a0cc0d7375bf3e4eb9b24, )
apk-installed_test.go:112: Did not find musl@1.2.3-r4 (Alpine, f93af038c3de7146121c2ea8124ba5ce29b4b058, )
apk-installed_test.go:112: Did not find busybox@1.35.0-r29 (Alpine, 1dbf7a793afae640ea643a055b6dd4f430ac116b, )
--- FAIL: TestParseApkInstalled_Malformed (0.00s)
apk-installed_test.go:52: Did not expect busybox@ (Alpine:v3.21, 1dbf7a793afae640ea643a055b6dd4f430ac116b, )
apk-installed_test.go:52: Did not find busybox@ (Alpine, 1dbf7a793afae640ea643a055b6dd4f430ac116b, )
FAIL
FAIL github.com/google/osv-scanner/pkg/lockfile 0.095s
```
I checked the code and it seems `pkg/lockfile/apk-installed.go` tests for `/etc/alpine-release`, which is present when building this on the Alpine build servers.
I'm not sure what's the best way to fix this however.
Contributor guide
Assessment
This issue has not been assessed yet.