interestingGoroutines uses so many strings.Contains checks to determine
whether to continue, I think it can be avoided.
This patch introduces shouldSkip func to do the checks in a loop
to make the logic clearer.
Signed-off-by: Jes Cok <xigua67damn@gmail.com>
AssertTrue and AssertFalse use copyToInterface to copy msg. This is
unnecessary, cause we know the msgAndArgs param of assert.Equal is
variadic:
func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool
This patch removes copyToInterface function, and use msg directly.
Signed-off-by: Jes Cok <xigua67damn@gmail.com>
As the doc of regexp.Regex is saying:
"A Regexp is safe for concurrent use by multiple goroutines, except for configuration
methods, such as Regexp.Longest."
Signed-off-by: Jes Cok <xigua67damn@gmail.com>
Downstream users of etcd experience build issues when using dependencies
which require more recent (incompatible) versions of opentelemetry. This
commit upgrades the dependencies so that downstream users stop
experiencing these issues.
The code now ensures that each of the test is running in its own directory as opposed to shared os.tempdir.
```
$ (cd tests && env go test -timeout=15m --race go.etcd.io/etcd/tests/v3/integration/clientv3/examples -run ExampleAuth)
2022/04/03 10:24:59 Running tests (examples): ...
2022/04/03 10:24:59 the function can be called only in the test context. Was integration.BeforeTest() called ?
2022/04/03 10:24:59 2022-04-03T10:24:59.462+0200 INFO m0 LISTEN GRPC {"member": "m0", "grpcAddr": "localhost:m0", "m.Name": "m0"}
```
```
% (cd client/v3 && env go test -short -timeout=3m --race ./...)
--- FAIL: TestAuthTokenBundleNoOverwrite (0.00s)
client_test.go:210: listen unix /var/folders/t1/3m8z9xz93t9c3vpt7zyzjm6w00374n/T/TestAuthTokenBundleNoOverwrite3197524989/001/etcd-auth-test:0: bind: invalid argument
FAIL
FAIL go.etcd.io/etcd/client/v3 4.270s
```
The reason was that the path exceeded 108 chars (that is too much for socket).
In the mitigation we first change chroot (working directory) to the tempDir... such the path is 'local'.
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Used github.com/stretchr/testify/assert to replace the AssertEqual function definition. Required the use of copyToInterface to copy a string slice to the empty interface slice