mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Add ConfigMaps to k8s upgrade tests
This commit is contained in:
parent
7380c1fe76
commit
4bbd40441f
@ -49,6 +49,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||||||
// Close over f.
|
// Close over f.
|
||||||
testServiceRemainsUp(f, sem)
|
testServiceRemainsUp(f, sem)
|
||||||
testSecretsDuringUpgrade(f, sem)
|
testSecretsDuringUpgrade(f, sem)
|
||||||
|
testConfigMapsDuringUpgrade(f, sem)
|
||||||
})
|
})
|
||||||
cm.Do()
|
cm.Do()
|
||||||
})
|
})
|
||||||
@ -66,6 +67,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||||||
// Close over f.
|
// Close over f.
|
||||||
testServiceUpBeforeAndAfter(f, sem)
|
testServiceUpBeforeAndAfter(f, sem)
|
||||||
testSecretsBeforeAndAfterUpgrade(f, sem)
|
testSecretsBeforeAndAfterUpgrade(f, sem)
|
||||||
|
testConfigMapsBeforeAndAfterUpgrade(f, sem)
|
||||||
})
|
})
|
||||||
cm.Do()
|
cm.Do()
|
||||||
})
|
})
|
||||||
@ -81,6 +83,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||||||
// Close over f.
|
// Close over f.
|
||||||
testServiceRemainsUp(f, sem)
|
testServiceRemainsUp(f, sem)
|
||||||
testSecretsDuringUpgrade(f, sem)
|
testSecretsDuringUpgrade(f, sem)
|
||||||
|
testConfigMapsDuringUpgrade(f, sem)
|
||||||
})
|
})
|
||||||
cm.Do()
|
cm.Do()
|
||||||
})
|
})
|
||||||
@ -100,6 +103,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||||||
// Close over f.
|
// Close over f.
|
||||||
testServiceUpBeforeAndAfter(f, sem)
|
testServiceUpBeforeAndAfter(f, sem)
|
||||||
testSecretsBeforeAndAfterUpgrade(f, sem)
|
testSecretsBeforeAndAfterUpgrade(f, sem)
|
||||||
|
testConfigMapsBeforeAndAfterUpgrade(f, sem)
|
||||||
})
|
})
|
||||||
cm.Do()
|
cm.Do()
|
||||||
})
|
})
|
||||||
@ -117,6 +121,7 @@ var _ = framework.KubeDescribe("Upgrade [Feature:Upgrade]", func() {
|
|||||||
// Close over f.
|
// Close over f.
|
||||||
testServiceRemainsUp(f, sem)
|
testServiceRemainsUp(f, sem)
|
||||||
testSecretsDuringUpgrade(f, sem)
|
testSecretsDuringUpgrade(f, sem)
|
||||||
|
testConfigMapsDuringUpgrade(f, sem)
|
||||||
})
|
})
|
||||||
cm.Do()
|
cm.Do()
|
||||||
})
|
})
|
||||||
@ -270,3 +275,40 @@ func testSecrets(f *framework.Framework, sem *chaosmonkey.Semaphore, testDuringD
|
|||||||
|
|
||||||
// Teardown
|
// 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 (
|
var (
|
||||||
name = "configmap-test-volume-" + string(uuid.NewUUID())
|
name = "configmap-test-volume-" + string(uuid.NewUUID())
|
||||||
volumeName = "configmap-volume"
|
volumeName = "configmap-volume"
|
||||||
@ -352,8 +352,17 @@ func doConfigMapE2EWithoutMappings(f *framework.Framework, uid, fsGroup int64, d
|
|||||||
modeString := fmt.Sprintf("%v", os.FileMode(*defaultMode))
|
modeString := fmt.Sprintf("%v", os.FileMode(*defaultMode))
|
||||||
output = append(output, "mode of file \"/etc/configmap-volume/data-1\": "+modeString)
|
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) {
|
func doConfigMapE2EWithMappings(f *framework.Framework, uid, fsGroup int64, itemMode *int32) {
|
||||||
|
Loading…
Reference in New Issue
Block a user