Skip to content

Commit

Permalink
test: fix some scale test bugs (#4955)
Browse files Browse the repository at this point in the history
  • Loading branch information
njtran authored Oct 30, 2023
1 parent 7c989a2 commit 5d648a1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/pkg/environment/aws/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (env *Environment) ExpectMessagesCreated(msgs ...interface{}) {
go func(m interface{}) {
defer wg.Done()
defer GinkgoRecover()
_, e := env.SQSProvider.SendMessage(env.Environment.Context, m)
_, e := env.SQSProvider.SendMessage(env.Context, m)
if e != nil {
mu.Lock()
err = multierr.Append(err, e)
Expand Down
2 changes: 1 addition & 1 deletion test/pkg/environment/common/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func (env *Environment) EventuallyExpectInitializedNodeCount(comparator string,
Eventually(func(g Gomega) {
nodes = env.Monitor.CreatedNodes()
nodes = lo.Filter(nodes, func(n *v1.Node, _ int) bool {
return n.Labels[v1alpha5.LabelNodeInitialized] == "true"
return n.Labels[corev1beta1.NodeInitializedLabelKey] == "true"
})
g.Expect(len(nodes)).To(BeNumerically(comparator, count))
}).Should(Succeed())
Expand Down
4 changes: 4 additions & 0 deletions test/suites/alpha/scale/deprovisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/aws/karpenter/pkg/apis/v1alpha1"
"github.com/aws/karpenter/pkg/controllers/interruption/messages"
"github.com/aws/karpenter/pkg/controllers/interruption/messages/scheduledchange"
"github.com/aws/karpenter/pkg/operator/options"
awstest "github.com/aws/karpenter/pkg/test"
"github.com/aws/karpenter/pkg/utils"
"github.com/aws/karpenter/test/pkg/debug"
Expand Down Expand Up @@ -687,6 +688,9 @@ var _ = Describe("Deprovisioning", Label(debug.NoWatch), Label(debug.NoEvents),
})
Context("Interruption", func() {
It("should interrupt all nodes due to scheduledChange", func(_ context.Context) {
env.Context = options.ToContext(env.Context, awstest.Options(awstest.OptionsFields{
InterruptionQueue: lo.ToPtr(env.InterruptionQueue),
}))
env.ExpectQueueExists() // Ensure the queue exists before sending messages

replicasPerNode := 20
Expand Down
4 changes: 4 additions & 0 deletions test/suites/beta/scale/deprovisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/aws/karpenter/pkg/apis/v1beta1"
"github.com/aws/karpenter/pkg/controllers/interruption/messages"
"github.com/aws/karpenter/pkg/controllers/interruption/messages/scheduledchange"
"github.com/aws/karpenter/pkg/operator/options"
awstest "github.com/aws/karpenter/pkg/test"
"github.com/aws/karpenter/pkg/utils"
"github.com/aws/karpenter/test/pkg/debug"
Expand Down Expand Up @@ -666,6 +667,9 @@ var _ = Describe("Deprovisioning", Label(debug.NoWatch), Label(debug.NoEvents),
})
Context("Interruption", func() {
It("should interrupt all nodes due to scheduledChange", func(_ context.Context) {
env.Context = options.ToContext(env.Context, awstest.Options(awstest.OptionsFields{
InterruptionQueue: lo.ToPtr(env.InterruptionQueue),
}))
env.ExpectQueueExists() // Ensure the queue exists before sending messages

replicasPerNode := 20
Expand Down

0 comments on commit 5d648a1

Please sign in to comment.