Skip to content

Commit

Permalink
test: fix unbounded context
Browse files Browse the repository at this point in the history
  • Loading branch information
Reasno committed Aug 6, 2021
1 parent d95c325 commit f705cf6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config/remote/etcd/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ func put(r *ETCD, val string) error {
}
defer client.Close()

_, err = client.Put(context.Background(), r.key, val)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()

_, err = client.Put(ctx, r.key, val)
if err != nil {
return err
}
Expand Down

0 comments on commit f705cf6

Please sign in to comment.