@@ -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