Skip to content

Commit

Permalink
Merge pull request #53 from lalamove/lint
Browse files Browse the repository at this point in the history
lint ineffassign
  • Loading branch information
francoispqt authored Jun 18, 2019
2 parents be497fe + 2064c58 commit de5140f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
18 changes: 11 additions & 7 deletions loader/klconsul/consulloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,17 @@ func TestLoad(t *testing.T) {

var timer = time.NewTimer(150 * time.Millisecond)
var watched bool
select {
case <-hl.Watch():
watched = true
hl.Close()
case <-timer.C:
hl.Close()
require.True(t, watched)
outer:
for {
select {
case <-hl.Watch():
watched = true
hl.Close()
case <-timer.C:
hl.Close()
require.True(t, watched)
break outer
}
}

return hl
Expand Down
15 changes: 9 additions & 6 deletions loader/kletcd/etcdloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,15 @@ func TestEtcdLoader(t *testing.T) {

var timer = time.NewTimer(300 * time.Millisecond)
var watched bool
select {
case <-timer.C:
l.Close()
require.True(t, watched)
case <-l.Watch():
watched = true
for {
select {
case <-timer.C:
l.Close()
require.True(t, watched)
return
case <-l.Watch():
watched = true
}
}
},
)
Expand Down

0 comments on commit de5140f

Please sign in to comment.