Skip to content

Commit bc76708

Browse files
committed
Remove flaky tests that depends on the profile collection
These tests fail frequently on Evergreen, and as we have unit tests that prove that the app name is included in the client metadata document, having additional integration tests that prove that the app name actually made it to the server are nice to have but not essential. JAVA-3399
1 parent 99e1ede commit bc76708

File tree

2 files changed

+1
-67
lines changed

2 files changed

+1
-67
lines changed

driver-async/src/test/functional/com/mongodb/async/client/MongoClientsSpecification.groovy

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616

1717
package com.mongodb.async.client
1818

19-
2019
import com.mongodb.MongoCompressor
2120
import com.mongodb.MongoCredential
22-
import com.mongodb.MongoDriverInformation
2321
import com.mongodb.ReadConcern
2422
import com.mongodb.ServerAddress
2523
import com.mongodb.WriteConcern
@@ -32,12 +30,8 @@ import static com.mongodb.ClusterFixture.connectionString
3230
import static com.mongodb.ClusterFixture.getCredentialList
3331
import static com.mongodb.ClusterFixture.getSslSettings
3432
import static com.mongodb.ClusterFixture.isNotAtLeastJava8
35-
import static com.mongodb.ClusterFixture.isStandalone
36-
import static com.mongodb.ClusterFixture.serverVersionAtLeast
3733
import static com.mongodb.ReadPreference.primary
3834
import static com.mongodb.ReadPreference.secondaryPreferred
39-
import static com.mongodb.async.client.Fixture.getMongoClientBuilderFromConnectionString
40-
import static com.mongodb.async.client.TestHelper.run
4135
import static java.util.concurrent.TimeUnit.MILLISECONDS
4236

4337
class MongoClientsSpecification extends FunctionalSpecification {
@@ -223,35 +217,4 @@ class MongoClientsSpecification extends FunctionalSpecification {
223217
'mongodb://localhost/?compressors=zlib' | [MongoCompressor.createZlibCompressor()]
224218
'mongodb://localhost/?compressors=zstd' | [MongoCompressor.createZstdCompressor()]
225219
}
226-
227-
@IgnoreIf({ !serverVersionAtLeast(3, 4) || !isStandalone() })
228-
def 'application name should appear in the system.profile collection'() {
229-
given:
230-
def appName = 'appName1'
231-
def driverInfo = MongoDriverInformation.builder().driverName('myDriver').driverVersion('42').build()
232-
def client = MongoClients.create(getMongoClientBuilderFromConnectionString().applicationName(appName).build(), driverInfo)
233-
def database = client.getDatabase(getDatabaseName())
234-
def collection = database.getCollection(getCollectionName())
235-
236-
def profileCollection = database.getCollection('system.profile')
237-
run(profileCollection.&drop)
238-
run(database.&runCommand, new Document('profile', 2))
239-
240-
when:
241-
run(collection.&count)
242-
243-
then:
244-
Document profileDocument = run(profileCollection.find().&first)
245-
profileDocument.get('appName') == appName
246-
247-
cleanup:
248-
if (database != null) {
249-
run(database.&runCommand, new Document('profile', 0))
250-
}
251-
if (profileCollection != null) {
252-
run(profileCollection.&drop)
253-
}
254-
client?.close()
255-
}
256-
257220
}

driver-legacy/src/test/functional/com/mongodb/MongoClientsSpecification.groovy

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,13 @@ import com.mongodb.event.CommandFailedEvent
2222
import com.mongodb.event.CommandListener
2323
import com.mongodb.event.CommandStartedEvent
2424
import com.mongodb.event.CommandSucceededEvent
25-
import org.bson.Document
2625
import spock.lang.IgnoreIf
2726

28-
import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet
29-
import static com.mongodb.ClusterFixture.isStandalone
30-
import static com.mongodb.ClusterFixture.serverVersionAtLeast
3127
import static Fixture.getDefaultDatabaseName
3228
import static Fixture.getMongoClientURI
29+
import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet
3330

3431
class MongoClientsSpecification extends FunctionalSpecification {
35-
@IgnoreIf({ !serverVersionAtLeast(3, 4) || !isStandalone() })
36-
def 'application name should appear in the system.profile collection'() {
37-
given:
38-
def appName = 'appName1'
39-
def driverInfo = MongoDriverInformation.builder().driverName('myDriver').driverVersion('42').build()
40-
def client = new MongoClient(getMongoClientURI(MongoClientOptions.builder().applicationName(appName)), driverInfo)
41-
def database = client.getDatabase(getDatabaseName())
42-
def collection = database.getCollection(getCollectionName())
43-
44-
def profileCollection = database.getCollection('system.profile')
45-
profileCollection.drop()
46-
47-
database.runCommand(new Document('profile', 2))
48-
49-
when:
50-
collection.countDocuments()
51-
52-
then:
53-
Document profileDocument = profileCollection.find().first()
54-
profileDocument.get('appName') == appName
55-
56-
cleanup:
57-
database?.runCommand(new Document('profile', 0))
58-
profileCollection?.drop()
59-
client?.close()
60-
}
6132

6233
@IgnoreIf({ !isDiscoverableReplicaSet() })
6334
def 'should use server selector from MongoClientOptions'() {

0 commit comments

Comments
 (0)