Skip to content

Commit

Permalink
e2e test: export appLabel into a func
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Duarte Barroso <[email protected]>
  • Loading branch information
maiqueb committed May 16, 2023
1 parent faec47a commit 460671e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ var _ = Describe("Multus dynamic networks controller", func() {

It("can be hot unplugged from a running pod", func() {
const ifaceToRemove = ifaceToAddWithIPAM
pods, err := clients.ListPods(namespace, fmt.Sprintf("app=%s", podName))
pods, err := clients.ListPods(namespace, appLabel(podName))
Expect(err).NotTo(HaveOccurred())
pod = &pods.Items[0]

Expand Down Expand Up @@ -270,7 +270,7 @@ var _ = Describe("Multus dynamic networks controller", func() {
})

runningPod := func() *corev1.Pod {
pods, err := clients.ListPods(namespace, fmt.Sprintf("app=%s", podName))
pods, err := clients.ListPods(namespace, appLabel(podName))
ExpectWithOffset(1, err).NotTo(HaveOccurred())
ExpectWithOffset(1, pods.Items).NotTo(BeEmpty())
return &pods.Items[0]
Expand Down Expand Up @@ -419,3 +419,7 @@ func lowerDeviceName() string {
}
return defaultLowerDeviceIfaceName
}

func appLabel(appName string) string {
return fmt.Sprintf("app=%s", appName)
}

0 comments on commit 460671e

Please sign in to comment.