Skip to content

Commit 5e1fbe1

Browse files
committed
Merge pull request #427
2 parents 1fd77a1 + 81cc4fe commit 5e1fbe1

File tree

1 file changed

+58
-27
lines changed

1 file changed

+58
-27
lines changed

CONTRIBUTING.md

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,94 @@
11
# Contributing to the PHP Driver for MongoDB
22

3-
43
## Building from VCS (GitHub)
54

6-
Developers who would like to contribute to the driver will need to build it from VCS
7-
like so:
5+
Developers who would like to contribute to the driver will need to build it from
6+
VCS. The repository may be initialized with:
87

98
```
10-
$ git clone https://github.com/mongodb/mongo-php-driver.git phongo
11-
$ cd phongo
9+
$ git clone https://github.com/mongodb/mongo-php-driver.git
10+
$ cd mongo-php-driver
1211
$ git submodule update --init
13-
$ phpize
14-
$ ./configure --enable-developer-flags
15-
$ make -j8 all
12+
```
13+
14+
The following script may be used to build the driver:
15+
16+
```
17+
#!/bin/sh
18+
19+
phpize > /dev/null && \
20+
./configure --enable-developer-flags > /dev/null && \
21+
make clean > /dev/null && make all > /dev/null && make install
1622
```
1723

1824
## Testing
1925

20-
The test suites expects to find `PHONGO-SERVERS.json` in the system temp directory (typically `/tmp`).
21-
This file should contain JSON object with MONGODB URIs, similar to the following template
26+
The test suites expects to find `PHONGO-SERVERS.json` in the system temp
27+
directory (e.g. `/tmp`). This file should contain JSON object with MONGODB URIs,
28+
similar to the following template:
2229

2330
```
2431
{
2532
"STANDALONE": "mongodb:\/\/192.168.112.10:2000",
33+
"STANDALONE_24": "mongodb:\/\/192.168.112.10:2500",
34+
"STANDALONE_26": "mongodb:\/\/192.168.112.10:2600",
35+
"STANDALONE_30": "mongodb:\/\/192.168.112.10:2700",
2636
"STANDALONE_SSL": "mongodb:\/\/192.168.112.10:2100",
2737
"STANDALONE_AUTH": "mongodb:\/\/root:[email protected]:2200\/?authSource=admin",
2838
"STANDALONE_X509": "mongodb:\/\/C=US,ST=New York,L=New York City,O=MongoDB,OU=KernelUser,[email protected]:2300\/?authSource=$external&authMechanism=MONGODB-X509",
2939
"STANDALONE_PLAIN": "mongodb:\/\/root:[email protected]:2400\/?authSource=admin",
30-
"REPLICASET": "mongodb:\/\/192.168.112.10:3000,192.168.112.10:3001,192.168.112.10:3002\/?replicaSet=REPLICASET"
40+
"REPLICASET": "mongodb:\/\/192.168.112.10:3000,192.168.112.10:3001,192.168.112.10:3002\/?replicaSet=REPLICASET",
41+
"REPLICASET_30": "mongodb:\/\/192.168.112.10:3100,192.168.112.10:3101,192.168.112.10:3102\/?replicaSet=REPLICASET_30"
3142
}
3243
```
33-
The location of this PHONGO-SERVERS.json file can be configured by exporting
34-
`PHONGO_SERVERS` environment variable with a absolute path to the json configuration file.
3544

36-
Alternatively, we provide, and use, [Vagrant](https://www.vagrantup.com/) to spin up handful of VMs
37-
where we setup and configure MongoDB according to our needs.
38-
This is the preferred way of creating PHONGO-SERVERS.json and running the test suite.
45+
The location of this `PHONGO-SERVERS.json` file can be configured by exporting a
46+
`PHONGO_SERVERS` environment variable with the absolute path to the JSON
47+
configuration file.
3948

49+
Our test suite also includes scripts to configure the necessary test environment
50+
with [Vagrant](https://www.vagrantup.com/) and
51+
[Mongo Orchestration](https://github.com/10gen/mongo-orchestration). This is the
52+
preferred way of creating `PHONGO-SERVERS.json` and running the test suite:
4053

4154
```
42-
$ make vm # requires vagrant (www.vagrantup.com)
43-
$ make test-bootstrap # Spins up mongod's in the virtual machines
55+
$ make vm # Starts the test VMs with Vagrant
56+
$ make test-bootstrap # Starts the mongod servers within the test VM
4457
```
4558

46-
The `test-bootstrap` make target will then generate the required `PHONGO-SERVERS.json`.
47-
59+
The `test-bootstrap` make target also generates the required
60+
`PHONGO-SERVERS.json` file.
4861

49-
To execute the test suite:
62+
The `test` make target may be used to execute the test suite:
5063

5164
```
52-
$ make test # Executes the test suite against the virtual machines
65+
$ make test # Executes the test suite against the VMs
5366
```
5467

55-
The bundled [Vagrantfile](Vagrantfile) also contains few other (growing) list of VMs
56-
that can be provisioned to execute the test suite on various platforms.
68+
### Mongo Orchestration
5769

58-
These are automatically executed by the `make distcheck`, which will package a new PECL archive,
59-
spin up the various operating systems, install the newly packaged archive, and execute
60-
the test suite.
70+
Some tests interact directly with Mongo Orchestration to start their own servers
71+
for cluster testing (e.g. replica set failovers). These tests depend on
72+
`MONGODB_ORCHESTRATION_HOST` and `MONGODB_ORCHESTRATION_PORT` environment
73+
variables.
74+
75+
By default, these tests will use the Mongo Orchestration instance within the
76+
test VM.
77+
78+
### Restarting Mongo Orchestration
79+
80+
If something goes awry in the test VM, it may be helpful to start the VM and
81+
Mongo Orchestration with the following script:
82+
83+
```
84+
#!/bin/sh
85+
86+
rm -f /tmp/PHONGO-SERVERS.json
87+
vagrant reload mo
88+
vagrant ssh mo -c 'sudo rm /home/vagrant/server.pid'
89+
vagrant ssh mo -c 'sudo mongo-orchestration -f mongo-orchestration-config.json -b 192.168.112.10 --enable-majority-read-concern start'
90+
make test-bootstrap
91+
```
6192

6293
## Releasing
6394

0 commit comments

Comments
 (0)