Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add new --ora-stuck-timeout parameter #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions 2 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ utplsql run "my/Username"/"myP@ssword"@connectstring

--coverage-schemes - A comma separated list of schemas on which coverage should be gathered
Format: --coverage-schemes=schema1[,schema2[,schema3]]

--ora-stuck-timeout - Sets a timeout around Reporter creation and retries when not ready after a while. 0 = no timeout.
```

Parameters -f, -o, -s are correlated. That is parameters -o and -s are controlling outputs for reporter specified by the preceding -f parameter.
Expand Down
3 changes: 2 additions & 1 deletion 3 src/main/java/org/utplsql/cli/RunAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ TestRunner newTestRunner(List<Reporter> reporterList) {
.randomTestOrder(config.isRandomTestOrder())
.randomTestOrderSeed(config.getRandomTestOrderSeed())
.addTags(Arrays.asList(config.getTags()))
.addCoverageSchemes(Arrays.asList(config.getCoverageSchemes()));
.addCoverageSchemes(Arrays.asList(config.getCoverageSchemes()))
.oraStuckTimeout(config.getOraStuckTimeout());
}

private void outputMainInformation() {
Expand Down
4 changes: 4 additions & 0 deletions 4 src/main/java/org/utplsql/cli/RunPicocliCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ FileMapperConfig toFileMapperConfig() {
@Option(names = "-h", usageHelp = true, description = "display this help and exit")
boolean help;

@Option(names = "--ora-stuck-timeout", description = "Sets a timeout around Reporter creation and retries when not ready after a while. 0 = no timeout.")
Integer oraStuckTimeout = 0;

private RunAction runAction;

private String[] splitOrEmpty(String value) {
Expand Down Expand Up @@ -245,6 +248,7 @@ public RunCommandConfig getRunCommandConfig() {
.randomTestOrderSeed(randomTestOrderSeed)
.tags(tags.toArray(new String[0]))
.coverageSchemes(coverageSchemes.toArray(new String[0]))
.oraStuckTimeout(oraStuckTimeout)
.create();
}

Expand Down
16 changes: 13 additions & 3 deletions 16 src/main/java/org/utplsql/cli/config/RunCommandConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ public class RunCommandConfig extends ConnectionConfig {
private final Integer randomTestOrderSeed;
private final String[] tags;
private final String[] coverageSchemes;
private final Integer oraStuckTimeout;

@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags", "coverageSchemes"})
public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfig[] reporters, boolean outputAnsiColor, Integer failureExitCode, boolean skipCompatibilityCheck, String[] includePackages, String[] excludePackages, FileMapperConfig sourceMapping, FileMapperConfig testMapping, ConfigLevel logConfigLevel, Integer timeoutInMinutes, boolean dbmsOutput, boolean randomTestOrder, Integer randomTestOrderSeed, String[] tags, String[] coverageSchemes) {
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags", "coverageSchemes", "oraStuckTimeout"})
public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfig[] reporters, boolean outputAnsiColor, Integer failureExitCode, boolean skipCompatibilityCheck, String[] includePackages, String[] excludePackages, FileMapperConfig sourceMapping, FileMapperConfig testMapping, ConfigLevel logConfigLevel, Integer timeoutInMinutes, boolean dbmsOutput, boolean randomTestOrder, Integer randomTestOrderSeed, String[] tags, String[] coverageSchemes, Integer oraStuckTimeout) {
super(connectString);
this.suitePaths = suitePaths;
this.reporters = reporters;
Expand All @@ -43,6 +44,7 @@ public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfi
this.randomTestOrderSeed = randomTestOrderSeed;
this.tags = tags;
this.coverageSchemes = coverageSchemes;
this.oraStuckTimeout = oraStuckTimeout;
}

public String[] getSuitePaths() {
Expand Down Expand Up @@ -109,6 +111,8 @@ public String[] getCoverageSchemes() {
return coverageSchemes;
}

public Integer getOraStuckTimeout() { return oraStuckTimeout; }

public static class Builder {

private String connectString;
Expand All @@ -128,6 +132,7 @@ public static class Builder {
private Integer randomTestOrderSeed;
private String[] tags = new String[0];
private String[] coverageSchemes = new String[0];
private Integer oraStuckTimeout;

public Builder connectString(String connectString) {
this.connectString = connectString;
Expand Down Expand Up @@ -214,8 +219,13 @@ public Builder coverageSchemes(String[] coverageSchemes) {
return this;
}

public Builder oraStuckTimeout(Integer oraStuckTimeout) {
this.oraStuckTimeout = oraStuckTimeout;
return this;
}

public RunCommandConfig create() {
return new RunCommandConfig(connectString, suitePaths, reporters, outputAnsiColor, failureExitCode, skipCompatibilityCheck, includePackages, excludePackages, sourceMapping, testMapping, logConfigLevel, timeoutInMinutes, dbmsOutput, randomTestOrder, randomTestOrderSeed, tags, coverageSchemes);
return new RunCommandConfig(connectString, suitePaths, reporters, outputAnsiColor, failureExitCode, skipCompatibilityCheck, includePackages, excludePackages, sourceMapping, testMapping, logConfigLevel, timeoutInMinutes, dbmsOutput, randomTestOrder, randomTestOrderSeed, tags, coverageSchemes, oraStuckTimeout);
}
}
}
3 changes: 2 additions & 1 deletion 3 src/test/java/org/utplsql/cli/RunCommandArgumentsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public void allArgumentsAreRecognized() {
"-type_mapping=\"sql=PACKAGE BODY\"",
"-owner_subexpression=0",
"-type_subexpression=0",
"-name_subexpression=0"
"-name_subexpression=0",
"--ora-stuck-timeout=2"
);

TestRunner testRunner = runCmd.newTestRunner(new ArrayList<>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class RunCommandConfigParamsArePassedToTestRunnerTest {

Expand All @@ -28,4 +30,13 @@ void coverageSchemes() {
TestRunner testRunner = new RunAction(config).newTestRunner(new ArrayList<>());
assertThat( testRunner.getOptions().coverageSchemes, contains("schema1", "another_schema", "and-another-one") );
}

@Test
void oraStuckTimeout() {
RunCommandConfig config = new RunCommandConfig.Builder()
.oraStuckTimeout(2)
.create();
TestRunner testRunner = new RunAction(config).newTestRunner(new ArrayList<>());
assertThat( testRunner.getOptions().oraStuckTimeout, equalTo(2) );
}
}
10 changes: 10 additions & 0 deletions 10 src/test/java/org/utplsql/cli/RunCommandIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,14 @@ void run_withOutputButNoReporterDefined() throws Exception {

assertValidReturnCode(result);
}

@Test
void run_withOraStuckTimeout() throws Exception {
int result = TestHelper.runApp("run",
TestHelper.getConnectionString(),
"--ora-stuck-timeout=2",
"--failure-exit-code=2");

assertValidReturnCode(result);
}
}
3 changes: 2 additions & 1 deletion 3 src/test/java/org/utplsql/cli/RunCommandIssue20IT.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void runLoop() {
IRunCommand runCmd = TestHelper.createRunCommand(
TestHelper.getConnectionString(),
"-p=TEST_BETWNSTR.normal_case",
"-f=ut_documentation_reporter");
"-f=ut_documentation_reporter",
"--ora-stuck-timeout=3");
List<ReporterOptions> reporterOptionsList = runCmd.getReporterOptionsList();
ReporterOptions reporterOptions1 = reporterOptionsList.get(0);
assertEquals(CoreReporters.UT_DOCUMENTATION_REPORTER.name(), reporterOptions1.getReporterName());
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.