Skip to content

Commit

Permalink
Apply all pods at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Sep 19, 2022
1 parent 8fac2ce commit 7dfc148
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
8 changes: 4 additions & 4 deletions test/pkg/environment/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,13 @@ func (env *Environment) printControllerLogs(options *v1.PodLogOptions) {
}

func (env *Environment) EventuallyExpectMinUtilization(resource v1.ResourceName, comparator string, value float64) {
Eventually(func(g Gomega) {
EventuallyWithOffset(1, func(g Gomega) {
g.Expect(env.Monitor.MinUtilization(resource)).To(BeNumerically(comparator, value))
}).WithOffset(1).Should(Succeed())
}).Should(Succeed())
}

func (env *Environment) EventuallyExpectAvgUtilization(resource v1.ResourceName, comparator string, value float64) {
Eventually(func(g Gomega) {
EventuallyWithOffset(1, func(g Gomega) {
g.Expect(env.Monitor.AvgUtilization(resource)).To(BeNumerically(comparator, value))
}, 10*time.Minute).WithOffset(1).Should(Succeed())
}, 10*time.Minute).Should(Succeed())
}
14 changes: 5 additions & 9 deletions test/suites/integration/kubelet_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/samber/lo"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/sets"
"knative.dev/pkg/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/aws/karpenter/pkg/apis/awsnodetemplate/v1alpha1"
"github.com/aws/karpenter/pkg/apis/provisioning/v1alpha5"
Expand Down Expand Up @@ -58,9 +60,7 @@ var _ = Describe("KubeletConfiguration Overrides", func() {

pods := []*v1.Pod{test.Pod(), test.Pod(), test.Pod()}
env.ExpectCreated(provisioner, provider)
for _, pod := range pods {
env.ExpectCreated(pod)
}
env.ExpectCreated(lo.Map(pods, func(p *v1.Pod, _ int) client.Object { return p })...)
env.EventuallyExpectHealthy(pods...)
env.ExpectCreatedNodeCount("==", 3)

Expand Down Expand Up @@ -108,9 +108,7 @@ var _ = Describe("KubeletConfiguration Overrides", func() {

pods := []*v1.Pod{test.Pod(), test.Pod(), test.Pod(), test.Pod()}
env.ExpectCreated(provisioner, provider)
for _, pod := range pods {
env.ExpectCreated(pod)
}
env.ExpectCreated(lo.Map(pods, func(p *v1.Pod, _ int) client.Object { return p })...)
env.EventuallyExpectHealthy(pods...)
env.ExpectCreatedNodeCount("==", 2)

Expand Down Expand Up @@ -144,9 +142,7 @@ var _ = Describe("KubeletConfiguration Overrides", func() {

pods := []*v1.Pod{test.Pod(), test.Pod(), test.Pod(), test.Pod(), test.Pod(), test.Pod()}
env.ExpectCreated(provisioner, provider)
for _, pod := range pods {
env.ExpectCreated(pod)
}
env.ExpectCreated(lo.Map(pods, func(p *v1.Pod, _ int) client.Object { return p })...)
env.EventuallyExpectHealthy(pods...)
env.ExpectCreatedNodeCount("==", 1)
})
Expand Down

0 comments on commit 7dfc148

Please sign in to comment.