Skip to content

Commit

Permalink
tests: rework custom calls's AfterEach/AfterAll blocks to skip if needed
Browse files Browse the repository at this point in the history
The AfterAll() and AfterEach() blocks in the test file for custom calls
run everytime, even if the Context block for the actual tests is
skipped. In that case, running the final blocks results in an attempt to
remove deployments that have never been set up in the first place. This
may lead to the blocks failing when the tests were in fact skipped, and
may produce test artifacts even though Jenkins does not considered the
test failed.

Let's reorganise those blocks, to make sure they are called only when
necessary. Note that we do need to keep both DeleteCilium() and
DeleteAll(), even if they are now in the same block, as calling only
DeleteAll() would not remove the Cilium ConfigMap.

Fixes: 37f6192 ("test: add CI test for tail calls hooks for custom programs")
Fixes: cilium#13191
Fixes: cilium#16633

Reported-by: Paul Chaignon <paul@cilium.io>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
  • Loading branch information
qmonnet authored and aanm committed Jun 28, 2021
1 parent d1a3b70 commit 9d4e99d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/k8sT/CustomCalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,11 @@ var _ = Describe("K8sCustomCalls", func() {
deploymentManager.SetKubectl(kubectl)
})

AfterEach(func() {
deploymentManager.DeleteAll()
})

AfterFailed(func() {
kubectl.CiliumReport("cilium status", "cilium endpoint list")
})

AfterAll(func() {
deploymentManager.DeleteCilium()
kubectl.CloseSSHClient()
})

Expand Down Expand Up @@ -115,6 +110,11 @@ var _ = Describe("K8sCustomCalls", func() {
ExpectAllPodsTerminated(kubectl)
})

AfterAll(func() {
deploymentManager.DeleteCilium()
deploymentManager.DeleteAll()
})

installPods := func() {
// Initialize all paths. This cannot be done at
// variable declaration because kubectl is not set when
Expand Down

0 comments on commit 9d4e99d

Please sign in to comment.