Skip to content

Commit 87dfdf9

Browse files
authored
Merge pull request #1322 from ozhuraki/e2e-sgx
operator: Add e2e tests for SGX
2 parents 85563ec + 0828d4a commit 87dfdf9

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
images: intel-qat-plugin intel-qat-initcontainer openssl-qat-engine
5656
- name: e2e-sgx
5757
runner: sgx
58-
images: intel-sgx-plugin intel-sgx-initcontainer intel-sgx-admissionwebhook
58+
images: intel-sgx-plugin intel-sgx-initcontainer intel-sgx-admissionwebhook intel-deviceplugin-operator
5959

6060
name: ${{ matrix.name }}
6161
runs-on: ${{ matrix.runner }}

test/e2e/sgx/sgx.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import (
3434
)
3535

3636
const (
37+
ns = "inteldeviceplugins-system"
38+
timeout = time.Second * 120
3739
kustomizationWebhook = "deployments/sgx_admissionwebhook/overlays/default-with-certmanager/kustomization.yaml"
3840
kustomizationPlugin = "deployments/sgx_plugin/overlays/epc-hook-initcontainer/kustomization.yaml"
3941
)
@@ -112,5 +114,37 @@ func describe() {
112114

113115
ginkgo.By("waiting the pod to finish successfully")
114116
e2epod.NewPodClient(f).WaitForSuccess(pod.ObjectMeta.Name, 60*time.Second)
117+
118+
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "delete", "-k", filepath.Dir(deploymentPluginPath))
119+
})
120+
121+
ginkgo.It("deploys SGX plugin with operator", func() {
122+
utils.Kubectl("", "apply", "-k", "deployments/operator/default/kustomization.yaml")
123+
124+
if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"control-plane": "controller-manager"}.AsSelector(), 1, timeout); err != nil {
125+
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
126+
}
127+
128+
utils.Kubectl("", "apply", "-f", "deployments/operator/samples/deviceplugin_v1_sgxdeviceplugin.yaml")
129+
130+
if _, err := e2epod.WaitForPodsWithLabelRunningReady(f.ClientSet, ns, labels.Set{"app": "intel-sgx-plugin"}.AsSelector(), 1, timeout); err != nil {
131+
framework.Failf("unable to wait for all pods to be running and ready: %v", err)
132+
}
133+
134+
if err := utils.WaitForNodesWithResource(f.ClientSet, "sgx.intel.com/epc", 150*time.Second); err != nil {
135+
framework.Failf("unable to wait for nodes to have positive allocatable epc resource: %v", err)
136+
}
137+
138+
if err := utils.WaitForNodesWithResource(f.ClientSet, "sgx.intel.com/enclave", 30*time.Second); err != nil {
139+
framework.Failf("unable to wait for nodes to have positive allocatable enclave resource: %v", err)
140+
}
141+
142+
if err := utils.WaitForNodesWithResource(f.ClientSet, "sgx.intel.com/provision", 30*time.Second); err != nil {
143+
framework.Failf("unable to wait for nodes to have positive allocatable provision resource: %v", err)
144+
}
145+
146+
utils.Kubectl("", "delete", "-f", "deployments/operator/samples/deviceplugin_v1_sgxdeviceplugin.yaml")
147+
148+
utils.Kubectl("", "delete", "-k", "deployments/operator/default/kustomization.yaml")
115149
})
116150
}

0 commit comments

Comments
 (0)