mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
Merge pull request #124668 from bart0sh/PR143-e2e-node-fix-containers-lifecycle
node_e2e: refactor RunTogether function
This commit is contained in:
commit
65f8129e51
@ -122,23 +122,30 @@ func (o containerOutputList) String() string {
|
|||||||
// RunTogether returns an error the lhs and rhs run together
|
// RunTogether returns an error the lhs and rhs run together
|
||||||
func (o containerOutputList) RunTogether(lhs, rhs string) error {
|
func (o containerOutputList) RunTogether(lhs, rhs string) error {
|
||||||
lhsStart := o.findIndex(lhs, "Started", 0)
|
lhsStart := o.findIndex(lhs, "Started", 0)
|
||||||
rhsStart := o.findIndex(rhs, "Started", 0)
|
|
||||||
|
|
||||||
lhsFinish := o.findIndex(lhs, "Exiting", 0)
|
|
||||||
rhsFinish := o.findIndex(rhs, "Exiting", 0)
|
|
||||||
|
|
||||||
if lhsStart == -1 {
|
if lhsStart == -1 {
|
||||||
return fmt.Errorf("couldn't find that %s ever started, got\n%v", lhs, o)
|
return fmt.Errorf("couldn't find that %s ever started, got\n%v", lhs, o)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rhsStart := o.findIndex(rhs, "Started", lhsStart+1)
|
||||||
if rhsStart == -1 {
|
if rhsStart == -1 {
|
||||||
return fmt.Errorf("couldn't find that %s ever started, got\n%v", rhs, o)
|
return fmt.Errorf("couldn't find that %s ever started, got\n%v", rhs, o)
|
||||||
}
|
}
|
||||||
|
|
||||||
if lhsFinish != -1 && rhsStart > lhsFinish {
|
lhsExit := o.findIndex(lhs, "Exiting", lhsStart+1)
|
||||||
|
if lhsExit == -1 {
|
||||||
|
return fmt.Errorf("couldn't find that %s ever exited, got\n%v", lhs, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
if rhsStart > lhsExit {
|
||||||
return fmt.Errorf("expected %s to start before exiting %s, got\n%v", rhs, lhs, o)
|
return fmt.Errorf("expected %s to start before exiting %s, got\n%v", rhs, lhs, o)
|
||||||
}
|
}
|
||||||
|
|
||||||
if rhsFinish != -1 && lhsStart > rhsFinish {
|
rhsExit := o.findIndex(rhs, "Exiting", rhsStart+1)
|
||||||
|
if rhsExit == -1 {
|
||||||
|
return fmt.Errorf("couldn't find that %s ever exited, got\n%v", rhs, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
if lhsStart > rhsExit {
|
||||||
return fmt.Errorf("expected %s to start before exiting %s, got\n%v", lhs, rhs, o)
|
return fmt.Errorf("expected %s to start before exiting %s, got\n%v", lhs, rhs, o)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,7 +1006,7 @@ var _ = SIGDescribe(nodefeature.SidecarContainers, "Containers Lifecycle", func(
|
|||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should run both restartable init containers and third init container together", func() {
|
ginkgo.It("should run both restartable init containers and third init container together", func() {
|
||||||
framework.ExpectNoError(results.RunTogether(restartableInit2, restartableInit1))
|
framework.ExpectNoError(results.RunTogether(restartableInit1, restartableInit2))
|
||||||
framework.ExpectNoError(results.RunTogether(restartableInit1, init3))
|
framework.ExpectNoError(results.RunTogether(restartableInit1, init3))
|
||||||
framework.ExpectNoError(results.RunTogether(restartableInit2, init3))
|
framework.ExpectNoError(results.RunTogether(restartableInit2, init3))
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user