From f705cf6248b845307eab146ffb908686bf279bfe Mon Sep 17 00:00:00 2001 From: reasno Date: Fri, 6 Aug 2021 14:55:01 +0800 Subject: [PATCH] test: fix unbounded context --- config/remote/etcd/etcd_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/remote/etcd/etcd_test.go b/config/remote/etcd/etcd_test.go index 8fcb48e5..007e84eb 100644 --- a/config/remote/etcd/etcd_test.go +++ b/config/remote/etcd/etcd_test.go @@ -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 }