mirror of https://github.com/k3s-io/k3s
Add ConfigMaps to k8s upgrade tests
parent
7380c1fe76
commit
4bbd40441f
|
@ -49,6 +49,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||
// Close over f.
|
||||
testServiceRemainsUp(f, sem)
|
||||
testSecretsDuringUpgrade(f, sem)
|
||||
testConfigMapsDuringUpgrade(f, sem)
|
||||
})
|
||||
cm.Do()
|
||||
})
|
||||
|
@ -66,6 +67,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||
// Close over f.
|
||||
testServiceUpBeforeAndAfter(f, sem)
|
||||
testSecretsBeforeAndAfterUpgrade(f, sem)
|
||||
testConfigMapsBeforeAndAfterUpgrade(f, sem)
|
||||
})
|
||||
cm.Do()
|
||||
})
|
||||
|
@ -81,6 +83,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||
// Close over f.
|
||||
testServiceRemainsUp(f, sem)
|
||||
testSecretsDuringUpgrade(f, sem)
|
||||
testConfigMapsDuringUpgrade(f, sem)
|
||||
})
|
||||
cm.Do()
|
||||
})
|
||||
|
@ -100,6 +103,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||
// Close over f.
|
||||
testServiceUpBeforeAndAfter(f, sem)
|
||||
testSecretsBeforeAndAfterUpgrade(f, sem)
|
||||
testConfigMapsBeforeAndAfterUpgrade(f, sem)
|
||||
})
|
||||
cm.Do()
|
||||
})
|
||||
|
@ -117,6 +121,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||
// Close over f.
|
||||
testServiceRemainsUp(f, sem)
|
||||
testSecretsDuringUpgrade(f, sem)
|
||||
testConfigMapsDuringUpgrade(f, sem)
|
||||
})
|
||||
cm.Do()
|
||||
})
|
||||
|
@ -270,3 +275,40 @@ func testSecrets(f *framework.Framework, sem *chaosmonkey.Semaphore, testDuringD
|
|||
|
||||
// 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
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ func newConfigMap(f *framework.Framework, name string) *api.ConfigMap {
|
|||
}
|
||||
}
|
||||
|
||||
func doConfigMapE2EWithoutMappings(f *framework.Framework, uid, fsGroup int64, defaultMode *int32) {
|
||||
func DoConfigMapE2EWithoutMappingsSetup(f *framework.Framework, uid, fsGroup int64, defaultMode *int32) (*api.Pod, []string) {
|
||||
var (
|
||||
name = "configmap-test-volume-" + string(uuid.NewUUID())
|
||||
volumeName = "configmap-volume"
|
||||
|
@ -352,8 +352,17 @@ func doConfigMapE2EWithoutMappings(f *framework.Framework, uid, fsGroup int64, d
|
|||
modeString := fmt.Sprintf("%v", os.FileMode(*defaultMode))
|
||||
output = append(output, "mode of file \"/etc/configmap-volume/data-1\": "+modeString)
|
||||
}
|
||||
f.TestContainerOutput("consume configMaps", pod, 0, output)
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue