Skip to content

Commit

Permalink
Revert flag changes & use hardcoded scheduler name
Browse files Browse the repository at this point in the history
  • Loading branch information
atwamahmoud committed Jan 10, 2024
1 parent 131fcdb commit f9388c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
16 changes: 3 additions & 13 deletions test/e2e/autoscaling/cluster_size_autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const (

gpuLabel = "cloud.google.com/gke-accelerator"

nonExistingBypassedSchedulerNameKey = "non-existing-bypassed-scheduler"
nonExistingBypassedSchedulerName = "non-existing-bypassed-scheduler"
)

var _ = SIGDescribe("Cluster size autoscaling", framework.WithSlow(), func() {
Expand Down Expand Up @@ -1004,15 +1004,10 @@ var _ = SIGDescribe("Cluster size autoscaling", framework.WithSlow(), func() {
})

f.It("should scale up when unprocessed pod is created and is going to be unschedulable", feature.ClusterScaleUpBypassScheduler, func(ctx context.Context) {
schedulerName, found := framework.TestContext.ExtraParams[nonExistingBypassedSchedulerNameKey]
if !found {
framework.Logf("Skipping test, Didn't find an ignored non-existent scheduler name to use")
return
}
// 70% of allocatable memory of a single node * replica count, forcing a scale up in case of normal pods
replicaCount := 2 * nodeCount
reservedMemory := int(float64(replicaCount) * float64(0.7) * float64(memAllocatableMb))
ginkgo.DeferCleanup(ReserveMemoryWithSchedulerName(ctx, f, "memory-reservation", replicaCount, reservedMemory, false, 1, schedulerName))
ginkgo.DeferCleanup(ReserveMemoryWithSchedulerName(ctx, f, "memory-reservation", replicaCount, reservedMemory, false, 1, nonExistingBypassedSchedulerName))
// Verify that cluster size is increased
ginkgo.By("Waiting for cluster scale-up")
sizeFunc := func(size int) bool {
Expand All @@ -1022,15 +1017,10 @@ var _ = SIGDescribe("Cluster size autoscaling", framework.WithSlow(), func() {
framework.ExpectNoError(WaitForClusterSizeFuncWithUnready(ctx, f.ClientSet, sizeFunc, scaleUpTimeout, 0))
})
f.It("shouldn't scale up when unprocessed pod is created and is going to be schedulable", feature.ClusterScaleUpBypassScheduler, func(ctx context.Context) {
schedulerName, found := framework.TestContext.ExtraParams[nonExistingBypassedSchedulerNameKey]
if !found {
framework.Logf("Skipping test, Didn't find an ignored non-existent scheduler name to use")
return
}
// 50% of allocatable memory of a single node, so that no scale up would trigger in normal cases
replicaCount := 1
reservedMemory := int(float64(0.5) * float64(memAllocatableMb))
ginkgo.DeferCleanup(ReserveMemoryWithSchedulerName(ctx, f, "memory-reservation", replicaCount, reservedMemory, false, 1, schedulerName))
ginkgo.DeferCleanup(ReserveMemoryWithSchedulerName(ctx, f, "memory-reservation", replicaCount, reservedMemory, false, 1, nonExistingBypassedSchedulerName))
// Verify that cluster size is the same
ginkgo.By(fmt.Sprintf("Waiting for scale up hoping it won't happen, sleep for %s", scaleUpTimeout.String()))
time.Sleep(scaleUpTimeout)
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ type TestContextType struct {

// Enable volume drivers which are disabled by default. See test/e2e/storage/in_tree_volumes.go for details.
EnabledVolumeDrivers []string

// Similar to NodeTextContextType.ExtraEnvs,
// ExtraParams is a map of extra parameter names to values.
ExtraParams map[string]string
}

// NodeKillerConfig describes configuration of NodeKiller -- a utility to
Expand Down Expand Up @@ -395,8 +391,6 @@ func RegisterCommonFlags(flags *flag.FlagSet) {
flags.IntVar(&TestContext.SnapshotControllerHTTPPort, "snapshot-controller-http-port", 0, "The port to use for snapshot controller HTTP communication.")

flags.Var(&stringArrayValue{&TestContext.EnabledVolumeDrivers}, "enabled-volume-drivers", "Comma-separated list of in-tree volume drivers to enable for testing. This is only needed for in-tree drivers disabled by default. An example is gcepd; see test/e2e/storage/in_tree_volumes.go for full details.")

flags.Var(cliflag.NewMapStringString(&TestContext.ExtraParams), "extra-params", "Extra parameters that might be needed for some e2e tests. Format: a list of key=value pairs, e.g., param1=val1,param2=val2")
}

func CreateGinkgoConfig() (types.SuiteConfig, types.ReporterConfig) {
Expand Down

0 comments on commit f9388c8

Please sign in to comment.