etcd: make embedded etcd context cancelable

This commit is contained in:
Andras Banki-Horvath 2020-08-10 16:38:37 +02:00
parent 281c0b9d92
commit 6f3a45b75f
No known key found for this signature in database
GPG Key ID: 80E5375C094198D8

@ -64,8 +64,10 @@ func NewEmbeddedEtcdInstance(path string) (*BackendConfig, func(), error) {
fmt.Errorf("etcd failed to start after: %v", readyTimeout)
}
ctx, cancel := context.WithCancel(context.Background())
connConfig := &BackendConfig{
Ctx: context.Background(),
Ctx: ctx,
Host: "http://" + peerURL,
User: "user",
Pass: "pass",
@ -73,6 +75,7 @@ func NewEmbeddedEtcdInstance(path string) (*BackendConfig, func(), error) {
}
return connConfig, func() {
cancel()
etcd.Close()
}, nil
}