Skip to content

Commit

Permalink
Configure Abort-Mission selective test runs (#203)
Browse files Browse the repository at this point in the history
- Updates Abort-Mission version to 3.2.0
- Adds keywords to Abort-Mission evaluators
- Configures Gradle build to allow simple selection of Docker test scope

Resolves #202
{patch}

Signed-off-by: Esta Nagy <[email protected]>
  • Loading branch information
nagyesta authored Jun 12, 2022
1 parent cb18353 commit 2de2d0e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 25 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ project.ext {
ossIndexPass = project.hasProperty('ossIndexPassword') ? (project.property('ossIndexPassword') as String) : ''
ossIndexExclusions = ["CVE-2016-1000027"]
keyToolDir = project.hasProperty('keyToolDir') ? (project.property('keyToolDir') as String) : ''
dockerAbortGroups = project.hasProperty('dockerSuppressGroups') ? 'all' : ''
dockerSuppressGroups = project.hasProperty('dockerSuppressGroups') ? (project.property('dockerSuppressGroups') as String) : ''
repoUrl = 'https://github.com/nagyesta/lowkey-vault'
licenseName = 'MIT License'
licenseUrl = 'https://raw.githubusercontent.com/nagyesta/lowkey-vault/main/LICENSE'
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ testcontainers = "1.17.2"
cucumber = "7.3.4"
mockitoCore = "4.6.1"
jupiter = "5.8.2"
abortMission = "3.1.0"
abortMission = "3.2.0"
checkstyle = "9.2.1"
jacoco = "0.8.2"
jacksonBom = { strictly = "2.13.3" }
Expand Down
40 changes: 20 additions & 20 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -303,41 +303,41 @@
<sha256 value="4e8f317719f2fd7f4455a6e541e43a825d44ac2b9a7a6e5aea53dd9706dd0744" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.nagyesta.abort-mission" name="abort.mission-control" version="3.1.0">
<artifact name="abort.mission-control-3.1.0.jar">
<sha256 value="62c359450714480b312b0b56e98c2e86ef32a599caf4027e52156fdfc69e0769" origin="Generated by Gradle"/>
<component group="com.github.nagyesta.abort-mission" name="abort.mission-control" version="3.2.0">
<artifact name="abort.mission-control-3.2.0.jar">
<sha256 value="90f279f26d474bda9764cb8cc2b99350cdf24c5921daa4fa4d9ee138aa4ab2ae" origin="Generated by Gradle"/>
</artifact>
<artifact name="abort.mission-control-3.1.0.pom">
<sha256 value="18dd52a64f738fff5b821fd1153f9b126ddbbbb59119244be41426daa9b610c2" origin="Generated by Gradle"/>
<artifact name="abort.mission-control-3.2.0.pom">
<sha256 value="28b4d2a79fcdd8c317b3b64276a5932e1eae6f6949dceeda3d01e5efbdfa04bd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.nagyesta.abort-mission-gradle-plugin" name="com.github.nagyesta.abort-mission-gradle-plugin.gradle.plugin" version="3.0.4">
<artifact name="com.github.nagyesta.abort-mission-gradle-plugin.gradle.plugin-3.0.4.pom">
<sha256 value="6636ae364f084cc0693303311876fdeebddb822ff3ca2c9626241eccec82e89b" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.nagyesta.abort-mission.boosters" name="abort.booster-cucumber-jvm" version="3.1.0">
<artifact name="abort.booster-cucumber-jvm-3.1.0.jar">
<sha256 value="d9adf06a242e362d6966694ab9ba342840b84112cc485e527ee2ae3f6bedebbd" origin="Generated by Gradle"/>
<component group="com.github.nagyesta.abort-mission.boosters" name="abort.booster-cucumber-jvm" version="3.2.0">
<artifact name="abort.booster-cucumber-jvm-3.2.0.jar">
<sha256 value="da8ee8bc6dd43ace9528541f2a5a4fa78d3d02aa039577df1fb48a3e19644cb8" origin="Generated by Gradle"/>
</artifact>
<artifact name="abort.booster-cucumber-jvm-3.1.0.pom">
<sha256 value="ffff6b80d62a66655556f235d068fad26c86dff9f924445d8714b477463225e6" origin="Generated by Gradle"/>
<artifact name="abort.booster-cucumber-jvm-3.2.0.pom">
<sha256 value="62828b99a34673e06aa0c80b6379e941c6417fbc23e8b87f0cd19b188a22cb45" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.nagyesta.abort-mission.boosters" name="abort.booster-junit-jupiter" version="3.1.0">
<artifact name="abort.booster-junit-jupiter-3.1.0.jar">
<sha256 value="445a87c34dad017c0dfd3dd5b89b4fa283a417e048e3e2a1eafb771a21f1ac35" origin="Generated by Gradle"/>
<component group="com.github.nagyesta.abort-mission.boosters" name="abort.booster-junit-jupiter" version="3.2.0">
<artifact name="abort.booster-junit-jupiter-3.2.0.jar">
<sha256 value="f8e07d74fc0d7b2589511b590d040ddb4e14b0159f27aafba23107f07f0973ba" origin="Generated by Gradle"/>
</artifact>
<artifact name="abort.booster-junit-jupiter-3.1.0.pom">
<sha256 value="c084af93682f3e71e2a9f2d005c7c05e2daa2b100c0b00da6347b7a8b4c5aadb" origin="Generated by Gradle"/>
<artifact name="abort.booster-junit-jupiter-3.2.0.pom">
<sha256 value="1bbffe06db0f5130058742348d8f3606b6b040c32ccef5f2292185184e1ec03a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.nagyesta.abort-mission.reports" name="abort.flight-evaluation-report" version="3.1.0">
<artifact name="abort.flight-evaluation-report-3.1.0.jar">
<sha256 value="a5be6d0e75278a13651aa0c47988c5533e1782562a630393ae34803a08c08f4d" origin="Generated by Gradle"/>
<component group="com.github.nagyesta.abort-mission.reports" name="abort.flight-evaluation-report" version="3.2.0">
<artifact name="abort.flight-evaluation-report-3.2.0.jar">
<sha256 value="f2f1f47ce6a0e81aeaf6d6aad9c139826e97a50a8ee176c6e324e1b1831830a6" origin="Generated by Gradle"/>
</artifact>
<artifact name="abort.flight-evaluation-report-3.1.0.pom">
<sha256 value="19114d709f0454517b225e6f57d3a2bebfe77b2c86072e0e329514448960ef12" origin="Generated by Gradle"/>
<artifact name="abort.flight-evaluation-report-3.2.0.pom">
<sha256 value="19256fcb2a85a62d50df7b2765ac99b031d2be0ef9e077be95954703e4c503ff" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.package-url" name="packageurl-java" version="1.4.1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ protected Map<String, Consumer<AbortMissionCommandOps>> defineOutline() {
return Map.of(SHARED_CONTEXT, ops -> {
final MissionHealthCheckMatcher integrationTestMatcher = matcher().classNamePattern(".*IntegrationTest").build();
final MissionHealthCheckEvaluator integrationTests = percentageBasedEvaluator(integrationTestMatcher)
.overrideKeyword("IT")
.build();
final MissionHealthCheckMatcher notIntegrationTest = matcher().not(integrationTestMatcher).build();
final MissionHealthCheckMatcher test = matcher().classNamePattern(".*Test").build();
final MissionHealthCheckEvaluator unitTests = reportOnlyEvaluator(matcher().and(notIntegrationTest).andAtLast(test).build())
.overrideKeyword("UT")
.build();
final MissionHealthCheckEvaluator reportOnly = reportOnlyEvaluator(matcher().anyClass().build())
.overrideKeyword("all")
.build();
ops.registerHealthCheck(integrationTests);
ops.registerHealthCheck(unitTests);
ops.registerHealthCheck(reportOnly);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void testConstructorThrowsExceptionWhenCalledWithNull(
}

@Nested
class FunctionalTests {
class FunctionalTest {
@Mock
private VaultService vaultService;
@Mock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void testCreateVaultShouldThrowExceptionWhenCalledWithNull(
}

@Nested
class FunctionalTests {
class FunctionalTest {

@Mock
private ObjectReader objectReader;
Expand Down
2 changes: 2 additions & 0 deletions lowkey-vault-docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ test {
systemProperty("cucumber.filter.tags", "not @ignore")
useTestNG {
systemProperty("abort-mission.report.directory", file("${buildDir}/reports/abort-mission/"))
systemProperty("abort-mission.force.abort.evaluators", rootProject.ext.dockerAbortGroups)
systemProperty("abort-mission.suppress.abort.evaluators", rootProject.ext.dockerSuppressGroups)
}
}
test.outputs.upToDateWhen { false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
import java.util.function.Consumer;
import java.util.stream.Stream;

import static com.github.nagyesta.abortmission.core.MissionControl.matcher;
import static com.github.nagyesta.abortmission.core.MissionControl.percentageBasedEvaluator;
import static com.github.nagyesta.abortmission.core.MissionControl.*;
import static com.github.nagyesta.abortmission.core.outline.MissionOutline.SHARED_CONTEXT;

public class MissionOutlineDefinition extends LaunchAbortHook {
Expand All @@ -28,11 +27,13 @@ public class MissionOutlineDefinition extends LaunchAbortHook {
protected Map<String, Consumer<AbortMissionCommandOps>> defineOutline() {
return Map.of(SHARED_CONTEXT, ops -> {
final TagDependencyNameExtractor extractor = new TagDependencyNameExtractor();
ops.registerHealthCheck(reportOnlyEvaluator(anyScenarioMatcher()).overrideKeyword("all").build());
Stream.of("Key", "Secret").forEach(type -> {
final MissionHealthCheckMatcher typeMatcher = matcher().dependencyWith(type).extractor(extractor).build();
final MissionHealthCheckEvaluator featurePercentage = percentageBasedEvaluator(typeMatcher)
.abortThreshold(ABORT_THRESHOLD)
.burnInTestCount(TOTAL_BURN_IN_TEST_COUNT)
.overrideKeyword(type)
.build();
ops.registerHealthCheck(featurePercentage);

Expand All @@ -43,6 +44,7 @@ protected Map<String, Consumer<AbortMissionCommandOps>> defineOutline() {
final MissionHealthCheckEvaluator subFeaturePercentage = percentageBasedEvaluator(subTypeMatcher)
.abortThreshold(ABORT_THRESHOLD)
.burnInTestCount(BURN_IN_TEST_COUNT)
.overrideKeyword(type + subtype)
.build();
ops.registerHealthCheck(subFeaturePercentage);
});
Expand All @@ -53,6 +55,7 @@ protected Map<String, Consumer<AbortMissionCommandOps>> defineOutline() {
final MissionHealthCheckEvaluator tagPercentage = percentageBasedEvaluator(matcher)
.abortThreshold(ABORT_THRESHOLD)
.burnInTestCount(BURN_IN_TEST_COUNT)
.overrideKeyword(tag)
.build();
ops.registerHealthCheck(tagPercentage);
});
Expand Down

0 comments on commit 2de2d0e

Please sign in to comment.