Skip to content

Commit

Permalink
Fix flaky init cache unit tests (#1956)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpmellema committed Aug 28, 2023
1 parent 8cf0da4 commit 92c5768
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ subprojects {
}

dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:5.4.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.4.0"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.4.0"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.0"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.10.0"
testImplementation "org.hamcrest:hamcrest:2.1"
testCompileOnly "org.apiguardian:apiguardian-api:1.1.2"
}

// Reusable license copySpec for building JARs
Expand Down
9 changes: 7 additions & 2 deletions smithy-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies {
implementation "org.slf4j:slf4j-jdk14:1.7.36" // Route slf4j used by Maven through JUL like the rest of Smithy.

testImplementation "org.mock-server:mockserver-netty:3.10.8"

}

// ------ Shade Maven dependency resolvers into the JAR. -------
Expand Down Expand Up @@ -223,7 +224,7 @@ tasks["runtime"].dependsOn("shadowJar")

sourceSets {
create("it") {
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"] + configurations["testCompileClasspath"]
runtimeClasspath += output + compileClasspath + sourceSets["test"].runtimeClasspath
}
}
Expand All @@ -233,7 +234,11 @@ task integ(type: Test) {
systemProperty "SMITHY_BINARY", "${smithyBinary}"
testClassesDirs = sourceSets["it"].output.classesDirs
classpath = sourceSets["it"].runtimeClasspath
maxParallelForks = Runtime.getRuntime().availableProcessors() / 2

// Configuration parameters to execute top-level classes in parallel but methods in same thread
systemProperties["junit.jupiter.execution.parallel.enabled"] = "true"
systemProperties["junit.jupiter.execution.parallel.mode.default"] = "same_thread"
systemProperties["junit.jupiter.execution.parallel.mode.classes.default"] = "concurrent"

testLogging {
events = ["passed", "skipped", "failed"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Isolated;
import software.amazon.smithy.utils.IoUtils;
import software.amazon.smithy.utils.ListUtils;


@Isolated
public class CleanCommandTest {
private static final String PROJECT_NAME = "simple-config-sources";
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Isolated;
import software.amazon.smithy.utils.IoUtils;
import software.amazon.smithy.utils.ListUtils;

Expand All @@ -20,6 +21,7 @@
import java.util.Collections;
import java.util.List;

@Isolated
public class InitCommandTest {
private static final String PROJECT_NAME = "smithy-templates";

Expand Down

0 comments on commit 92c5768

Please sign in to comment.