Skip to content

Commit 141669b

Browse files
author
Dmitry Rozhkov
authored
Merge pull request #420 from bart0sh/PR0088-fix-fpga-e2e-test
e2e: fix FPGA tests
2 parents 0171c39 + 49d3514 commit 141669b

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

test/e2e/fpga/fpga.go

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,49 +35,42 @@ import (
3535
)
3636

3737
const (
38-
pluginKustomizationYaml = "deployments/fpga_plugin/base/kustomization.yaml"
39-
webhookKustomizationYaml = "deployments/fpga_admissionwebhook/default/kustomization.yaml"
40-
nlb0NodeResource = "fpga.intel.com/af-695.d84.aVKNtusxV3qMNmj5-qCB9thCTcSko8QT-J5DNoP5BAs"
41-
nlb0PodResource = "fpga.intel.com/arria10.dcp1.2-nlb0-orchestrated"
42-
nlb3PodResource = "fpga.intel.com/arria10.dcp1.2-nlb3-orchestrated"
43-
nlb0PodResourceAF = "fpga.intel.com/arria10.dcp1.2-nlb0-preprogrammed"
44-
arria10NodeResource = "fpga.intel.com/region-69528db6eb31577a8c3668f9faa081f6"
38+
pluginKustomizationYaml = "deployments/fpga_plugin/base/kustomization.yaml"
39+
mappingsCollectionYaml = "deployments/fpga_admissionwebhook/mappings-collection.yaml"
40+
nlb0NodeResource = "fpga.intel.com/af-695.d84.aVKNtusxV3qMNmj5-qCB9thCTcSko8QT-J5DNoP5BAs"
41+
nlb0PodResource = "fpga.intel.com/arria10.dcp1.2-nlb0-orchestrated"
42+
nlb3PodResource = "fpga.intel.com/arria10.dcp1.2-nlb3-orchestrated"
43+
nlb0PodResourceAF = "fpga.intel.com/arria10.dcp1.2-nlb0-preprogrammed"
44+
arria10NodeResource = "fpga.intel.com/region-69528db6eb31577a8c3668f9faa081f6"
4545
)
4646

4747
func init() {
4848
ginkgo.Describe("FPGA Plugin E2E tests", describe)
4949
}
5050

5151
func describe() {
52-
webhookKustomizationPath, err := utils.LocateRepoFile(webhookKustomizationYaml)
52+
pluginKustomizationPath, err := utils.LocateRepoFile(pluginKustomizationYaml)
5353
if err != nil {
54-
framework.Failf("unable to locate %q: %v", webhookKustomizationYaml, err)
54+
framework.Failf("unable to locate %q: %v", pluginKustomizationYaml, err)
5555
}
5656

57-
pluginKustomizationPath, err := utils.LocateRepoFile(pluginKustomizationYaml)
57+
mappingsCollectionPath, err := utils.LocateRepoFile(mappingsCollectionYaml)
5858
if err != nil {
59-
framework.Failf("unable to locate %q: %v", pluginKustomizationYaml, err)
59+
framework.Failf("unable to locate %q: %v", mappingsCollectionYaml, err)
6060
}
6161

6262
fmw := framework.NewDefaultFramework("fpgaplugin-e2e")
6363

6464
ginkgo.It("Run FPGA plugin tests", func() {
65-
// Deploy webhook
66-
ginkgo.By(fmt.Sprintf("namespace %s: deploying webhook", fmw.Namespace.Name))
67-
utils.DeployFpgaWebhook(fmw, webhookKustomizationPath)
68-
69-
ginkgo.By("deploying mappings")
70-
framework.RunKubectlOrDie(fmw.Namespace.Name, "apply", "-n", fmw.Namespace.Name, "-f", filepath.Dir(webhookKustomizationPath)+"/../mappings-collection.yaml")
71-
7265
// Run region test case twice to ensure that device is reprogrammed at least once
73-
runTestCase(fmw, pluginKustomizationPath, "region", arria10NodeResource, nlb3PodResource, "nlb3", "nlb0")
74-
runTestCase(fmw, pluginKustomizationPath, "region", arria10NodeResource, nlb0PodResource, "nlb0", "nlb3")
66+
runTestCase(fmw, pluginKustomizationPath, mappingsCollectionPath, "region", arria10NodeResource, nlb3PodResource, "nlb3", "nlb0")
67+
runTestCase(fmw, pluginKustomizationPath, mappingsCollectionPath, "region", arria10NodeResource, nlb0PodResource, "nlb0", "nlb3")
7568
// Run af test case
76-
runTestCase(fmw, pluginKustomizationPath, "af", nlb0NodeResource, nlb0PodResourceAF, "nlb0", "nlb3")
69+
runTestCase(fmw, pluginKustomizationPath, mappingsCollectionPath, "af", nlb0NodeResource, nlb0PodResourceAF, "nlb0", "nlb3")
7770
})
7871
}
7972

80-
func runTestCase(fmw *framework.Framework, pluginKustomizationPath, pluginMode, nodeResource, podResource, cmd1, cmd2 string) {
73+
func runTestCase(fmw *framework.Framework, pluginKustomizationPath, mappingsCollectionPath, pluginMode, nodeResource, podResource, cmd1, cmd2 string) {
8174
tmpDir, err := ioutil.TempDir("", "fpgaplugine2etest-"+fmw.Namespace.Name)
8275
if err != nil {
8376
framework.Failf("unable to create temp directory: %v", err)
@@ -93,6 +86,9 @@ func runTestCase(fmw *framework.Framework, pluginKustomizationPath, pluginMode,
9386
_, _ = framework.RunKubectl(fmw.Namespace.Name, "delete", "-k", tmpDir)
9487
framework.RunKubectlOrDie(fmw.Namespace.Name, "apply", "-k", tmpDir)
9588

89+
ginkgo.By("deploying mappings")
90+
framework.RunKubectlOrDie(fmw.Namespace.Name, "apply", "-n", fmw.Namespace.Name, "-f", mappingsCollectionPath)
91+
9692
waitForPod(fmw, "intel-fpga-plugin")
9793

9894
resource := v1.ResourceName(nodeResource)

0 commit comments

Comments
 (0)