Tests: Fix vet warnings about Fatal in sub-goroutines.

% (cd tests && go vet ./...)
stderr: # go.etcd.io/etcd/tests/v3/integration/clientv3/concurrency_test
stderr: integration/clientv3/concurrency/election_test.go:74:6: call to (*T).Fatal from a non-test goroutine
stderr: integration/clientv3/concurrency/mutex_test.go:57:4: call to (*T).Fatal from a non-test goroutine
This commit is contained in:
Piotr Tabor 2021-01-31 00:00:26 +01:00
parent 73ef0cde01
commit 0d7a671c75
2 changed files with 3 additions and 2 deletions

View File

@ -65,13 +65,14 @@ func TestResumeElection(t *testing.T) {
respChan := make(chan *clientv3.GetResponse)
go func() {
defer close(respChan)
o := e.Observe(ctx)
respChan <- nil
for {
select {
case resp, ok := <-o:
if !ok {
t.Fatal("Observe() channel closed prematurely")
t.Error("Observe() channel closed prematurely")
}
// Ignore any observations that candidate1 was elected
if string(resp.Kvs[0].Value) == "candidate1" {

View File

@ -54,7 +54,7 @@ func TestMutexLockSessionExpired(t *testing.T) {
defer close(m2Locked)
// m2 blocks since m1 already acquired lock /my-lock/
if err2 = m2.Lock(context.TODO()); err2 == nil {
t.Fatal("expect session expired error")
t.Error("expect session expired error")
}
}()