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