Skip to content

Commit

Permalink
Merge pull request kubernetes#37113 from kubernetes/revert-35697-upgr…
Browse files Browse the repository at this point in the history
…ade-tests

Automatic merge from submit-queue

Revert "Add more test cases to k8s e2e upgrade tests"

Reverts kubernetes#35697
  • Loading branch information
Kubernetes Submit Queue authored Nov 19, 2016
2 parents b9d2d74 + 18a1c88 commit 076051b
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 488 deletions.
230 changes: 4 additions & 226 deletions test/e2e/cluster_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ import (
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/test/e2e/chaosmonkey"
"k8s.io/kubernetes/test/e2e/common"
"k8s.io/kubernetes/test/e2e/framework"

. "github.com/onsi/ginkgo"
)

// TODO(mikedanese): Add setup, validate, and teardown for:
// - secrets
// - volumes
// - persistent volumes
var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
f := framework.NewDefaultFramework("cluster-upgrade")

framework.KubeDescribe("master upgrade", func() {
It("should maintain functioning cluster during upgrade [Feature:MasterUpgrade]", func() {
It("should maintain responsive services [Feature:MasterUpgrade]", func() {
cm := chaosmonkey.New(func() {
v, err := realVersion(framework.TestContext.UpgradeTarget)
framework.ExpectNoError(err)
Expand All @@ -48,11 +48,6 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
cm.Register(func(sem *chaosmonkey.Semaphore) {
// Close over f.
testServiceRemainsUp(f, sem)
testSecretsDuringUpgrade(f, sem)
testConfigMapsDuringUpgrade(f, sem)
testGuestbookApplicationDuringUpgrade(f, sem)
testDaemonSetDuringUpgrade(f, sem)
testJobsDuringUpgrade(f, sem)
})
cm.Do()
})
Expand All @@ -69,16 +64,11 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
cm.Register(func(sem *chaosmonkey.Semaphore) {
// Close over f.
testServiceUpBeforeAndAfter(f, sem)
testSecretsBeforeAndAfterUpgrade(f, sem)
testConfigMapsBeforeAndAfterUpgrade(f, sem)
testGuestbookApplicationBeforeAndAfterUpgrade(f, sem)
testDaemonSetBeforeAndAfterUpgrade(f, sem)
testJobsBeforeAndAfterUpgrade(f, sem)
})
cm.Do()
})

It("should maintain functioning cluster during upgrade [Feature:ExperimentalNodeUpgrade]", func() {
It("should maintain responsive services [Feature:ExperimentalNodeUpgrade]", func() {
cm := chaosmonkey.New(func() {
v, err := realVersion(framework.TestContext.UpgradeTarget)
framework.ExpectNoError(err)
Expand All @@ -88,11 +78,6 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
cm.Register(func(sem *chaosmonkey.Semaphore) {
// Close over f.
testServiceRemainsUp(f, sem)
testSecretsDuringUpgrade(f, sem)
testConfigMapsDuringUpgrade(f, sem)
testGuestbookApplicationDuringUpgrade(f, sem)
testDaemonSetDuringUpgrade(f, sem)
testJobsDuringUpgrade(f, sem)
})
cm.Do()
})
Expand All @@ -111,16 +96,11 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
cm.Register(func(sem *chaosmonkey.Semaphore) {
// Close over f.
testServiceUpBeforeAndAfter(f, sem)
testSecretsBeforeAndAfterUpgrade(f, sem)
testConfigMapsBeforeAndAfterUpgrade(f, sem)
testGuestbookApplicationBeforeAndAfterUpgrade(f, sem)
testDaemonSetBeforeAndAfterUpgrade(f, sem)
testJobsBeforeAndAfterUpgrade(f, sem)
})
cm.Do()
})

It("should maintain functioning cluster during upgrade [Feature:ExperimentalClusterUpgrade]", func() {
It("should maintain responsive services [Feature:ExperimentalClusterUpgrade]", func() {
cm := chaosmonkey.New(func() {
v, err := realVersion(framework.TestContext.UpgradeTarget)
framework.ExpectNoError(err)
Expand All @@ -132,11 +112,6 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
cm.Register(func(sem *chaosmonkey.Semaphore) {
// Close over f.
testServiceRemainsUp(f, sem)
testSecretsDuringUpgrade(f, sem)
testConfigMapsDuringUpgrade(f, sem)
testGuestbookApplicationDuringUpgrade(f, sem)
testDaemonSetDuringUpgrade(f, sem)
testJobsDuringUpgrade(f, sem)
})
cm.Do()
})
Expand Down Expand Up @@ -253,200 +228,3 @@ func checkNodesVersions(cs clientset.Interface, want string) error {
}
return nil
}

func testSecretsBeforeAndAfterUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testSecrets(f, sem, false)
}

func testSecretsDuringUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testSecrets(f, sem, true)
}

func testSecrets(f *framework.Framework, sem *chaosmonkey.Semaphore, testDuringDisruption bool) {
// Setup
pod, expectedOutput := common.DoSecretE2EMultipleVolumesSetup(f)

// Validate
By("consume secret before upgrade")
common.DoSecretE2EMultipleVolumesValidate(f, pod, expectedOutput)

sem.Ready()

if testDuringDisruption {
// Continuously validate
wait.Until(func() {
By("consume secret during upgrade")
common.DoSecretE2EMultipleVolumesValidate(f, pod, expectedOutput)
}, framework.Poll, sem.StopCh)
} else {
// Block until chaosmonkey is done
By("waiting for upgrade to finish without consuming secrets")
<-sem.StopCh
}

// Validate after upgrade
By("consume secret after upgrade")
common.DoSecretE2EMultipleVolumesValidate(f, pod, expectedOutput)

// Teardown
}

func testConfigMapsBeforeAndAfterUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testConfigMaps(f, sem, false)
}

func testConfigMapsDuringUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testConfigMaps(f, sem, true)
}

func testConfigMaps(f *framework.Framework, sem *chaosmonkey.Semaphore, testDuringDisruption bool) {
// Setup
pod, expectedOutput := common.DoConfigMapE2EWithoutMappingsSetup(f, 0, 0, nil)

// Validate
By("consume config-maps before upgrade")
common.DoConfigMapE2EWithoutMappingsValidate(f, pod, expectedOutput)

sem.Ready()

if testDuringDisruption {
// Continuously validate
wait.Until(func() {
By("consume config-maps during upgrade")
common.DoConfigMapE2EWithoutMappingsValidate(f, pod, expectedOutput)
}, framework.Poll, sem.StopCh)
} else {
// Block until chaosmonkey is done
By("waiting for upgrade to finish without consuming config-maps")
<-sem.StopCh
}

// Validate after upgrade
By("consume config-maps after upgrade")
common.DoConfigMapE2EWithoutMappingsValidate(f, pod, expectedOutput)

// Teardown
}

func testGuestbookApplicationBeforeAndAfterUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testGuestbookApplication(f, sem, false)
}

func testGuestbookApplicationDuringUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testGuestbookApplication(f, sem, true)
}

func testGuestbookApplication(f *framework.Framework, sem *chaosmonkey.Semaphore, testDuringDisruption bool) {
// Setup
By("setup guestbook app")
GuestbookApplicationSetup(f.ClientSet, f.Namespace.Name)

// Validate
By("validate guestbook app before upgrade")
GuestbookApplicationValidate(f.ClientSet, f.Namespace.Name)

sem.Ready()

if testDuringDisruption {
// Continuously validate
wait.Until(func() {
By("validate guestbook app during upgrade")
GuestbookApplicationValidate(f.ClientSet, f.Namespace.Name)
}, framework.Poll, sem.StopCh)
} else {
// Block until chaosmonkey is done
By("waiting for upgrade to finish without validating guestbook app")
<-sem.StopCh
}

// Validate after upgrade
By("validate guestbook app after upgrade")
GuestbookApplicationValidate(f.ClientSet, f.Namespace.Name)

// Teardown
By("teardown guestbook app")
GuestbookApplicationTeardown(f.ClientSet, f.Namespace.Name)
}

func testDaemonSetBeforeAndAfterUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testDaemonSet(f, sem, false)
}

func testDaemonSetDuringUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testDaemonSet(f, sem, true)
}

func testDaemonSet(f *framework.Framework, sem *chaosmonkey.Semaphore, testDuringDisruption bool) {
image := "gcr.io/google_containers/serve_hostname:v1.4"
dsName := "daemon-set"
// Setup
By("setup daemonset")
complexLabel, nodeSelector := TestDaemonSetWithNodeAffinitySetup(f, dsName, image)

// Validate
By("validate daemonset before upgrade")
TestDaemonSetWithNodeAffinityValidate(f, dsName, complexLabel, nodeSelector)

sem.Ready()

if testDuringDisruption {
// Continuously validate
wait.Until(func() {
By("validate daemonset during upgrade")
TestDaemonSetWithNodeAffinityValidate(f, dsName, complexLabel, nodeSelector)
}, framework.Poll, sem.StopCh)
} else {
// Block until chaosmonkey is done
By("waiting for upgrade to finish without validating daemonset")
<-sem.StopCh
}

// Validate after upgrade
By("validate daemonset after upgrade")
TestDaemonSetWithNodeAffinityValidate(f, dsName, complexLabel, nodeSelector)

// Teardown
By("teardown daemonset")
TestDaemonSetWithNodeAffinityTeardown(f, dsName)
}

func testJobsBeforeAndAfterUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testJobs(f, sem, false)
}

func testJobsDuringUpgrade(f *framework.Framework, sem *chaosmonkey.Semaphore) {
testJobs(f, sem, true)
}

func testJobs(f *framework.Framework, sem *chaosmonkey.Semaphore, testDuringDisruption bool) {
parallelism := int32(2)
completions := int32(4)

// Setup
By("setup job")
job := TestJobsSetup(f, "randomlySucceedOrFail", "rand-non-local", api.RestartPolicyNever, parallelism, completions)
// Validate
By("validate job before upgrade")
TestJobsValidate(f, job, completions)

sem.Ready()

if testDuringDisruption {
// Continuously validate
wait.Until(func() {
By("validate job during upgrade")
TestJobsValidate(f, job, completions)
}, framework.Poll, sem.StopCh)
} else {
// Block until chaosmonkey is done
By("waiting for upgrade to finish without validating job")
<-sem.StopCh
}

// Validate after upgrade
By("validate job after upgrade")
TestJobsValidate(f, job, completions)

// Teardown
TestJobsTeardown(f, job)
}
11 changes: 1 addition & 10 deletions test/e2e/common/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func newConfigMap(f *framework.Framework, name string) *api.ConfigMap {
}
}

func DoConfigMapE2EWithoutMappingsSetup(f *framework.Framework, uid, fsGroup int64, defaultMode *int32) (*api.Pod, []string) {
func doConfigMapE2EWithoutMappings(f *framework.Framework, uid, fsGroup int64, defaultMode *int32) {
var (
name = "configmap-test-volume-" + string(uuid.NewUUID())
volumeName = "configmap-volume"
Expand Down Expand Up @@ -352,17 +352,8 @@ func DoConfigMapE2EWithoutMappingsSetup(f *framework.Framework, uid, fsGroup int
modeString := fmt.Sprintf("%v", os.FileMode(*defaultMode))
output = append(output, "mode of file \"/etc/configmap-volume/data-1\": "+modeString)
}

return pod, output
}

func DoConfigMapE2EWithoutMappingsValidate(f *framework.Framework, pod *api.Pod, output []string) {
f.TestContainerOutput("consume configMaps", pod, 0, output)
}

func doConfigMapE2EWithoutMappings(f *framework.Framework, uid, fsGroup int64, defaultMode *int32) {
pod, output := DoConfigMapE2EWithoutMappingsSetup(f, uid, fsGroup, defaultMode)
DoConfigMapE2EWithoutMappingsValidate(f, pod, output)
}

func doConfigMapE2EWithMappings(f *framework.Framework, uid, fsGroup int64, itemMode *int32) {
Expand Down
Loading

0 comments on commit 076051b

Please sign in to comment.