Skip to content

Commit

Permalink
fix: simplify e2e for webhooks (#7229)
Browse files Browse the repository at this point in the history
  • Loading branch information
rschalo authored Oct 15, 2024
1 parent e0f0072 commit aa62ff0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions test/suites/webhooks/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ import (

karptest "sigs.k8s.io/karpenter/pkg/test"

"github.com/aws/karpenter-provider-aws/pkg/test"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "sigs.k8s.io/karpenter/pkg/test/expectations"
. "sigs.k8s.io/karpenter/pkg/utils/testing"
)

Expand All @@ -38,7 +35,7 @@ var env *aws.Environment
var nodeClass *v1beta1.EC2NodeClass
var nodePool *karpv1beta1.NodePool

func TestWebhook(t *testing.T) {
func TestWebhooks(t *testing.T) {
RegisterFailHandler(Fail)

ctx = TestContextWithLogger(t)
Expand All @@ -48,21 +45,22 @@ func TestWebhook(t *testing.T) {
AfterSuite(func() {
env.Stop()
})
RunSpecs(t, "Webhook")
RunSpecs(t, "Webhooks")
}

var _ = BeforeEach(func() {
env.BeforeEach()
nodeClass = env.DefaultEC2NodeClass()
nodePool = env.DefaultNodePool(nodeClass)
})
var _ = AfterEach(func() { env.Cleanup() })
var _ = AfterEach(func() { env.AfterEach() })

var _ = Describe("Webhook", func() {
var _ = Describe("Webhooks", func() {
It("should schedule pods when webhooks are disabled", func() {
nodeClass := test.EC2NodeClass()
env.ExpectCreated(nodeClass, nodePool)
ExpectApplied(ctx, env.Client, nodePool, nodeClass)
pod := karptest.UnschedulablePod()
ExpectScheduled(ctx, env.Client, pod)
pod := karptest.Pod()
env.ExpectCreated(pod, nodeClass, nodePool)
env.EventuallyExpectHealthy(pod)
env.ExpectCreatedNodeCount("==", 1)
})
})

0 comments on commit aa62ff0

Please sign in to comment.