diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a0cc153f..c5493379 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: - name: Run Gradle Publish run: | - ./gradlew :bosk-core:test publishToSonatype closeAndReleaseSonatypeStagingRepository \ + ./gradlew smoke publishToSonatype closeAndReleaseSonatypeStagingRepository \ -Pversion="${{github.event.release.tag_name}}" \ --info env: diff --git a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/DisruptsMongoService.java b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/DisruptsMongoService.java index 3f08808d..fe8800f7 100644 --- a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/DisruptsMongoService.java +++ b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/DisruptsMongoService.java @@ -5,6 +5,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.junit.jupiter.api.parallel.ResourceLock; +import works.bosk.junit.Slow; import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; @@ -29,5 +30,6 @@ @Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) @ResourceLock(value="mongoContainer", mode=READ_WRITE) +@Slow // These are inherently slow because they prevent tests from running in parallel public @interface DisruptsMongoService { } diff --git a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverConformanceTest.java b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverConformanceTest.java index f4adddd2..a65af742 100644 --- a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverConformanceTest.java +++ b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverConformanceTest.java @@ -12,10 +12,12 @@ import works.bosk.drivers.mongo.TestParameters.EventTiming; import works.bosk.drivers.mongo.TestParameters.ParameterSet; import works.bosk.junit.ParametersByName; +import works.bosk.junit.Slow; import static works.bosk.drivers.mongo.MongoDriverSettings.DatabaseFormat.SEQUOIA; @UsesMongoService +@Slow class MongoDriverConformanceTest extends DriverConformanceTest { private final Deque tearDownActions = new ArrayDeque<>(); private static MongoService mongoService; diff --git a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverHanoiTest.java b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverHanoiTest.java index c8e87cfe..c3130a93 100644 --- a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverHanoiTest.java +++ b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverHanoiTest.java @@ -10,10 +10,12 @@ import works.bosk.DriverStack; import works.bosk.drivers.HanoiTest; import works.bosk.junit.ParametersByName; +import works.bosk.junit.Slow; import static works.bosk.drivers.mongo.MainDriver.COLLECTION_NAME; @UsesMongoService +@Slow public class MongoDriverHanoiTest extends HanoiTest { private static MongoService mongoService; private final Queue shutdownOperations = new ConcurrentLinkedDeque<>(); diff --git a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverRecoveryTest.java b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverRecoveryTest.java index 55b747c0..6e19109f 100644 --- a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverRecoveryTest.java +++ b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverRecoveryTest.java @@ -21,6 +21,7 @@ import works.bosk.exceptions.FlushFailureException; import works.bosk.exceptions.InvalidTypeException; import works.bosk.junit.ParametersByName; +import works.bosk.junit.Slow; import static ch.qos.logback.classic.Level.ERROR; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -32,6 +33,7 @@ /** * Tests the kinds of recovery actions a human operator might take to try to get a busted service running again. */ +@Slow public class MongoDriverRecoveryTest extends AbstractMongoDriverTest { FlushOrWait flushOrWait; diff --git a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverSpecialTest.java b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverSpecialTest.java index a7bdf3c6..abde3d4b 100644 --- a/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverSpecialTest.java +++ b/bosk-mongo/src/test/java/works/bosk/drivers/mongo/MongoDriverSpecialTest.java @@ -36,6 +36,7 @@ import works.bosk.exceptions.FlushFailureException; import works.bosk.exceptions.InvalidTypeException; import works.bosk.junit.ParametersByName; +import works.bosk.junit.Slow; import works.bosk.util.Classes; import static ch.qos.logback.classic.Level.ERROR; @@ -447,6 +448,7 @@ void deleteNonexistentField_ignored() throws InvalidTypeException, IOException, @ParametersByName @UsesMongoService + @Slow void databaseMissingField_fallsBackToDefaultState() throws InvalidTypeException, IOException, InterruptedException { setLogging(ERROR, ChangeReceiver.class); @@ -576,6 +578,7 @@ void refurbish_createsField() throws IOException, InterruptedException { @ParametersByName @UsesMongoService + @Slow void manifestVersionBump_disconnects() throws IOException, InterruptedException { setLogging(ERROR, MainDriver.class, ChangeReceiver.class); diff --git a/bosk-testing/src/main/java/works/bosk/junit/Slow.java b/bosk-testing/src/main/java/works/bosk/junit/Slow.java new file mode 100644 index 00000000..d23a30a3 --- /dev/null +++ b/bosk-testing/src/main/java/works/bosk/junit/Slow.java @@ -0,0 +1,19 @@ +package works.bosk.junit; + +import org.junit.jupiter.api.Tag; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Omits the test from the {@code smoke} task. + */ +@Target({METHOD, TYPE}) +@Retention(RUNTIME) +@Tag("slow") +public @interface Slow { +} diff --git a/build.gradle b/build.gradle index dd59c100..d918a73e 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,21 @@ spotless { allprojects { group = 'works.bosk' // version should be set as a property with -Pversion + + tasks.register('smoke', Test) { + // A set of tests that should finish in under a minute or so. + // Used as a quick double-check before publishing, when we've already + // run the full test suite and so there's no need to run it again. + // If publishing takes longer than desired, tests can be annotated + // with @Slow to omit them from this suite. + + group = 'verification' + description = 'Skips tests tagged as "slow" for a quick verification that basic functionality works.' + + useJUnitPlatform { + excludeTags 'slow' + } + } } nexusPublishing {