Skip to content

Making tests opt-out instead of opt-in and update TestVectorRunner #154

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 3 commits into from
Feb 7, 2020
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
42 changes: 31 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<artifactId>junit-jupiter</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -197,7 +197,7 @@
</profile>

<profile>
<id>full-test-suite</id>
<id>test-suite</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
Expand All @@ -208,30 +208,50 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<includes>
<include>**/AllTestsSuite.java</include>
</includes>
<excludedGroups>ad_hoc</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<!-- This test profile is intended to assist in rapid development; it filters out some of the slower,
more exhaustive tests in the overall test suite to allow for a rapid edit-test cycle. -->
<profile>
<id>fast-tests-only</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<includes>
<include>**/FastTestsOnlySuite.java</include>
</includes>
<excludedGroups>ad_hoc, integration</excludedGroups>
<systemPropertyVariables>
<fastTestsOnly>true</fastTestsOnly>
</systemPropertyVariables>
<!-- Require that this fast suite completes relatively quickly. If you're seeing
this timeout get hit, it's time to pare down tests some more. As a general rule of
thumb, we should avoid any single test taking more than 10s, and try to keep the
number of such slow tests to a minimum. -->
<forkedProcessTimeoutInSeconds>120</forkedProcessTimeoutInSeconds>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<!-- This test profile will run only the integration tests. -->
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<groups>integration</groups>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@

package com.amazonaws.crypto.examples;

import com.amazonaws.encryptionsdk.TestUtils;
import com.amazonaws.encryptionsdk.kms.AwsKmsCmkId;
import com.amazonaws.encryptionsdk.kms.KMSTestFixtures;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Tag(TestUtils.TAG_INTEGRATION)
class BasicEncryptionExampleTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@

package com.amazonaws.crypto.examples;

import com.amazonaws.encryptionsdk.TestUtils;
import com.amazonaws.encryptionsdk.kms.AwsKmsCmkId;
import com.amazonaws.encryptionsdk.kms.KMSTestFixtures;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.security.GeneralSecurityException;

@Tag(TestUtils.TAG_INTEGRATION)
class EscrowedEncryptExampleTest {

@Test
Expand Down
63 changes: 0 additions & 63 deletions src/test/java/com/amazonaws/encryptionsdk/AllTestsSuite.java

This file was deleted.

10 changes: 5 additions & 5 deletions src/test/java/com/amazonaws/encryptionsdk/AwsCryptoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

package com.amazonaws.encryptionsdk;

import static com.amazonaws.encryptionsdk.FastTestsOnlySuite.isFastTestSuiteActive;
import static com.amazonaws.encryptionsdk.TestUtils.assertNullChecks;
import static com.amazonaws.encryptionsdk.TestUtils.assertThrows;
import static com.amazonaws.encryptionsdk.TestUtils.isFastTestsOnly;
import static java.util.Collections.singletonMap;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -203,7 +203,7 @@ public void encryptDecrypt() {
for (int j = 0; j < bytesToTest.length; j++) {
final int byteSize = bytesToTest[j];

if (byteSize > 500_000 && isFastTestSuiteActive()) {
if (byteSize > 500_000 && isFastTestsOnly()) {
continue;
}

Expand Down Expand Up @@ -232,7 +232,7 @@ public void encryptDecryptWithBadSignature() {
for (int j = 0; j < bytesToTest.length; j++) {
final int byteSize = bytesToTest[j];

if (byteSize > 500_000 && isFastTestSuiteActive()) {
if (byteSize > 500_000 && isFastTestsOnly()) {
continue;
}

Expand All @@ -258,7 +258,7 @@ public void encryptDecryptWithParsedCiphertext() {
for (int j = 0; j < bytesToTest.length; j++) {
final int byteSize = bytesToTest[j];

if (byteSize > 500_000 && isFastTestSuiteActive()) {
if (byteSize > 500_000 && isFastTestsOnly()) {
continue;
}

Expand Down Expand Up @@ -467,7 +467,7 @@ public void estimateCiphertextSize() {
for (int j = 0; j < bytesToTest.length; j++) {
final int byteSize = bytesToTest[j];

if (byteSize > 500_000 && isFastTestSuiteActive()) {
if (byteSize > 500_000 && isFastTestsOnly()) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import static com.amazonaws.encryptionsdk.TestUtils.assertThrows;
import static com.amazonaws.encryptionsdk.TestUtils.insecureRandomBytes;
import static com.amazonaws.encryptionsdk.TestUtils.isFastTestsOnly;
import static com.amazonaws.encryptionsdk.internal.TestIOUtils.getSha256Hash;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -163,7 +164,7 @@ public static Collection<Object[]> encryptDecryptParams() {
// Our bytesToTest and readLenVals arrays tend to have the bigger numbers towards the end - we'll chop off
// the last few as they take the longest and don't really add that much more coverage.
int skipLastNSizes;
if (!FastTestsOnlySuite.isFastTestSuiteActive()) {
if (!isFastTestsOnly()) {
skipLastNSizes = 0;
} else if (firstAlgorithm) {
// We'll run more tests for the first algorithm in the list - but not go quite so far as running the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
package com.amazonaws.encryptionsdk;

import static com.amazonaws.encryptionsdk.AwsCrypto.getDefaultFrameSize;
import static com.amazonaws.encryptionsdk.FastTestsOnlySuite.isFastTestSuiteActive;
import static com.amazonaws.encryptionsdk.TestUtils.assertThrows;
import static com.amazonaws.encryptionsdk.TestUtils.insecureRandomBytes;
import static com.amazonaws.encryptionsdk.TestUtils.isFastTestsOnly;
import static com.amazonaws.encryptionsdk.TestUtils.toByteArray;
import static com.amazonaws.encryptionsdk.internal.TestIOUtils.getSha256Hash;
import static org.junit.Assert.assertArrayEquals;
Expand Down Expand Up @@ -163,7 +163,7 @@ public static Collection<Object[]> encryptDecryptParams() {
int[] bytesToTest = { 0, 1, frameSize - 1, frameSize, frameSize + 1, (int) (frameSize * 1.5),
frameSize * 2, 1000000 };

if (isFastTestSuiteActive()) {
if (isFastTestsOnly()) {
// Exclude the last two sizes, as they're the slowest
bytesToTest = Arrays.copyOfRange(bytesToTest, 0, bytesToTest.length - 2);
}
Expand All @@ -173,7 +173,7 @@ public static Collection<Object[]> encryptDecryptParams() {
final int byteSize = bytesToTest[j];
int[] readLenVals = { byteSize - 1, byteSize, byteSize + 1, byteSize * 2, 1000000 };

if (isFastTestSuiteActive()) {
if (isFastTestsOnly()) {
// Only test one read() call buffer length in the fast tests. This greatly cuts down on
// the combinatorial explosion of test cases here.
readLenVals = Arrays.copyOfRange(readLenVals, 0, 1);
Expand Down
89 changes: 0 additions & 89 deletions src/test/java/com/amazonaws/encryptionsdk/FastTestsOnlySuite.java

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions src/test/java/com/amazonaws/encryptionsdk/SlowTestCategory.java

This file was deleted.

Loading