Skip to content
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

Remove redundant integration test runs #364

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8509b55
Resolve #336 by not running every test for every cipher in addition t…
tjcelaya Oct 19, 2017
2a056fb
Test cleanup stash
tjcelaya Oct 23, 2017
ea7c2dc
Clean up TestListingInterceptor
tjcelaya Oct 23, 2017
3405b89
Change parent class name so it doesn't match a pattern people might e…
tjcelaya Oct 26, 2017
38b23cb
Use class params and make it safe to instantiate test classes without…
tjcelaya Oct 26, 2017
5948873
Remove missed references to encryptionCipher field
tjcelaya Oct 26, 2017
6e63fcb
Remove group usage in test suite definition
tjcelaya Oct 26, 2017
d931d82
Explicitly list jobs tests for consistency
tjcelaya Oct 26, 2017
5ec7893
Remove redundant usingEncryption boolean
tjcelaya Oct 26, 2017
34dc457
Merge branch 'master' into bug/336-remove-redundant-integration-test-…
tjcelaya Oct 26, 2017
dab0152
Docs about it.dryrun
tjcelaya Oct 26, 2017
47c9b71
Merge branch 'master' into bug/336-remove-redundant-integration-test-…
tjcelaya Nov 17, 2017
1c07976
Remove Range integration tests from AES/CBC and AES/GCM since they're…
tjcelaya Nov 18, 2017
f2f9ca5
Merge branch 'master' into bug/336-remove-redundant-integration-test-…
tjcelaya Dec 2, 2017
268b160
Merge branch 'master' into bug/336-remove-redundant-integration-test-…
tjcelaya Dec 5, 2017
f488be6
Temporarily disable jobs tests while diagnosing issue
tjcelaya Dec 6, 2017
766eca0
Bump commit
tjcelaya Dec 6, 2017
4f55b12
All the jobs
tjcelaya Dec 6, 2017
19736f6
Merge branch 'master' into bug/336-remove-redundant-integration-test-…
tjcelaya Jan 12, 2018
59097e7
Merge branch 'master' into bug/336-remove-redundant-integration-test-…
tjcelaya Jan 12, 2018
a336fc2
Uncomment jobs tests
tjcelaya Jan 16, 2018
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,4 @@ goes out to:
* [The TestNG Project](http://testng.org/doc/index.html)
* [The Mockito Project](http://site.mockito.org/)
* [Timothy W Macinta's FastMD5 Project](http://twmacinta.com/myjava/fast_md5.php)

13 changes: 12 additions & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ possible torun a subset of the test suite by adding
mvn test -DexcludedGroups=unlimited-crypto
```

## Dry run

It's possible to print a list of which integration tests would run and their relevant
parameters using the following invocation:

```
mvn verify -Dit.dryrun=true
```

Note: This has not yet been expanded to unit tests.

# Writing Tests

The `java-manta-client` module contains unit tests. Integration tests generally
Expand All @@ -83,4 +94,4 @@ There is still work being done to provide a workaround for this situation.
[Surefire](http://maven.apache.org/surefire/maven-surefire-plugin/) and
[Failsafe](http://maven.apache.org/surefire/maven-failsafe-plugin/) plugins are
configured to look for [TestNG](http://testng.org/doc/) configuration
in their module's `resource` folders.
in their module's `resource` folders.
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@
*/
package com.joyent.manta.client;

import com.joyent.manta.config.IntegrationTestConfigContext;
import com.joyent.manta.config.ChainedConfigContext;
import com.joyent.manta.config.ConfigContext;
import com.joyent.manta.config.IntegrationTestConfigContext;
import com.joyent.manta.config.MapConfigContext;
import com.joyent.test.util.MantaAssert;
import com.joyent.test.util.MantaFunction;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

import java.io.IOException;
Expand All @@ -34,7 +32,7 @@
*
* @author <a href="https://github.com/dekobon">Elijah Zupancic</a>
*/
@Test(groups = { "error" })
@Test(groups = {"error"})
public class MantaClientErrorIT {
private MantaClient mantaClient;

Expand All @@ -43,11 +41,10 @@ public class MantaClientErrorIT {
private String testPathPrefix;

@BeforeClass
@Parameters({"usingEncryption"})
public void beforeClass(@Optional Boolean usingEncryption) throws IOException {
public void beforeClass() throws IOException {

// Let TestNG configuration take precedence over environment variables
config = new IntegrationTestConfigContext(usingEncryption);
config = new IntegrationTestConfigContext();

mantaClient = new MantaClient(config);
testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,27 @@
* @author <a href="https://github.com/yunong">Yunong Xiao</a>
* @author <a href="https://github.com/dekobon">Elijah Zupancic</a>
*/
//@Test(dependsOnGroups = { "directory" })
@Test(groups = { "encryptable" })
public class MantaClientIT {

private static final String TEST_DATA = "EPISODEII_IS_BEST_EPISODE";

private MantaClient mantaClient;
private final MantaClient mantaClient;

private String testPathPrefix;
private final String testPathPrefix;

@BeforeClass
@Parameters({"usingEncryption"})
public void beforeClass(@Optional Boolean usingEncryption) throws IOException {
@Parameters({"encryptionCipher"})
public MantaClientIT(final @Optional String encryptionCipher) throws IOException {

// Let TestNG configuration take precedence over environment variables
ConfigContext config = new IntegrationTestConfigContext(usingEncryption);
ConfigContext config = new IntegrationTestConfigContext(encryptionCipher);

mantaClient = new MantaClient(config);
testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName());
}

@BeforeClass
public void beforeClass() throws IOException {
mantaClient.putDirectory(testPathPrefix, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/
package com.joyent.manta.client;

import com.joyent.manta.config.IntegrationTestConfigContext;
import com.joyent.manta.config.ConfigContext;
import com.joyent.manta.config.IntegrationTestConfigContext;
import org.testng.Assert;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
Expand All @@ -27,23 +27,26 @@
*
* @author <a href="https://github.com/dekobon">Elijah Zupancic</a>
*/
@Test( groups = { "metadata" })
@Test(groups = { "metadata" })
public class MantaClientMetadataIT {
private static final String TEST_DATA = "EPISODEII_IS_BEST_EPISODE";

private MantaClient mantaClient;

private String testPathPrefix;

@BeforeClass
@Parameters({"usingEncryption"})
public void beforeClass(@Optional Boolean usingEncryption) throws IOException {
@Parameters({"encryptionCipher"})
public MantaClientMetadataIT(final @Optional String encryptionCipher) throws IOException {

// Let TestNG configuration take precedence over environment variables
ConfigContext config = new IntegrationTestConfigContext(usingEncryption);
ConfigContext config = new IntegrationTestConfigContext(encryptionCipher);

mantaClient = new MantaClient(config);
testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName());
}

@BeforeClass
public void beforeClass() throws IOException {
mantaClient.putDirectory(testPathPrefix, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,27 @@

import static com.joyent.manta.exception.MantaErrorCode.RESOURCE_NOT_FOUND_ERROR;

@Test
@Test(groups = { "encryptable" })
public class MantaClientPutIT {

private static final String TEST_DATA = "EPISODEII_IS_BEST_EPISODE";
private static final String TEST_FILENAME = "Master-Yoda.jpg";

private MantaClient mantaClient;
private final MantaClient mantaClient;

private String testPathPrefix;
private final String testPathPrefix;

@BeforeClass
@Parameters({"usingEncryption"})
public void beforeClass(@Optional Boolean usingEncryption) throws IOException {
@Parameters({"encryptionCipher"})
public MantaClientPutIT(final @Optional String encryptionCipher) throws IOException {
// Let TestNG configuration take precedence over environment variables
ConfigContext config = new IntegrationTestConfigContext(usingEncryption);
ConfigContext config = new IntegrationTestConfigContext(encryptionCipher);

mantaClient = new MantaClient(config);
testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName());
}

@BeforeClass
public void beforeClass() throws IOException {
mantaClient.putDirectory(testPathPrefix, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
*/
package com.joyent.manta.client;

import com.joyent.manta.config.*;
import com.joyent.manta.config.BaseChainedConfigContext;
import com.joyent.manta.config.ConfigContext;
import com.joyent.manta.config.EncryptionAuthenticationMode;
import com.joyent.manta.config.IntegrationTestConfigContext;
import com.joyent.manta.config.SettableConfigContext;
import com.joyent.manta.http.MantaHttpHeaders;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -23,7 +27,7 @@
import java.nio.charset.Charset;
import java.util.UUID;

@Test
@Test(groups = {"encryptable"})
public class MantaClientRangeIT {
private static final String TEST_DATA =
"A SERGEANT OF THE LAW, wary and wise, " +
Expand All @@ -49,16 +53,15 @@ public class MantaClientRangeIT {
"Girt with a seint* of silk, with barres small; " +
"Of his array tell I no longer tale.";

private MantaClient mantaClient;
private ConfigContext config;
private final MantaClient mantaClient;
private final ConfigContext config;

private String testPathPrefix;
private final String testPathPrefix;

@BeforeClass
@Parameters({"usingEncryption"})
public void beforeClass(@Optional Boolean usingEncryption) throws IOException {
@Parameters({"encryptionCipher"})
public MantaClientRangeIT(final @Optional String encryptionCipher) throws IOException {
// Let TestNG configuration take precedence over environment variables
SettableConfigContext<BaseChainedConfigContext> config = new IntegrationTestConfigContext(usingEncryption);
SettableConfigContext<BaseChainedConfigContext> config = new IntegrationTestConfigContext(encryptionCipher);;

// Range request have to be in optional authentication mode
if (config.isClientEncryptionEnabled()) {
Expand All @@ -68,6 +71,10 @@ public void beforeClass(@Optional Boolean usingEncryption) throws IOException {
mantaClient = new MantaClient(config);
this.config = config;
testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName());
}

@BeforeClass
public void beforeClass() throws IOException {
mantaClient.putDirectory(testPathPrefix, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,18 @@
*
* @author <a href="https://github.com/dekobon">Elijah Zupancic</a>
*/
@Test(groups = { "seekable" })
@Test(groups = {"seekable", "encryptable"})
public class MantaClientSeekableByteChannelIT {
private static final String TEST_DATA = "EPISODEII_IS_BEST_EPISODE";

private MantaClient mantaClient;
private final MantaClient mantaClient;

private String testPathPrefix;
private final String testPathPrefix;

@Parameters({"encryptionCipher"})
public MantaClientSeekableByteChannelIT(final @Optional String encryptionCipher) throws IOException {

@BeforeClass
@Parameters({"usingEncryption"})
public void beforeClass(@Optional Boolean usingEncryption) throws IOException {

// Let TestNG configuration take precedence over environment variables
SettableConfigContext<BaseChainedConfigContext> config = new IntegrationTestConfigContext(usingEncryption);
SettableConfigContext<BaseChainedConfigContext> config = new IntegrationTestConfigContext(encryptionCipher);

// Range request have to be in optional authentication mode
if (config.isClientEncryptionEnabled()) {
Expand All @@ -60,6 +57,10 @@ public void beforeClass(@Optional Boolean usingEncryption) throws IOException {

mantaClient = new MantaClient(config);
testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName());
}

@BeforeClass
public void beforeClass() throws IOException {
mantaClient.putDirectory(testPathPrefix, true);
}

Expand All @@ -68,7 +69,6 @@ public void afterClass() throws IOException {
IntegrationTestConfigContext.cleanupTestDirectory(mantaClient, testPathPrefix);
}

@Test
public final void seekableByteSize() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand All @@ -82,7 +82,6 @@ public final void seekableByteSize() throws IOException {
}
}

@Test
public final void getAllSeekableBytes() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand All @@ -94,7 +93,6 @@ public final void getAllSeekableBytes() throws IOException {
}
}

@Test
public final void getAllSeekableBytesAtPosition() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand All @@ -109,7 +107,6 @@ public final void getAllSeekableBytesAtPosition() throws IOException {
}
}

@Test
public final void readFromDifferentPositions() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand All @@ -133,7 +130,6 @@ public final void readFromDifferentPositions() throws IOException {
}
}

@Test
public final void readAllSeekableBytesFromPositionAsInputStream() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand All @@ -157,7 +153,6 @@ public final void readAllSeekableBytesFromPositionAsInputStream() throws IOExcep
}
}

@Test
public final void skipUsingInputStream() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand Down Expand Up @@ -223,7 +218,6 @@ public final void attemptToWrite() throws IOException {
}
}

@Test( groups = { "seekable" })
public final void getFromForwardPosition() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand All @@ -241,7 +235,6 @@ public final void getFromForwardPosition() throws IOException {
}
}

@Test( groups = { "seekable" } )
public final void getFromBaseChannelThenForwardPosition() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand All @@ -262,7 +255,6 @@ public final void getFromBaseChannelThenForwardPosition() throws IOException {
}
}

@Test( groups = { "seekable" } )
public final void getFromForwardPositionThenBackwardPosition() throws IOException {
final String name = UUID.randomUUID().toString();
final String path = testPathPrefix + name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

import java.io.IOException;
Expand All @@ -37,11 +35,10 @@ public class MantaDirectoryListingIteratorIT {
private String testPathPrefix;

@BeforeClass
@Parameters({"usingEncryption"})
public void beforeClass(@Optional Boolean usingEncryption) throws IOException {
public void beforeClass() throws IOException {

// Let TestNG configuration take precedence over environment variables
config = new IntegrationTestConfigContext(usingEncryption);
ConfigContext config = new IntegrationTestConfigContext();

mantaClient = new MantaClient(config);
testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName());
Expand Down
Loading