Skip to content

Commit

Permalink
[AD-829] Disable remote integration testing, by default. (#361)
Browse files Browse the repository at this point in the history
* [AD-829] Disable remote integration testing, by default.

* Commit Code Coverage Badge

Co-authored-by: birschick-bq <[email protected]>
  • Loading branch information
Bruce Irschick and birschick-bq authored Jun 30, 2022
1 parent 16f313d commit 1167d8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 30 deletions.
25 changes: 5 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,14 @@ artifacts {

test {
useJUnitPlatform {
if (project.hasProperty('runRemoteIntegrationTests') && project.property('runRemoteIntegrationTests') == 'false') {
environment "connectionString", project.CONNECTION_STRING_LOCAL
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE"
excludeTags 'remote-integration'
} else {
environment "connectionString", project.CONNECTION_STRING_REMOTE
if (project.hasProperty('runRemoteIntegrationTests') && project.property('runRemoteIntegrationTests') == 'true') {
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE,DOCUMENTDB40_SSH_TUNNEL"
excludeTags 'local-integration'
} else {
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE"
excludeTags 'remote-integration'
}
}
}
Expand Down Expand Up @@ -401,16 +399,3 @@ signing {
sign publishing.publications.mavenJava
}

test {
useJUnitPlatform {
if (project.hasProperty('runRemoteIntegrationTests') && project.property('runRemoteIntegrationTests') == 'false') {
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE"
excludeTags 'remote-integration'
} else {
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE,DOCUMENTDB40_SSH_TUNNEL"
excludeTags 'local-integration'
}
}
}
6 changes: 2 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
org.gradle.warning.mode=all
CONNECTION_STRING_LOCAL=jdbc:documentdb://username:password@localhost/database
CONNECTION_STRING_REMOTE=jdbc:documentdb://username:password@remotehost/database
MAJOR_VERSION=1
MINOR_VERSION=2
PATCH_VERSION=5
APPLICATION_NAME=Amazon DocumentDB JDBC Driver
# Comment out if not creating a beta version
#BETA_VERSION=1
# Uncomment out next line to disable remote integration tests
#runRemoteIntegrationTests=false
# Uncomment out next line to enable remote integration tests
#runRemoteIntegrationTests=true
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class DocumentDbIntegrationTest {
@Tag("local-integration")
public void runLocalTest() {
Assertions.assertEquals(true, true);
final String connectionString = System.getenv("connectionString");
Assertions.assertNotNull(connectionString);
Assertions.assertTrue(Pattern.matches(".*localhost.*", connectionString));
final String configuredEnvironments = System.getenv("CONFIGURED_ENVIRONMENTS");
Assertions.assertNotNull(configuredEnvironments);
Assertions.assertFalse(Pattern.matches(".*DOCUMENTDB40_SSH_TUNNEL.*", configuredEnvironments));
}

/**
Expand All @@ -45,8 +45,8 @@ public void runLocalTest() {
@Tag("remote-integration")
public void runRemoteTest() {
Assertions.assertEquals(true, true);
final String connectionString = System.getenv("connectionString");
Assertions.assertNotNull(connectionString);
Assertions.assertTrue(Pattern.matches(".*remotehost.*", connectionString));
final String configuredEnvironments = System.getenv("CONFIGURED_ENVIRONMENTS");
Assertions.assertNotNull(configuredEnvironments);
Assertions.assertTrue(Pattern.matches(".*DOCUMENTDB40_SSH_TUNNEL.*", configuredEnvironments));
}
}

0 comments on commit 1167d8f

Please sign in to comment.