HiveBrain v1.2.0
Get Started
← Back to all entries
patterngoCritical

Force retesting or disable test caching

Submitted by: @import:stackoverflow-api··
0
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.

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:

  • 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.