Skip to content

Commit fd0b243

Browse files
committed
DATAMONGO-1411 - Enable MongoDB build on TravisCI.
Builds on TravisCI cause successful DNS reverse lookups for the used ServerAddresses so it's not reliable to check for the host part. Added missing author tags to the test. TravisCI supports as of now only MongoDB 2.4.2 when adding the MongoDB service to the config section. It's therefore required to upgrade the server. apt-get also starts the MongoDB server which is not obvious. Upgrade of profiles, removed promoted snapshot-versions, renamed mongo32-next to mongo32, added mongo33-next build profile. Original pull request: #358.
1 parent 8d96f62 commit fd0b243

File tree

3 files changed

+47
-11
lines changed

3 files changed

+47
-11
lines changed

.travis.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,29 @@ language: java
33
jdk:
44
- oraclejdk8
55

6-
services:
7-
- mongodb
6+
before_script:
7+
- mkdir mongo-data
8+
- mongod --version
89

910
env:
1011
matrix:
1112
- PROFILE=ci
1213
- PROFILE=mongo-next
14+
- PROFILE=mongo3
15+
- PROFILE=mongo3-next
16+
- PROFILE=mongo31
17+
- PROFILE=mongo32
18+
- PROFILE=mongo33-next
19+
20+
# Current MongoDB version is 2.4.2 as of 2016-04, see https://github.com/travis-ci/travis-ci/issues/3694
21+
# apt-get starts a MongoDB instance so it's not started using before_script
22+
addons:
23+
apt:
24+
sources:
25+
- mongodb-3.2-precise
26+
packages:
27+
- mongodb-org-server
28+
- mongodb-org-shell
1329

1430
sudo: false
1531

pom.xml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107

108108
<id>mongo-next</id>
109109
<properties>
110-
<mongo>2.14.0-SNAPSHOT</mongo>
110+
<mongo>2.15.0-SNAPSHOT</mongo>
111111
</properties>
112112

113113
<repositories>
@@ -148,16 +148,25 @@
148148

149149
<id>mongo31</id>
150150
<properties>
151-
<mongo>3.1.0</mongo>
151+
<mongo>3.1.1</mongo>
152152
</properties>
153153

154154
</profile>
155155

156156
<profile>
157157

158-
<id>mongo32-next</id>
158+
<id>mongo32</id>
159159
<properties>
160-
<mongo>3.2.0-SNAPSHOT</mongo>
160+
<mongo>3.2.2</mongo>
161+
</properties>
162+
163+
</profile>
164+
165+
<profile>
166+
167+
<id>mongo33-next</id>
168+
<properties>
169+
<mongo>3.3.0-SNAPSHOT</mongo>
161170
</properties>
162171

163172
<repositories>

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceReplicaSetTests.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2011-2012 the original author or authors.
2+
* Copyright 2011-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import static org.junit.Assert.*;
2121

2222
import java.net.InetAddress;
23+
import java.util.ArrayList;
2324
import java.util.List;
2425

2526
import org.junit.Ignore;
@@ -37,6 +38,13 @@
3738
import com.mongodb.Mongo;
3839
import com.mongodb.ServerAddress;
3940

41+
/**
42+
*
43+
* @author Mark Pollack
44+
* @author Oliver Gierke
45+
* @author Thomas Darimont
46+
* @author Mark Paluch
47+
*/
4048
@RunWith(SpringJUnit4ClassRunner.class)
4149
@ContextConfiguration
4250
public class MongoNamespaceReplicaSetTests {
@@ -70,10 +78,13 @@ public void testParsingWithPropertyPlaceHolder() throws Exception {
7078

7179
assertThat(replicaSetSeeds, is(notNullValue()));
7280
assertThat(replicaSetSeeds, hasSize(3));
73-
assertThat(
74-
replicaSetSeeds,
75-
hasItems(new ServerAddress("192.168.174.130", 27017), new ServerAddress("192.168.174.130", 27018),
76-
new ServerAddress("192.168.174.130", 27019)));
81+
82+
List<Integer> ports = new ArrayList<Integer>();
83+
for (ServerAddress replicaSetSeed : replicaSetSeeds) {
84+
ports.add(replicaSetSeed.getPort());
85+
}
86+
87+
assertThat(ports, hasItems(27017, 27018, 27019));
7788
}
7889

7990
@Test

0 commit comments

Comments
 (0)