Skip to content

Commit 1167d8f

Browse files
Bruce Irschickbirschick-bq
andauthored
[AD-829] Disable remote integration testing, by default. (#361)
* [AD-829] Disable remote integration testing, by default. * Commit Code Coverage Badge Co-authored-by: birschick-bq <birschick-bq@users.noreply.github.com>
1 parent 16f313d commit 1167d8f

File tree

3 files changed

+13
-30
lines changed

3 files changed

+13
-30
lines changed

build.gradle

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,14 @@ artifacts {
105105

106106
test {
107107
useJUnitPlatform {
108-
if (project.hasProperty('runRemoteIntegrationTests') && project.property('runRemoteIntegrationTests') == 'false') {
109-
environment "connectionString", project.CONNECTION_STRING_LOCAL
110-
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
111-
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE"
112-
excludeTags 'remote-integration'
113-
} else {
114-
environment "connectionString", project.CONNECTION_STRING_REMOTE
108+
if (project.hasProperty('runRemoteIntegrationTests') && project.property('runRemoteIntegrationTests') == 'true') {
115109
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
116110
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE,DOCUMENTDB40_SSH_TUNNEL"
117111
excludeTags 'local-integration'
112+
} else {
113+
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
114+
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE"
115+
excludeTags 'remote-integration'
118116
}
119117
}
120118
}
@@ -401,16 +399,3 @@ signing {
401399
sign publishing.publications.mavenJava
402400
}
403401

404-
test {
405-
useJUnitPlatform {
406-
if (project.hasProperty('runRemoteIntegrationTests') && project.property('runRemoteIntegrationTests') == 'false') {
407-
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
408-
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE"
409-
excludeTags 'remote-integration'
410-
} else {
411-
// Ensure to match the enumeration name exactly from DocumentDbTestEnvironmentType.
412-
environment "CONFIGURED_ENVIRONMENTS", "MONGODB40_FLAPDOODLE,DOCUMENTDB40_SSH_TUNNEL"
413-
excludeTags 'local-integration'
414-
}
415-
}
416-
}

gradle.properties

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
org.gradle.warning.mode=all
2-
CONNECTION_STRING_LOCAL=jdbc:documentdb://username:password@localhost/database
3-
CONNECTION_STRING_REMOTE=jdbc:documentdb://username:password@remotehost/database
42
MAJOR_VERSION=1
53
MINOR_VERSION=2
64
PATCH_VERSION=5
75
APPLICATION_NAME=Amazon DocumentDB JDBC Driver
86
# Comment out if not creating a beta version
97
#BETA_VERSION=1
10-
# Uncomment out next line to disable remote integration tests
11-
#runRemoteIntegrationTests=false
8+
# Uncomment out next line to enable remote integration tests
9+
#runRemoteIntegrationTests=true

src/test/java/software/amazon/documentdb/jdbc/DocumentDbIntegrationTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public class DocumentDbIntegrationTest {
3333
@Tag("local-integration")
3434
public void runLocalTest() {
3535
Assertions.assertEquals(true, true);
36-
final String connectionString = System.getenv("connectionString");
37-
Assertions.assertNotNull(connectionString);
38-
Assertions.assertTrue(Pattern.matches(".*localhost.*", connectionString));
36+
final String configuredEnvironments = System.getenv("CONFIGURED_ENVIRONMENTS");
37+
Assertions.assertNotNull(configuredEnvironments);
38+
Assertions.assertFalse(Pattern.matches(".*DOCUMENTDB40_SSH_TUNNEL.*", configuredEnvironments));
3939
}
4040

4141
/**
@@ -45,8 +45,8 @@ public void runLocalTest() {
4545
@Tag("remote-integration")
4646
public void runRemoteTest() {
4747
Assertions.assertEquals(true, true);
48-
final String connectionString = System.getenv("connectionString");
49-
Assertions.assertNotNull(connectionString);
50-
Assertions.assertTrue(Pattern.matches(".*remotehost.*", connectionString));
48+
final String configuredEnvironments = System.getenv("CONFIGURED_ENVIRONMENTS");
49+
Assertions.assertNotNull(configuredEnvironments);
50+
Assertions.assertTrue(Pattern.matches(".*DOCUMENTDB40_SSH_TUNNEL.*", configuredEnvironments));
5151
}
5252
}

0 commit comments

Comments
 (0)