mirror of https://github.com/k3s-io/k3s
Merge pull request #26714 from jszczepkowski/kac-event-test
Automatic merge from submit-queue Improved check in shouldn't increase cluster size e2e test. [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]() Improved check in shouldn't increase cluster size e2e test.pull/6/head
commit
8ba9bd3dcb
|
@ -86,11 +86,29 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
|
||||||
|
|
||||||
It("shouldn't increase cluster size if pending pod it too large [Feature:ClusterSizeAutoscalingScaleUp]", func() {
|
It("shouldn't increase cluster size if pending pod it too large [Feature:ClusterSizeAutoscalingScaleUp]", func() {
|
||||||
ReserveMemory(f, "memory-reservation", 1, memCapacityMb, false)
|
ReserveMemory(f, "memory-reservation", 1, memCapacityMb, false)
|
||||||
// Verify, that cluster size is not changed.
|
|
||||||
// TODO: find a better way of verification that the cluster size will remain unchanged using events.
|
|
||||||
time.Sleep(scaleUpTimeout)
|
time.Sleep(scaleUpTimeout)
|
||||||
|
|
||||||
|
// Verfiy, that the appropreate event was generated.
|
||||||
|
eventFound := false
|
||||||
|
EventsLoop:
|
||||||
|
for start := time.Now(); time.Since(start) < scaleUpTimeout; time.Sleep(20 * time.Second) {
|
||||||
|
By("Waiting for NotTriggerScaleUp event")
|
||||||
|
events, err := f.Client.Events(f.Namespace.Name).List(api.ListOptions{})
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
|
for _, e := range events.Items {
|
||||||
|
if e.InvolvedObject.Kind == "Pod" && e.Reason == "NotTriggerScaleUp" && strings.Contains(e.Message, "it wouldn't fit if a new node is added") {
|
||||||
|
By("NotTriggerScaleUp event found")
|
||||||
|
eventFound = true
|
||||||
|
break EventsLoop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Expect(eventFound).Should(Equal(true))
|
||||||
|
// Verify, that cluster size is not changed.
|
||||||
framework.ExpectNoError(WaitForClusterSizeFunc(f.Client,
|
framework.ExpectNoError(WaitForClusterSizeFunc(f.Client,
|
||||||
func(size int) bool { return size <= nodeCount }, scaleDownTimeout))
|
func(size int) bool { return size <= nodeCount }, scaleDownTimeout))
|
||||||
|
|
||||||
framework.ExpectNoError(framework.DeleteRC(f.Client, f.Namespace.Name, "memory-reservation"))
|
framework.ExpectNoError(framework.DeleteRC(f.Client, f.Namespace.Name, "memory-reservation"))
|
||||||
framework.ExpectNoError(WaitForClusterSizeFunc(f.Client,
|
framework.ExpectNoError(WaitForClusterSizeFunc(f.Client,
|
||||||
func(size int) bool { return size <= nodeCount }, scaleDownTimeout))
|
func(size int) bool { return size <= nodeCount }, scaleDownTimeout))
|
||||||
|
|
Loading…
Reference in New Issue