topgun/k8s: update worklifecycle tests to be more succint
We had few places where `JustBeforeEach` could be replaced by performing the whole action in an `It` as there was no need for such segregation (having a single test). Signed-off-by: Ciro S. Costa <cscosta@pivotal.io>
This commit is contained in:
parent
101abf1e3d
commit
dab1fe054f
|
@ -65,6 +65,10 @@ var _ = Describe("Worker lifecycle", func() {
|
|||
return false
|
||||
}, 2*time.Minute, 10*time.Second).
|
||||
Should(BeTrue())
|
||||
|
||||
Run(nil, "kubectl", "scale", "--namespace", namespace,
|
||||
"statefulset", releaseName+"-worker", "--replicas=0",
|
||||
)
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -72,18 +76,13 @@ var _ = Describe("Worker lifecycle", func() {
|
|||
})
|
||||
|
||||
Context("terminating the worker", func() {
|
||||
JustBeforeEach(func() {
|
||||
Run(nil, "kubectl", "scale", "--namespace", namespace,
|
||||
"statefulset", releaseName+"-worker", "--replicas=0",
|
||||
)
|
||||
})
|
||||
|
||||
Context("gracefully", func() {
|
||||
BeforeEach(func() {
|
||||
gracePeriod = "600"
|
||||
})
|
||||
|
||||
JustBeforeEach(func() {
|
||||
It("finishes tasks gracefully with termination", func() {
|
||||
By("seeing that the worker state is retiring")
|
||||
Eventually(func() string {
|
||||
workers := fly.GetWorkers()
|
||||
|
@ -97,9 +96,7 @@ var _ = Describe("Worker lifecycle", func() {
|
|||
"--", "/bin/sh", "-ce",
|
||||
`touch /tmp/stop-waiting`,
|
||||
)
|
||||
})
|
||||
|
||||
It("finishes tasks gracefully with termination", func() {
|
||||
By("seeing that there are no workers")
|
||||
Eventually(func() []Worker {
|
||||
return getRunningWorkers(fly.GetWorkers())
|
||||
|
|
Loading…
Reference in New Issue