Merge pull request #52375 from jiayingz/deviceplugin-e2e

Automatic merge from submit-queue (batch tested with PRs 52316, 52289, 52375)

Extends GPUDevicePlugin e2e test to exercise device plugin restarts.

**What this PR does / why we need it**:
This is part of issue #52189 but does not fix it.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
```
This commit is contained in:
Kubernetes Submit Queue 2017-09-13 04:04:55 -07:00 committed by GitHub
commit 991afb2436

View File

@ -240,6 +240,26 @@ var _ = SIGDescribe("[Feature:GPU]", func() {
var _ = SIGDescribe("[Feature:GPUDevicePlugin]", func() {
f := framework.NewDefaultFramework("device-plugin-gpus")
It("run Nvidia GPU Device Plugin tests on Container Optimized OS only", func() {
// 1. Verifies GPU resource is successfully advertised on the nodes
// and we can run pods using GPUs.
By("Starting device plugin daemonset and running GPU pods")
testNvidiaGPUsOnCOS(f)
// 2. Verifies that when the device plugin DaemonSet is removed, resource capacity drops to zero.
By("Deleting device plugin daemonset")
ds := dsFromManifest(dsYamlUrl)
falseVar := false
err := f.ClientSet.Extensions().DaemonSets(f.Namespace.Name).Delete(ds.Name, &metav1.DeleteOptions{OrphanDependents: &falseVar})
framework.ExpectNoError(err, "failed to delete daemonset")
framework.Logf("Successfully deleted device plugin daemonset. Wait for resource to be removed.")
// Wait for Nvidia GPUs to be not available on nodes
Eventually(func() bool {
return !areGPUsAvailableOnAllSchedulableNodes(f)
}, 5*time.Minute, time.Second).Should(BeTrue())
// 3. Restarts the device plugin DaemonSet. Verifies GPU resource is successfully advertised
// on the nodes and we can run pods using GPUs.
By("Restarting device plugin daemonset and running GPU pods")
testNvidiaGPUsOnCOS(f)
})
})