Skip to content

PHPC-2090 and PHPC-2053: Add 5.0 load balancer testing #1321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ functions:
working_dir: "src"
script: |
${PREPARE_SHELL}
MOCK_SERVICE_ID=${MOCK_SERVICE_ID} API_VERSION=${API_VERSION} TESTS=${TESTS} SSL=${SSL} MONGODB_URI="${MONGODB_URI}${APPEND_URI}" sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
API_VERSION=${API_VERSION} TESTS=${TESTS} SSL=${SSL} MONGODB_URI="${MONGODB_URI}${APPEND_URI}" sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh

"cleanup":
- command: shell.exec
Expand Down Expand Up @@ -1239,8 +1239,7 @@ buildvariants:
- name: "test-requireApiVersion"

- matrix_name: "test-loadBalanced"
# TODO: Add "5.2" server version alongside "latest" following its GA release
matrix_spec: { "os": "debian92", "versions": "latest", "php-edge-versions": "latest-stable" }
matrix_spec: { "os": "debian92", "versions": ["5.0", "latest"], "php-edge-versions": "latest-stable" }
display_name: "Load balanced - ${versions}"
tasks:
- name: "test-loadBalanced"
4 changes: 1 addition & 3 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ set -o errexit # Exit the script with error if any of the commands fail
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
# TESTS Optional TESTS environment variable for run-tests.php
# API_VERSION Optional API_VERSION environment variable for run-tests.php
# MOCK_SERVICE_ID Set to "1" to enable service ID mocking for load balancers. Defaults to empty string.

SSL=${SSL:-nossl}
MONGODB_URI=${MONGODB_URI:-}
TESTS=${TESTS:-}
API_VERSION=${API_VERSION:-}
MOCK_SERVICE_ID=${MOCK_SERVICE_ID:-}

OS=$(uname -s | tr '[:upper:]' '[:lower:]')
[ -z "$MARCH" ] && MARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
Expand All @@ -35,7 +33,7 @@ echo "Running tests with URI: $MONGODB_URI"
# Run the tests, and store the results in a junit result file
case "$OS" in
*)
MOCK_SERVICE_ID="${MOCK_SERVICE_ID}" API_VERSION="${API_VERSION}" TEST_PHP_JUNIT="${PROJECT_DIRECTORY}/test-results.xml" TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test TESTS=$TESTS
API_VERSION="${API_VERSION}" TEST_PHP_JUNIT="${PROJECT_DIRECTORY}/test-results.xml" TEST_PHP_ARGS="-q -x --show-diff -g FAIL,XFAIL,BORK,WARN,LEAK,SKIP" make test TESTS=$TESTS
;;
esac

1 change: 0 additions & 1 deletion php_phongo.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ extern zend_module_entry mongodb_module_entry;
ZEND_BEGIN_MODULE_GLOBALS(mongodb)
char* debug;
FILE* debug_fd;
bool mock_service_id;
HashTable persistent_clients;
HashTable* request_clients;
HashTable* subscribers;
Expand Down
19 changes: 0 additions & 19 deletions src/phongo_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include "php_phongo.h"
#include "phongo_ini.h"

extern bool mongoc_global_mock_service_id;

ZEND_EXTERN_MODULE_GLOBALS(mongodb)

static void phongo_log(mongoc_log_level_t log_level, const char* log_domain, const char* message, void* user_data)
Expand Down Expand Up @@ -109,22 +107,6 @@ static PHP_INI_MH(OnUpdateDebug)
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}

static PHP_INI_MH(OnUpdateMockServiceId)
{
mongoc_global_mock_service_id = zend_ini_parse_bool(new_value);

return SUCCESS;
}

static PHP_INI_DISP(DisplayMockServiceId)
{
if (mongoc_global_mock_service_id) {
ZEND_PUTS("On");
} else {
ZEND_PUTS("Off");
}
}

void phongo_display_ini_entries(ZEND_MODULE_INFO_FUNC_ARGS)
{
DISPLAY_INI_ENTRIES();
Expand All @@ -134,7 +116,6 @@ void phongo_register_ini_entries(INIT_FUNC_ARGS)
{
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("mongodb.debug", "", PHP_INI_ALL, OnUpdateDebug, debug, zend_mongodb_globals, mongodb_globals)
PHP_INI_ENTRY_EX("mongodb.mock_service_id", "0", PHP_INI_ALL, OnUpdateMockServiceId, DisplayMockServiceId)
PHP_INI_END()

REGISTER_INI_ENTRIES();
Expand Down
13 changes: 0 additions & 13 deletions tests/ini/ini-mock_service_id-ini_get-001.phpt

This file was deleted.

18 changes: 0 additions & 18 deletions tests/ini/ini-mock_service_id-ini_get-002.phpt

This file was deleted.

15 changes: 0 additions & 15 deletions tests/ini/ini-mock_service_id-phpinfo-001.phpt

This file was deleted.

21 changes: 0 additions & 21 deletions tests/ini/ini-mock_service_id-phpinfo-002.phpt

This file was deleted.

4 changes: 0 additions & 4 deletions tests/utils/basic.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ define('DATABASE_NAME', getenv('MONGODB_DATABASE') ?: 'phongo');
define('COLLECTION_NAME', makeCollectionNameFromFilename($_SERVER['SCRIPT_FILENAME']));
define('NS', DATABASE_NAME . '.' . COLLECTION_NAME);
define('SSL_DIR', realpath(getenv('SSL_DIR')));

if (getenv('MOCK_SERVICE_ID')) {
ini_set('mongodb.mock_service_id', '1');
}