mirror of https://github.com/k3s-io/k3s
Merge pull request #27350 from jsafrane/integration-deleteetcd
Automatic merge from submit-queue Remove duplicate deleteAllEtcdKeys() from integration tests.pull/6/head
commit
065217e4d7
|
@ -442,7 +442,7 @@ func TestSingleWatch(t *testing.T) {
|
|||
defer s.Close()
|
||||
|
||||
ns := "blargh"
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
client := client.NewOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
||||
|
||||
mkEvent := func(i int) *api.Event {
|
||||
|
|
|
@ -108,7 +108,7 @@ func TestPersistentVolumeRecycler(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, ctrl, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -156,7 +156,7 @@ func TestPersistentVolumeDeleter(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, ctrl, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -208,7 +208,7 @@ func TestPersistentVolumeBindRace(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, ctrl, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -273,7 +273,7 @@ func TestPersistentVolumeClaimLabelSelector(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, controller, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -346,7 +346,7 @@ func TestPersistentVolumeClaimLabelSelectorMatchExpressions(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, controller, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -438,7 +438,7 @@ func TestPersistentVolumeMultiPVs(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, controller, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -513,7 +513,7 @@ func TestPersistentVolumeMultiPVs(t *testing.T) {
|
|||
waitForAnyPersistentVolumePhase(watchPV, api.VolumeReleased)
|
||||
t.Log("volumes released")
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
}
|
||||
|
||||
// TestPersistentVolumeMultiPVsPVCs tests binding of 100 PVC to 100 PVs.
|
||||
|
@ -522,7 +522,7 @@ func TestPersistentVolumeMultiPVsPVCs(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, binder, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -593,7 +593,7 @@ func TestPersistentVolumeMultiPVsPVCs(t *testing.T) {
|
|||
glog.V(2).Infof("PVC %q is bound to PV %q", pvc.Name, pvc.Spec.VolumeName)
|
||||
}
|
||||
testSleep()
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
}
|
||||
|
||||
// TestPersistentVolumeProvisionMultiPVCs tests provisioning of many PVCs.
|
||||
|
@ -602,7 +602,7 @@ func TestPersistentVolumeProvisionMultiPVCs(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, binder, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -672,7 +672,7 @@ func TestPersistentVolumeProvisionMultiPVCs(t *testing.T) {
|
|||
}
|
||||
glog.V(2).Infof("TestPersistentVolumeProvisionMultiPVCs: volumes are deleted")
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
}
|
||||
|
||||
// TestPersistentVolumeMultiPVsDiffAccessModes tests binding of one PVC to two
|
||||
|
@ -681,7 +681,7 @@ func TestPersistentVolumeMultiPVsDiffAccessModes(t *testing.T) {
|
|||
_, s := framework.RunAMaster(t)
|
||||
defer s.Close()
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
testClient, controller, watchPV, watchPVC := createClients(t, s)
|
||||
defer watchPV.Stop()
|
||||
defer watchPVC.Stop()
|
||||
|
@ -747,7 +747,7 @@ func TestPersistentVolumeMultiPVsDiffAccessModes(t *testing.T) {
|
|||
waitForAnyPersistentVolumePhase(watchPV, api.VolumeReleased)
|
||||
t.Log("volume released")
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
}
|
||||
|
||||
func waitForPersistentVolumePhase(client *clientset.Clientset, pvName string, w watch.Interface, phase api.PersistentVolumePhase) {
|
||||
|
|
|
@ -337,7 +337,7 @@ func TestServiceAccountTokenAuthentication(t *testing.T) {
|
|||
// It is the responsibility of the caller to ensure the returned stopFunc is called
|
||||
func startServiceAccountTestServer(t *testing.T) (*clientset.Clientset, restclient.Config, func()) {
|
||||
|
||||
deleteAllEtcdKeys()
|
||||
framework.DeleteAllEtcdKeys()
|
||||
|
||||
// Listener
|
||||
var m *master.Master
|
||||
|
|
|
@ -51,20 +51,6 @@ func withEtcdKey(f func(string)) {
|
|||
f(prefix)
|
||||
}
|
||||
|
||||
func deleteAllEtcdKeys() {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func deletePodOrErrorf(t *testing.T, c *client.Client, ns, name string) {
|
||||
if err := c.Pods(ns).Delete(name, nil); err != nil {
|
||||
t.Errorf("unable to delete pod %v: %v", name, err)
|
||||
|
|
Loading…
Reference in New Issue