patterngoCritical
Force retesting or disable test caching
Viewed 0 times
cachingdisableforceretestingtest
Problem
Problem:
When I run the same go test twice the second run is not done at all. The results are the cached ones from the first run.
Links
I already checked https://golang.org/cmd/go/#hdr-Testing_flags but there is no cli flag for that purpose.
Question:
Is there a possibility to force go test to always run test and not to cache test results.
When I run the same go test twice the second run is not done at all. The results are the cached ones from the first run.
PASS
ok tester/apitests (cached)Links
I already checked https://golang.org/cmd/go/#hdr-Testing_flags but there is no cli flag for that purpose.
Question:
Is there a possibility to force go test to always run test and not to cache test results.
Solution
There are a few options as described in the testing flags docs:
That said, changes in your code or test code will invalidate the cached test results (there's extended logic when using local files or environment variables as well), so you should not need to invalidate the test cache manually.
go clean -testcache: expires all test results
- use non-cacheable flags on your test run. The idiomatic way is to use
-count=1
That said, changes in your code or test code will invalidate the cached test results (there's extended logic when using local files or environment variables as well), so you should not need to invalidate the test cache manually.
Context
Stack Overflow Q#48882691, score: 449
Revisions (0)
No revisions yet.