Get rid of DeleteAllEtcdKeys
This commit is contained in:
@@ -62,21 +62,3 @@ func WithEtcdKey(f func(string)) {
|
||||
defer etcd.NewKeysAPI(NewEtcdClient()).Delete(context.TODO(), prefix, &etcd.DeleteOptions{Recursive: true})
|
||||
f(prefix)
|
||||
}
|
||||
|
||||
// DeleteAllEtcdKeys deletes all keys from etcd.
|
||||
// TODO: Instead of sprinkling calls to this throughout the code, adjust the
|
||||
// prefix in etcdtest package; then just delete everything once at the end
|
||||
// of the test run.
|
||||
func DeleteAllEtcdKeys() {
|
||||
glog.Infof("Deleting all etcd keys")
|
||||
keysAPI := etcd.NewKeysAPI(NewEtcdClient())
|
||||
keys, err := keysAPI.Get(context.TODO(), "/", nil)
|
||||
if err != nil {
|
||||
glog.Fatalf("Unable to list root etcd keys: %v", err)
|
||||
}
|
||||
for _, node := range keys.Node.Nodes {
|
||||
if _, err := keysAPI.Delete(context.TODO(), node.Key, &etcd.DeleteOptions{Recursive: true}); err != nil {
|
||||
glog.Fatalf("Unable delete key: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user