Due to the nature of the integration tests their results should never be cached as the systems they are integrating against are always changing.
What did you expect to see?
A mechanism to disable caching for specific test functions.
What did you see instead?
Mechanisms for either clearing the cache for all tests or disabling the cache for all test.
Can currently workaround this issues by running tests twice:
Run all unit tests, which the cache should be maintained for, via go test ./...
Run integration test by using the build tag and combining with -count=1 -run=....
This workaround requires that all tests that should never be cached have a regex pattern that be be used; forcing all these test to include the phrase NoCache or something else. These tests would also still need to be protected by requiring a build tag to prevent them from being run in step 1.
Add a NoCache() method to the testing.T struct that would disable the specific method from being cached.