Skip to content

Commit

Permalink
Merge pull request #115 from bouskaJ/issue_114
Browse files Browse the repository at this point in the history
fix(#114): Use namespace form runConfig
  • Loading branch information
nicolaferraro authored May 27, 2020
2 parents f8b2b77 + 5812781 commit 4f7be7d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pkg/cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,10 @@ func (o *testCmdOptions) runTest(source string, results *v1alpha1.TestResults) e
return err
}

testNamespace := runConfig.Config.Namespace.Name
if runConfig.Config.Namespace.Temporary {
if namespace, err := o.createTempNamespace(runConfig, c); err != nil {
return err
} else if namespace != nil && runConfig.Config.Namespace.AutoRemove {
testNamespace = namespace.GetName()
defer deleteTempNamespace(namespace, c, o.Context)
}
}
Expand All @@ -170,8 +168,8 @@ func (o *testCmdOptions) runTest(source string, results *v1alpha1.TestResults) e
}

baseDir := getBaseDir(source)
defer runSteps(runConfig.Post, testNamespace, baseDir)
if err = runSteps(runConfig.Pre, testNamespace, baseDir); err != nil {
defer runSteps(runConfig.Post, runConfig.Config.Namespace.Name, baseDir)
if err = runSteps(runConfig.Pre, runConfig.Config.Namespace.Name, baseDir); err != nil {
return err
}

Expand All @@ -198,12 +196,10 @@ func (o *testCmdOptions) runTestGroup(source string, results *v1alpha1.TestResul
return err
}

var testNamespace = runConfig.Config.Namespace.Name
if runConfig.Config.Namespace.Temporary {
if namespace, err := o.createTempNamespace(runConfig, c); err != nil {
return err
} else if namespace != nil && runConfig.Config.Namespace.AutoRemove {
testNamespace = namespace.GetName()
defer deleteTempNamespace(namespace, c, o.Context)
}
}
Expand All @@ -218,8 +214,8 @@ func (o *testCmdOptions) runTestGroup(source string, results *v1alpha1.TestResul
}

baseDir := getBaseDir(source)
defer runSteps(runConfig.Post, testNamespace, baseDir)
if err = runSteps(runConfig.Pre, testNamespace, baseDir); err != nil {
defer runSteps(runConfig.Post, runConfig.Config.Namespace.Name, baseDir)
if err = runSteps(runConfig.Pre, runConfig.Config.Namespace.Name, baseDir); err != nil {
return err
}

Expand Down

0 comments on commit 4f7be7d

Please sign in to comment.