Merge pull request #125282 from matthyx/run2gether

ignore starting order in RunTogether, add another that does
This commit is contained in:
Kubernetes Prow Robot 2024-06-03 14:34:11 -07:00 committed by GitHub
commit 24b642afc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 10 deletions

View File

@ -119,8 +119,18 @@ func (o containerOutputList) String() string {
return b.String()
}
// RunTogether returns an error the lhs and rhs run together
// RunTogether returns an error if containers don't run together
func (o containerOutputList) RunTogether(lhs, rhs string) error {
if err := o.RunTogetherLhsFirst(lhs, rhs); err != nil {
if err := o.RunTogetherLhsFirst(rhs, lhs); err != nil {
return err
}
}
return nil
}
// RunTogetherLhsFirst returns an error if containers don't run together or if rhs starts before lhs
func (o containerOutputList) RunTogetherLhsFirst(lhs, rhs string) error {
lhsStart := o.findIndex(lhs, "Started", 0)
if lhsStart == -1 {
return fmt.Errorf("couldn't find that %s ever started, got\n%v", lhs, o)

View File

@ -834,9 +834,9 @@ var _ = SIGDescribe(framework.WithNodeConformance(), "Containers Lifecycle", fun
ginkgo.By("Analyzing results")
// readiness probes are called during pod termination
framework.ExpectNoError(results.RunTogether(prefixedName(PreStopPrefix, regular1), prefixedName(ReadinessPrefix, regular1)))
framework.ExpectNoError(results.RunTogetherLhsFirst(prefixedName(PreStopPrefix, regular1), prefixedName(ReadinessPrefix, regular1)))
// liveness probes are not called during pod termination
err = results.RunTogether(prefixedName(PreStopPrefix, regular1), prefixedName(LivenessPrefix, regular1))
err = results.RunTogetherLhsFirst(prefixedName(PreStopPrefix, regular1), prefixedName(LivenessPrefix, regular1))
gomega.Expect(err).To(gomega.HaveOccurred())
})
@ -897,11 +897,11 @@ var _ = SIGDescribe(framework.WithNodeConformance(), "Containers Lifecycle", fun
ginkgo.By("Analyzing results")
// FIXME ExpectNoError: this will be implemented in KEP 4438
// liveness probes are called for restartable init containers during pod termination
err = results.RunTogether(prefixedName(PreStopPrefix, regular1), prefixedName(LivenessPrefix, restartableInit1))
err = results.RunTogetherLhsFirst(prefixedName(PreStopPrefix, regular1), prefixedName(LivenessPrefix, restartableInit1))
gomega.Expect(err).To(gomega.HaveOccurred())
// FIXME ExpectNoError: this will be implemented in KEP 4438
// restartable init containers are restarted during pod termination
err = results.RunTogether(prefixedName(PreStopPrefix, regular1), restartableInit1)
err = results.RunTogetherLhsFirst(prefixedName(PreStopPrefix, regular1), restartableInit1)
gomega.Expect(err).To(gomega.HaveOccurred())
})
})
@ -1147,12 +1147,8 @@ var _ = SIGDescribe(nodefeature.SidecarContainers, "Containers Lifecycle", func(
framework.ExpectNoError(results.ExitsBefore(init1, restartableInit1))
})
ginkgo.It("should start first restartable init container before starting second init container", func() {
framework.ExpectNoError(results.StartsBefore(restartableInit1, init2))
})
ginkgo.It("should run first init container and first restartable init container together", func() {
framework.ExpectNoError(results.RunTogether(restartableInit1, init2))
framework.ExpectNoError(results.RunTogetherLhsFirst(restartableInit1, init2))
})
ginkgo.It("should run second init container to completion before starting second restartable init container", func() {