Skip to content

Commit

Permalink
operator: Add e2e tests for FPGA
Browse files Browse the repository at this point in the history
Closes intel#1272

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
  • Loading branch information
ozhuraki committed Dec 13, 2022
1 parent e262d5e commit 428f1ea
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/e2e-fpga.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: e2e-fpga
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * *'
pull_request:
branches:
- main
- 'release-*'
push:
branches:
- main
- 'release-*'

env:
IMAGES: 'intel-fpga-plugin intel-fpga-initcontainer intel-fpga-admissionwebhook opae-nlb-demo intel-deviceplugin-operator'

permissions:
contents: read

jobs:
e2e-fpga:
name: e2e-fpga
runs-on: [self-hosted, linux, x64, fpga]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Describe test environment
run: |
echo "Event name: ${{ github.event_name }}"
echo "Actor: ${{ github.actor }}"
echo "Ref: ${{ github.ref }}"
echo "SHA: ${{ github.sha }}"
echo "Images: $IMAGES"
- name: Wait for ready state
run: ../../../../bmetal/actions-bmetal-runstage.sh waitready
- name: Prepare test environment
run: ../../../../bmetal/actions-bmetal-runstage.sh prepare
- name: Run tests
run: ../../../../bmetal/actions-bmetal-runstage.sh test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ TAG?=devel
export TAG

e2e-fpga:
@$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "FPGA" -delete-namespace-on-failure=false
@$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "FPGA.*oper" -delete-namespace-on-failure=false

e2e-qat:
@$(GO) test -v ./test/e2e/... -ginkgo.v -ginkgo.progress -ginkgo.focus "QAT plugin in DPDK mode" -delete-namespace-on-failure=false
Expand Down
25 changes: 25 additions & 0 deletions test/e2e/fpga/fpga.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import (
)

const (
ns = "inteldeviceplugins-system"
timeout = time.Second * 120
pluginKustomizationYaml = "deployments/fpga_plugin/base/kustomization.yaml"
mappingsCollectionYaml = "deployments/fpga_admissionwebhook/mappings-collection.yaml"
nlb0NodeResource = "fpga.intel.com/af-695.d84.aVKNtusxV3qMNmj5-qCB9thCTcSko8QT-J5DNoP5BAs"
Expand Down Expand Up @@ -69,6 +71,29 @@ func describe() {
// Run af test case
runTestCase(fmw, pluginKustomizationPath, mappingsCollectionPath, "af", nlb0NodeResource, nlb0PodResourceAF, "nlb0", "nlb3")
})

ginkgo.It("deploys FPGA plugin with operator", func() {
utils.Kubectl("", "apply", "-k", "deployments/operator/default/kustomization.yaml")

if _, err := e2epod.WaitForPodsWithLabelRunningReady(fmw.ClientSet, "", labels.Set{"control-plane": "controller-manager"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}

if false {
utils.Kubectl("", "apply", "-f", "deployments/operator/samples/deviceplugin_v1_fpgadeviceplugin.yaml")

if _, err := e2epod.WaitForPodsWithLabelRunningReady(fmw.ClientSet, ns, labels.Set{"app": "intel-fpga-plugin"}.AsSelector(), 1, timeout); err != nil {
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
}

// if err := utils.WaitForNodesWithResource(f.ClientSet, "dsa.intel.com/wq-user-dedicated", timeout); err != nil {
// framework.Failf("unable to wait for nodes to have positive allocatable resource: %v", err)
// }

utils.Kubectl("", "delete", "-f", "deployments/operator/samples/deviceplugin_v1_fpgadeviceplugin.yaml")
}
utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
})
}

func runTestCase(fmw *framework.Framework, pluginKustomizationPath, mappingsCollectionPath, pluginMode, nodeResource, podResource, cmd1, cmd2 string) {
Expand Down

0 comments on commit 428f1ea

Please sign in to comment.