Skip to content

Commit 14a3e5f

Browse files
committed
OCSP test should only run when OCSP system property is set
JAVA-3598
1 parent c932528 commit 14a3e5f

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

driver-sync/src/test/functional/com/mongodb/client/OcspTest.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,38 @@
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+
117
package com.mongodb.client;
218

3-
import com.mongodb.MongoException;
419
import com.mongodb.MongoTimeoutException;
520
import org.bson.BsonDocument;
621
import org.bson.BsonInt32;
22+
import org.junit.Before;
723
import org.junit.Test;
824

925
import static com.mongodb.ClusterFixture.getOcspShouldSucceed;
10-
26+
import static java.security.Security.getProperty;
1127
import static org.junit.Assert.fail;
28+
import static org.junit.Assume.assumeTrue;
1229

1330
public class OcspTest {
31+
@Before
32+
public void setUp() {
33+
assumeTrue(canRunTests());
34+
}
35+
1436
@Test
1537
public void testTLS() {
1638
String uri = "mongodb://localhost/?serverSelectionTimeoutMS=2000&tls=true";
@@ -22,4 +44,8 @@ public void testTLS() {
2244
}
2345
}
2446
}
47+
48+
private boolean canRunTests() {
49+
return getProperty("ocsp.enable") != null && getProperty("ocsp.enable").equals("true");
50+
}
2551
}

0 commit comments

Comments
 (0)