Skip to content

Commit ea23e5d

Browse files
committed
PHPC-128: MO presets directory needs to be configurable
various other travis fixes, skipping etc
1 parent 0f73eaa commit ea23e5d

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ env:
1010
- TEST_PHP_ARGS="-q -s output.txt -g XFAIL,FAIL,BORK,WARN,LEAK,SKIP -x --show-diff"
1111
- REPORT_EXIT_STATUS=1
1212
- MONGODB_ORCHESTRATION="http://localhost:8889"
13-
- MONGO_ORCHESTRATION_REPO="git+git://github.com/mongodb/mongo-orchestration@master"
13+
- MONGODB_ORCHESTRATION_REPO="git+git://github.com/mongodb/mongo-orchestration@master"
14+
- MONGODB_ORCHESTRATION_PRESETS_ROOT=`pwd`
1415
- secure: uOPk40++5SqPwsvENvQXKy3sJmOYFoPxTSPpoafbus9teEqe3S0mXAv6leSUSH4K/vk1OoPFp2xjKRVkdBTeqTElna1DDWOuYlvli9PLSvyZ+b1bV+8Ap18BxqlYhd3tHrY7tIliOsh6dZplWF9GyUm9DWBZ/80uKUidh/Brg/Y=
1516
- secure: "pfGVPucvgcgcefhtzAVeejlpOtn4TnAqJSTM8mJkBl36KdU9P7hMuD3czQ4drWgzZ373/VT5UVhLu/HNsdbW0YBTeqPKJ4YNjqVVLytI8xT7y2Lw9l+I7o93j98TMgAoo8nVRmp/E4D6yutbKK1eddrcmf899R1iJbw8v8d1Ht8="
1617

1718
before_install:
1819
- sudo pip install cpp-coveralls
19-
- sudo pip install ${MONGO_ORCHESTRATION_REPO}
20+
- sudo pip install ${MONGODB_ORCHESTRATION_REPO}
2021
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
2122
- echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
2223
- sudo apt-get update

scripts/start-servers.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function lap() {
1515
$host = "http://192.168.112.10:8889";
1616
}
1717

18-
$orch = new Mongo\Orchestration($host);
18+
$orch = new Mongo\Orchestration($host, getenv("MONGODB_ORCHESTRATION_PRESETS_ROOT"));
1919
if (!$orch->ping()) {
2020
var_dump($host);
2121
system("pwd");
@@ -29,7 +29,12 @@ function lap() {
2929
$orch->stopAll();
3030

3131
$res = $orch->start("standalone.json");
32-
printf("Standalone running on:\t\t\t(took: %.2f secs)\t%s\n", lap(), $res);
32+
if ($res) {
33+
printf("Standalone running on:\t\t\t(took: %.2f secs)\t%s\n", lap(), $res);
34+
} else {
35+
printf("Failed starting standalone.json after %.2f secs\n", lap());
36+
exit(1);
37+
}
3338

3439
if (getenv("TRAVIS")) {
3540
echo "Skipping special nodes on travis\n";

tests/utils/basic-skipif.inc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ require __DIR__ . "/" . "basic.inc";
88
$testdir = basename(dirname(realpath($_SERVER["SCRIPT_FILENAME"])));
99

1010
switch($testdir){
11+
case "replicaset":
1112
case "connect":
12-
if (!$orch->ping()) {
13-
exit("skip these tests in $testdir require Mongo Orchestration");
13+
if (!$orch->ping() || getenv("TRAVIS") || !MONGODB_STANDALONE_AUTH_URI) {
14+
exit("skip these tests in $testdir require Mongo Orchestration + vagrant");
1415
}
1516
break;
1617
}

tests/utils/basic.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (!($host = getenv("MONGODB_ORCHESTRATION"))) {
77
$host = "http://192.168.112.10:8889";
88
}
99

10-
$orch = new Mongo\Orchestration($host);
10+
$orch = new Mongo\Orchestration($host, getenv("MONGODB_ORCHESTRATION_PRESETS_ROOT"));
1111
if ($orch->ping()) {
1212
$consts = array(
1313
"MONGODB_URI" => $orch->getURI("standalone.json"),

tests/utils/orchestration.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ class Orchestration {
66
protected $baseuri;
77
protected $conf;
88

9-
function __construct($baseuri) {
9+
function __construct($baseuri, $prefix = NULL) {
1010
$this->baseuri = $baseuri;
1111
$this->conf = array(
1212
"timeout" => 60,
13+
"prefix" => $prefix ?: "/phongo/",
1314
);
1415
}
1516

@@ -47,7 +48,7 @@ function startRS($preset) {
4748
throw new \Exception("Cannot file $file in $relative");
4849
}
4950

50-
$retval = $this->post("replica_sets", ["preset" => "/phongo/$file"]);
51+
$retval = $this->post("replica_sets", ["preset" => $this->getPrefix() . "$file"]);
5152
return $this->_returnURIIfAlive($retval);
5253
}
5354
function start($preset) {
@@ -57,7 +58,7 @@ function start($preset) {
5758
throw new \Exception("Cannot file $file in $relative");
5859
}
5960

60-
$retval = $this->post("servers", ["preset" => "/phongo/$file"]);
61+
$retval = $this->post("servers", ["preset" => $this->getPrefix() . "$file"]);
6162
return $this->_returnURIIfAlive($retval);
6263
}
6364

@@ -103,6 +104,9 @@ function setTimeout($t) {
103104
function getTimeout() {
104105
return $this->conf["timeout"];
105106
}
107+
function getPrefix() {
108+
return $this->conf["prefix"] . "/";
109+
}
106110

107111

108112

0 commit comments

Comments
 (0)