Merge pull request #20808 from soltysh/e2e_tests

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2016-02-25 01:57:24 -08:00
commit bc52f12a56
2 changed files with 12 additions and 2 deletions

View File

@ -230,6 +230,10 @@ func (f *Framework) afterEach() {
}
func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (*api.Namespace, error) {
createTestingNS := testContext.CreateTestingNS
if createTestingNS == nil {
createTestingNS = CreateTestingNS
}
ns, err := createTestingNS(baseName, f.Client, labels)
if err == nil {
f.namespacesToDelete = append(f.namespacesToDelete, ns)

View File

@ -156,6 +156,8 @@ type CloudConfig struct {
// unique identifier of the e2e run
var runId = util.NewUUID()
type CreateTestingNSFn func(baseName string, c *client.Client, labels map[string]string) (*api.Namespace, error)
type TestContextType struct {
KubeConfig string
KubeContext string
@ -182,6 +184,10 @@ type TestContextType struct {
GatherMetricsAfterTest bool
// Currently supported values are 'hr' for human-readable and 'json'. It's a comma separated list.
OutputPrintType string
// CreateTestingNS is responsible for creating namespace used for executing e2e tests.
// It accepts namespace base name, which will be prepended with e2e prefix, kube client
// and labels to be applied to a namespace.
CreateTestingNS CreateTestingNSFn
}
var testContext TestContextType
@ -657,9 +663,9 @@ func waitForPersistentVolumePhase(phase api.PersistentVolumePhase, c *client.Cli
return fmt.Errorf("PersistentVolume %s not in phase %s within %v", pvName, phase, timeout)
}
// createTestingNS should be used by every test, note that we append a common prefix to the provided test name.
// CreateTestingNS should be used by every test, note that we append a common prefix to the provided test name.
// Please see NewFramework instead of using this directly.
func createTestingNS(baseName string, c *client.Client, labels map[string]string) (*api.Namespace, error) {
func CreateTestingNS(baseName string, c *client.Client, labels map[string]string) (*api.Namespace, error) {
if labels == nil {
labels = map[string]string{}
}