mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
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:
parent
73ef0cde01
commit
0d7a671c75
@ -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" {
|
||||
|
@ -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")
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user