Skip to content

Commit 9618edf

Browse files
committed
PHPC-1060: Run Atlas connectivity tests on Evergreen
1 parent 4d16c47 commit 9618edf

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

.evergreen/atlas-uris.txt.enc

1.84 KB
Binary file not shown.

.evergreen/config.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ functions:
5050
# Applies the submitted patch, if any
5151
# Deprecated. Should be removed. But still needed for certain agents (ZAP)
5252
- command: git.apply_patch
53-
# Make an evergreen exapanstion file with dynamic values
53+
# Make an evergreen expansion file with dynamic values
5454
- command: shell.exec
5555
params:
5656
working_dir: "src"
@@ -356,7 +356,7 @@ functions:
356356
working_dir: "src"
357357
script: |
358358
${PREPARE_SHELL}
359-
SSL=${SSL} MONGODB_URI="${MONGODB_URI}" sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
359+
TESTS=${TESTS} SSL=${SSL} MONGODB_URI="${MONGODB_URI}" sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
360360
361361
"cleanup":
362362
- command: shell.exec
@@ -412,6 +412,12 @@ functions:
412412
# Don't use ${file} syntax here because evergreen treats it as an empty expansion.
413413
[ -f "$file" ] && sh $file || echo "$file not available, skipping"
414414
415+
"decrypt atlas URI list":
416+
- command: shell.exec
417+
params:
418+
script: |
419+
openssl aes-256-cbc -S "${encrypted_uris_salt}" -K "${encrypted_uris_key}" -iv "${encrypted_uris_iv}" -in ${PROJECT_DIRECTORY}/.evergreen/atlas-uris.txt.enc -out ${PROJECT_DIRECTORY}/.evergreen/atlas-uris.txt -d
420+
415421
pre:
416422
- func: "fetch source"
417423
- func: "prepare resources"
@@ -566,6 +572,15 @@ tasks:
566572
CONFIG: "cluster_replset"
567573
- func: "run tests"
568574

575+
- name: "test-atlas"
576+
tags: ["atlas"]
577+
commands:
578+
- func: "compile driver"
579+
- func: "decrypt atlas URI list"
580+
- func: "run tests"
581+
vars:
582+
TESTS: "tests/atlas.phpt"
583+
569584
# }}}
570585

571586

@@ -757,3 +772,9 @@ buildvariants:
757772
- name: "test-standalone"
758773
- name: "test-replicaset"
759774
- name: "test-sharded-rs"
775+
776+
- matrix_name: "atlas-connectivity-tests"
777+
matrix_spec: { "os-php7": "debian92-test", "php-versions": "7.3" }
778+
display_name: "Atlas Connectivity tests"
779+
tasks:
780+
- name: "test-atlas"

.evergreen/run-tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set -o errexit # Exit the script with error if any of the commands fail
1010
AUTH=${AUTH:-noauth}
1111
SSL=${SSL:-nossl}
1212
MONGODB_URI=${MONGODB_URI:-}
13+
TESTS=${TESTS:-}
1314

1415
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
1516
[ -z "$MARCH" ] && MARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
@@ -25,7 +26,7 @@ echo "Running $AUTH tests, connecting to $MONGODB_URI"
2526
# Run the tests, and store the results in a Evergreen compatible JSON results file
2627
case "$OS" in
2728
*)
28-
TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test
29+
TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test TESTS=$TESTS
2930
;;
3031
esac
3132

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ php.ini
5151
!.travis.yml
5252
!.travis.scripts/
5353
!.evergreen
54+
.evergreen/atlas-uris.txt
5455

5556

5657
!scripts

tests/atlas.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
Atlas Connectivity Tests
33
--SKIPIF--
44
<?php
5-
if (!file_exists('.travis.scripts/atlas-uris.txt')) { echo "skip Atlas URIs not found\n"; }
6-
if (filesize('.travis.scripts/atlas-uris.txt') < 10) { echo "skip Atlas URI file empty\n"; }
5+
if (!file_exists('.evergreen/atlas-uris.txt')) { echo "skip Atlas URIs not found\n"; }
6+
if (filesize('.evergreen/atlas-uris.txt') < 10) { echo "skip Atlas URI file empty\n"; }
77
if ($_ENV['TESTS'] !== 'tests/atlas.phpt') { echo "skip Atlas tests not wanted\n"; }
88
?>
99
--FILE--
1010
<?php
11-
$urls = explode("\n", file_get_contents('.travis.scripts/atlas-uris.txt'));
11+
$urls = explode("\n", file_get_contents('.evergreen/atlas-uris.txt'));
1212

1313
$isMasterCmd = new \MongoDB\Driver\Command(['isMaster' => 1]);
1414
$query = new \MongoDB\Driver\Query([]);
@@ -37,5 +37,11 @@ PASS
3737
PASS
3838
PASS
3939
PASS
40+
PASS
41+
PASS
42+
PASS
43+
PASS
44+
PASS
45+
FAIL: %s
4046
FAIL: %s
4147
===DONE===

0 commit comments

Comments
 (0)