mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 22:05:59 +00:00
Add status check in PetSet e2e tests
This commit is contained in:
parent
3933ddbc9a
commit
1c0e0e93b0
@ -153,6 +153,8 @@ var _ = framework.KubeDescribe("PetSet [Slow] [Feature:PetSet]", func() {
|
|||||||
By("Waiting for pet at index 1 to enter running.")
|
By("Waiting for pet at index 1 to enter running.")
|
||||||
pst.waitForRunning(2, ps)
|
pst.waitForRunning(2, ps)
|
||||||
|
|
||||||
|
// TODO: verify petset status.replicas
|
||||||
|
|
||||||
// Now we have 1 healthy and 1 unhealthy pet. Deleting the healthy pet should *not*
|
// Now we have 1 healthy and 1 unhealthy pet. Deleting the healthy pet should *not*
|
||||||
// create a new pet till the remaining pet becomes healthy, which won't happen till
|
// create a new pet till the remaining pet becomes healthy, which won't happen till
|
||||||
// we set the healthy bit.
|
// we set the healthy bit.
|
||||||
@ -458,6 +460,8 @@ func (p *petSetTester) saturate(ps *apps.PetSet) {
|
|||||||
framework.Logf("Marking pet at index " + fmt.Sprintf("%v", i) + " healthy")
|
framework.Logf("Marking pet at index " + fmt.Sprintf("%v", i) + " healthy")
|
||||||
p.setHealthy(ps)
|
p.setHealthy(ps)
|
||||||
}
|
}
|
||||||
|
framework.Logf("Waiting for pet set status.replicas updated to %d", ps.Spec.Replicas)
|
||||||
|
p.waitForStatus(ps, ps.Spec.Replicas)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *petSetTester) deletePetAtIndex(index int, ps *apps.PetSet) {
|
func (p *petSetTester) deletePetAtIndex(index int, ps *apps.PetSet) {
|
||||||
@ -589,6 +593,25 @@ func (p *petSetTester) setHealthy(ps *apps.PetSet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *petSetTester) waitForStatus(ps *apps.PetSet, expectedReplicas int) {
|
||||||
|
ns, name := ps.Namespace, ps.Name
|
||||||
|
pollErr := wait.PollImmediate(petsetPoll, petsetTimeout,
|
||||||
|
func() (bool, error) {
|
||||||
|
psGet, err := p.c.Apps().PetSets(ns).Get(name)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if psGet.Status.Replicas != expectedReplicas {
|
||||||
|
framework.Logf("Waiting for pet set status to become %d, currently %d", expectedReplicas, ps.Status.Replicas)
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
})
|
||||||
|
if pollErr != nil {
|
||||||
|
framework.Failf("Failed waiting for pet set status.replicas updated to %d, got %d: %v", expectedReplicas, ps.Status.Replicas, pollErr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func deleteAllPetSets(c *client.Client, ns string) {
|
func deleteAllPetSets(c *client.Client, ns string) {
|
||||||
pst := &petSetTester{c: c}
|
pst := &petSetTester{c: c}
|
||||||
psList, err := c.Apps().PetSets(ns).List(api.ListOptions{LabelSelector: labels.Everything()})
|
psList, err := c.Apps().PetSets(ns).List(api.ListOptions{LabelSelector: labels.Everything()})
|
||||||
|
Loading…
Reference in New Issue
Block a user