Skip to content

Commit 094e424

Browse files
committed
Replaced legacy InitialDnsSeedlistTest with a connectivity test
JAVA-3251
1 parent 0667f30 commit 094e424

File tree

4 files changed

+42
-216
lines changed

4 files changed

+42
-216
lines changed

.evergreen/.evg.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ functions:
303303
working_dir: "src"
304304
script: |
305305
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
306-
JDK="jdk8" .evergreen/run-connectivity-tests.sh '${atlas_free_tier_uri}' '${atlas_replica_set_uri}' '${atlas_sharded_uri}' '${atlas_tls_v11_uri}' '${atlas_tls_v12_uri}'
307-
306+
JDK="jdk8" .evergreen/run-connectivity-tests.sh '${atlas_free_tier_uri}' '${atlas_replica_set_uri}' '${atlas_sharded_uri}' '${atlas_tls_v11_uri}' '${atlas_tls_v12_uri}' '${atlas_free_tier_uri_srv}' '${atlas_replica_set_uri_srv}' '${atlas_sharded_uri_srv}' '${atlas_tls_v11_uri_srv}' '${atlas_tls_v12_uri_srv}'
307+
308308
"publish snapshot":
309309
- command: shell.exec
310310
type: test

.evergreen/run-connectivity-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ export JAVA_HOME="/opt/java/jdk9"
2525
for MONGODB_URI in $@; do
2626
./gradlew -PjdkHome=/opt/java/${JDK} -Dorg.mongodb.test.uri=${MONGODB_URI} --stacktrace --info -Dtest.single=ConnectivityTest --rerun-tasks driver-sync:test
2727
./gradlew -PjdkHome=/opt/java/${JDK} -Dorg.mongodb.test.uri=${MONGODB_URI} --stacktrace --info -Dtest.single=ConnectivityTest --rerun-tasks driver-async:test
28+
./gradlew -PjdkHome=/opt/java/${JDK} -Dorg.mongodb.test.uri=${MONGODB_URI} --stacktrace --info -Dtest.single=ConnectivityTest --rerun-tasks driver-legacy:test
2829
done
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2008-present MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.mongodb;
18+
19+
import org.bson.Document;
20+
import org.junit.Test;
21+
22+
public class ConnectivityTest {
23+
24+
// the test succeeds if no exception is thrown, and fail otherwise
25+
@Test
26+
public void testConnectivity() {
27+
MongoClient client = Fixture.getMongoClient();
28+
29+
try {
30+
// test that a command that doesn't require auth completes normally
31+
client.getDatabase("admin").runCommand(new Document("ismaster", 1));
32+
33+
// test that a command that requires auth completes normally
34+
client.getDatabase("test").getCollection("test").estimatedDocumentCount();
35+
} finally {
36+
client.close();
37+
}
38+
}
39+
}

driver-legacy/src/test/functional/com/mongodb/InitialDnsSeedlistDiscoveryTest.java

Lines changed: 0 additions & 214 deletions
This file was deleted.

0 commit comments

Comments
 (0)