Skip to content

Commit dc7b340

Browse files
committed
e2e: fpga: make sure previous plugin is fully removed
Signed-off-by: Tuomas Katila <[email protected]>
1 parent 50617a0 commit dc7b340

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/e2e/fpga/fpga.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"os"
2222
"path/filepath"
23+
"strings"
2324
"time"
2425

2526
"github.com/intel/intel-device-plugins-for-kubernetes/test/e2e/utils"
@@ -64,6 +65,34 @@ func describe() {
6465
fmw := framework.NewDefaultFramework("fpgaplugin-e2e")
6566
fmw.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
6667

68+
ginkgo.AfterEach(func(ctx context.Context) {
69+
ginkgo.By("undeploying fpga daemonset and mapping")
70+
71+
e2ekubectl.RunKubectlOrDie(fmw.Namespace.Name, "delete", "-f", mappingsCollectionPath)
72+
73+
pods, err := e2epod.GetPodsInNamespace(ctx, fmw.ClientSet, fmw.Namespace.Name, nil)
74+
if err != nil {
75+
framework.Failf("Failed to list pods in namespace: %+v", err)
76+
}
77+
78+
dpPodName := ""
79+
80+
for _, pod := range pods {
81+
if strings.HasPrefix(pod.Name, "intel-fpga-plugin") {
82+
dpPodName = pod.Name
83+
break
84+
}
85+
}
86+
87+
e2ekubectl.RunKubectlOrDie(fmw.Namespace.Name, "delete", "-k", filepath.Dir(pluginKustomizationPath))
88+
89+
if dpPodName != "" {
90+
if err := e2epod.WaitForPodNotFoundInNamespace(ctx, fmw.ClientSet, dpPodName, fmw.Namespace.Name, 30*time.Second); err != nil {
91+
framework.Failf("failed to terminate pod: %v", err)
92+
}
93+
}
94+
})
95+
6796
ginkgo.Context("When FPGA plugin is running in region mode [Mode:region]", func() {
6897
ginkgo.BeforeEach(func(ctx context.Context) {
6998
runDevicePlugin(ctx, fmw, pluginKustomizationPath, mappingsCollectionPath, arria10NodeResource, "region")

0 commit comments

Comments
 (0)