Skip some disruption e2e test in big clusters

This commit is contained in:
Marcin Wielgus 2016-12-01 14:00:03 +01:00
parent 737edd02a4
commit cf92f1cdba
2 changed files with 19 additions and 6 deletions

View File

@ -36,6 +36,7 @@ import (
// awhile to guarantee that we've been patient waiting for something ordinary
// to happen: a pod to get scheduled and move into Ready
const schedulingTimeout = 10 * time.Minute
const bigClusterSize = 7
var _ = framework.KubeDescribe("DisruptionController", func() {
f := framework.NewDefaultFramework("disruption")
@ -71,12 +72,13 @@ var _ = framework.KubeDescribe("DisruptionController", func() {
})
evictionCases := []struct {
description string
minAvailable intstr.IntOrString
podCount int
replicaSetSize int32
shouldDeny bool
exclusive bool
description string
minAvailable intstr.IntOrString
podCount int
replicaSetSize int32
shouldDeny bool
exclusive bool
skipForBigClusters bool
}{
{
description: "no PDB",
@ -105,6 +107,8 @@ var _ = framework.KubeDescribe("DisruptionController", func() {
replicaSetSize: 10,
exclusive: true,
shouldDeny: true,
// This tests assumes that there is less than replicaSetSize nodes in the cluster.
skipForBigClusters: true,
},
}
for i := range evictionCases {
@ -114,6 +118,9 @@ var _ = framework.KubeDescribe("DisruptionController", func() {
expectation = "should not allow an eviction"
}
It(fmt.Sprintf("evictions: %s => %s", c.description, expectation), func() {
if c.skipForBigClusters {
framework.SkipUnlessNodeCountIsAtMost(bigClusterSize - 1)
}
createPodsOrDie(cs, ns, c.podCount)
if c.replicaSetSize > 0 {
createReplicaSetOrDie(cs, ns, c.replicaSetSize, c.exclusive)

View File

@ -295,6 +295,12 @@ func SkipUnlessNodeCountIsAtLeast(minNodeCount int) {
}
}
func SkipUnlessNodeCountIsAtMost(maxNodeCount int) {
if TestContext.CloudConfig.NumNodes <= maxNodeCount {
Skipf("Requires at most %d nodes (not %d)", maxNodeCount, TestContext.CloudConfig.NumNodes)
}
}
func SkipUnlessAtLeast(value int, minValue int, message string) {
if value < minValue {
Skipf(message)