Where are you getting the idea that results are cached? I can't even figure out how that would be useful in a testing framework - do you mean it auto-mocks services based on past requests? I've seen nothing like this - are you sure you just don't have the wrong HTTP header fields, so the HTTP request is getting cached by a CDN, etc.
-----Original Message-----
From: [email protected]
Sent: Apr 11, 2019 4:44 PM
To: golang-nuts
Subject: [go-nuts] Re: Disable test result caching from within Go code?OK, I guess that Go has no solution for this.--
On Friday, March 29, 2019 at 2:20:53 AM UTC+1, [email protected] wrote:I have a bunch of integration tests which depend on external services. I've added the build tag "integration" for each source file containing such tests so they are only run when I do:$ go test -tags=integration ./...Go 1.12, by default, caches the tests results, which is exactly what I don't want because these "external services" are usually different backends running on my local machine. When I'm developing code, I want to test my code against the current backend running on my local machine, and not have "go test" return the result from running the tests against the previous backend.I can disable caching by passing the "-count=1" argument to "go test" but this is a pretty blunt instrument: I need to remember when I'm running an integration test and when I'm not, and it applies to the whole set of tests that I'm running.Ideally I'd like to specify within each test whether the result can be cached or not. I looked at the documentation for testing, but the word "cache" is not present,Is there any way for Go test code to control whether its results should be cached?Cheers,Tom
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
