Skip to content

Commit f2ddea4

Browse files
committed
Merge pull request #715
2 parents 02bd585 + 37c8e99 commit f2ddea4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+22625
-62
lines changed

.travis.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ addons:
55
apt:
66
packages:
77
- gdb
8+
- libcurl3
9+
- libgssapi-krb5-2
10+
- libkrb5-dbg
11+
- libldap-2.4-2
12+
- libpcap0.8
13+
- libsasl2-2
14+
- snmp
15+
- openssl
816

917
cache:
1018
directories:
@@ -17,7 +25,7 @@ env:
1725
- DRIVER_VERSION=1.7.0
1826
# TODO: remove once a 1.7 driver release has been tagged
1927
- DRIVER_BRANCH="master"
20-
- SERVER_DISTRO=ubuntu1604
28+
- SERVER_DISTRO=enterprise-ubuntu1604
2129
- SERVER_VERSION=4.2.0
2230
- DEPLOYMENT=STANDALONE
2331
- COMPOSER_OPTIONS=
@@ -65,7 +73,7 @@ jobs:
6573
php: "7.0"
6674
dist: trusty
6775
env:
68-
- SERVER_DISTRO=ubuntu1404
76+
- SERVER_DISTRO=enterprise-ubuntu1404
6977
- SERVER_VERSION=3.0.15
7078
- DEPLOYMENT=STANDALONE_OLD
7179
- stage: Test
@@ -131,7 +139,7 @@ jobs:
131139
before_install:
132140
- pip install "mongo-orchestration>=0.6.7,<1.0" --user `whoami`
133141
- export SERVER_FILENAME=mongodb-linux-x86_64-${SERVER_DISTRO}-${SERVER_VERSION}
134-
- wget -qO- http://fastdl.mongodb.org/linux/${SERVER_FILENAME}.tgz | tar xz
142+
- wget -qO- https://downloads.mongodb.com/linux/${SERVER_FILENAME}.tgz | tar xz
135143
- export PATH=${PWD}/${SERVER_FILENAME}/bin:${PATH}
136144
- mongod --version
137145
- mongo-orchestration --version

.travis/debug-core.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
if [ "${TRAVIS_OS_NAME}" != "osx" ]; then
3+
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
44
# https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html
55
echo "Cannot debug core files on macOS: ${1}"
66
exit 1

tests/FunctionalTestCase.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@
2626
use function is_object;
2727
use function is_string;
2828
use function key;
29+
use function ob_get_clean;
30+
use function ob_start;
2931
use function parse_url;
32+
use function phpinfo;
3033
use function preg_match;
34+
use function preg_quote;
35+
use function sprintf;
3136
use function version_compare;
37+
use const INFO_MODULES;
3238

3339
abstract class FunctionalTestCase extends TestCase
3440
{
@@ -375,6 +381,17 @@ protected function skipIfCausalConsistencyIsNotSupported()
375381
}
376382
}
377383

384+
protected function skipIfClientSideEncryptionIsNotSupported()
385+
{
386+
if (version_compare($this->getFeatureCompatibilityVersion(), '4.2', '<')) {
387+
$this->markTestSkipped('Client Side Encryption only supported on FCV 4.2 or higher');
388+
}
389+
390+
if ($this->getModuleInfo('libmongocrypt') === 'disabled') {
391+
$this->markTestSkipped('Client Side Encryption is not enabled in the MongoDB extension');
392+
}
393+
}
394+
378395
protected function skipIfTransactionsAreNotSupported()
379396
{
380397
if ($this->getPrimaryServer()->getType() === Server::TYPE_STANDALONE) {
@@ -420,6 +437,26 @@ private function disableFailPoints()
420437
}
421438
}
422439

440+
/**
441+
* @param string $row
442+
*
443+
* @return string|null
444+
*/
445+
private function getModuleInfo($row)
446+
{
447+
ob_start();
448+
phpinfo(INFO_MODULES);
449+
$info = ob_get_clean();
450+
451+
$pattern = sprintf('/^%s([\w ]+)$/m', preg_quote($row . ' => '));
452+
453+
if (preg_match($pattern, $info, $matches) !== 1) {
454+
return null;
455+
}
456+
457+
return $matches[1];
458+
}
459+
423460
/**
424461
* Checks if the failCommand command is supported on this server version
425462
*

tests/SpecTests/ChangeStreamsSpecTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class ChangeStreamsSpecTest extends FunctionalTestCase
2727
/**
2828
* Assert that the expected and actual command documents match.
2929
*
30-
* Note: this method may modify the $expected object.
31-
*
3230
* @param stdClass $expected Expected command document
3331
* @param stdClass $actual Actual command document
3432
*/
@@ -180,7 +178,7 @@ private function createChangeStream(stdClass $test)
180178

181179
switch ($test->target) {
182180
case 'client':
183-
return $context->client->watch($pipeline, $options);
181+
return $context->getClient()->watch($pipeline, $options);
184182
case 'database':
185183
return $context->getDatabase()->watch($pipeline, $options);
186184
case 'collection':
@@ -228,7 +226,7 @@ private function dropDatabasesAndCreateCollection($databaseName, $collectionName
228226
{
229227
$context = $this->getContext();
230228

231-
$database = $context->client->selectDatabase($databaseName);
229+
$database = $context->getClient()->selectDatabase($databaseName);
232230
$database->drop($context->defaultWriteOptions);
233231
$database->createCollection($collectionName, $context->defaultWriteOptions);
234232
}

0 commit comments

Comments
 (0)