-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new xtf.openshift.namespace.per.testcase property which will exec…
…ute every test case in its own namespace. Note this property has limitation that consuming test suite must not create static Openshift instances as those are created before name of test case and thus the namespace for the test is known.
- Loading branch information
Showing
19 changed files
with
571 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
core/src/main/java/cz/xtf/core/context/TestCaseContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cz.xtf.core.context; | ||
|
||
public class TestCaseContext { | ||
|
||
/** | ||
* | ||
* This allows to track currently running test case for correct namespace mapping. This is used to automatically find | ||
* namespace for running test case when | ||
* creating {@link cz.xtf.core.openshift.OpenShift} instances. | ||
*/ | ||
private static String runningTestCaseName; | ||
|
||
/** | ||
* @return test case name associated with current thread or null if not such mapping exists, for example for com.SmokeTest | ||
* returns SmokeTest | ||
*/ | ||
public static String getRunningTestCaseName() { | ||
return runningTestCaseName; | ||
} | ||
|
||
public static void setRunningTestCase(String currentlyRunningTestCaseName) { | ||
runningTestCaseName = currentlyRunningTestCaseName; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
core/src/main/java/cz/xtf/core/context/TestCaseContextExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cz.xtf.core.context; | ||
|
||
import org.junit.jupiter.api.extension.BeforeAllCallback; | ||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* Sets TestCaseContext to name of currently started test case in @BeforeAllCallback | ||
*/ | ||
@Slf4j | ||
public class TestCaseContextExtension implements BeforeAllCallback { | ||
|
||
@Override | ||
public void beforeAll(ExtensionContext extensionContext) { | ||
TestCaseContext.setRunningTestCase(extensionContext.getTestClass().get().getName()); | ||
} | ||
} |
Oops, something went wrong.