Merge pull request #74445 from msau42/fix-localssd-e2e

Fix localssd test panic
pull/564/head
Kubernetes Prow Robot 2019-02-22 23:27:53 -08:00 committed by GitHub
commit 1847c071cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 10 deletions

View File

@ -45,7 +45,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/api/errors"
@ -1651,6 +1651,17 @@ func (l *localDriver) GetDriverInfo() *testsuites.DriverInfo {
}
func (l *localDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) {
}
func (l *localDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTestConfig, func()) {
// choose a randome node to test against
nodes := framework.GetReadySchedulableNodesOrDie(f.ClientSet)
l.node = &nodes.Items[rand.Intn(len(nodes.Items))]
l.hostExec = utils.NewHostExec(f)
l.ltrMgr = utils.NewLocalResourceManager("local-driver", l.hostExec, "/tmp")
// This can't be done in SkipUnsupportedTest because the test framework is not initialized yet
if l.volumeType == utils.LocalVolumeGCELocalSSD {
ssdInterface := "scsi"
filesystemType := "fs"
@ -1663,15 +1674,6 @@ func (l *localDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) {
framework.Skipf("Requires at least 1 %s %s localSSD ", ssdInterface, filesystemType)
}
}
}
func (l *localDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTestConfig, func()) {
// choose a randome node to test against
nodes := framework.GetReadySchedulableNodesOrDie(f.ClientSet)
l.node = &nodes.Items[rand.Intn(len(nodes.Items))]
l.hostExec = utils.NewHostExec(f)
l.ltrMgr = utils.NewLocalResourceManager("local-driver", l.hostExec, "/tmp")
return &testsuites.PerTestConfig{
Driver: l,