Commit Graph

170 Commits

Author SHA1 Message Date
Jeremy Mikola
51f0dd5399 PHPC-2143: Build Windows DLLs with GitHub Actions (#1380)
* Fix APM and CSFLE tests for Windows CI

* Add Windows to GitHub CI and build DLLs for releases

* Add --enable-debug-pack configure opt to generate PDB files

* Reminder to check for Windows build artifacts before publishing releases

* Revise advice on publicizing releases
2022-11-21 10:09:46 -05:00
Andreas Braun
6db48b821f PHPC-2064: Use register_shutdown_function to disable caching of skipif results (#1366) 2022-09-16 08:49:55 +02:00
Jeremy Mikola
f0421fa1fe PHPC-2103: Report loaded crypt_shared version in phpinfo() (#1351)
* Match error message variations between libmongoc 1.23+ and older

This typo was corrected in mongodb/mongo-c-driver@1d7229f0e9 and will appear in the 1.23.0 release.

* PHPC-2103: Report loaded crypt_shared version in phpinfo()

* PHPC-2132: Fix pattern for matching phpinfo() values
2022-09-14 17:28:13 -04:00
Jeremy Mikola
dfa4c20f8b Merge branch 'v1.14' 2022-08-30 15:57:06 -04:00
Jeremy Mikola
746919519c PHPC-2131: Ensure CRYPT_SHARED_LIB_PATH is exported for tests (#1352)
This also fixes the injection logic in create_test_manager(), which should only kick in when "autoEncryption" opts are specified (as PHPLIB does) and check for a valid $driverOptions structure (to accomodate manager-ctor error tests).
2022-08-30 11:37:08 -04:00
Jeremy Mikola
c99a8563bf PHPC-2093: Key Management API (#1339)
* PHPC-2120: Bump libmongoc 1.22.1 and libmongocrypt 1.5.2

* Clean keyvault collection before CSFLE tests

* Test invalid keyMaterial option for ClientEncryption::createDataKey()

* ClientEncryption::createDataKey() "keyMaterial" option

* ClientEncryption key management methods

Use ClientEncryption::getKey in createDataKey tests

* Require server 4.2+ for CSFLE integration tests

* Accommodate PHP 7.2 error message in createDataKey error test
2022-08-18 12:15:54 -04:00
Andreas Braun
6887226d34 PHPC-1709: Add typing information to arginfo (#1337)
* Add missing macros for declaring arguments

* Add macros to define disabled constructor and __wakeup

* Define arginfo via stubs for BSON classes

* Declare tentative return types in interfaces

* Add correct return type for __set_state methods

* Generate class entries for BSON classes

* Declare Binary class constants in stub file

* Use stubs in exception classes

* Add stubs for monitoring classes

* Fix wrong JsonSerializable class in BSON stubs

* Disable declaration-after-statement

This is necessary to let the generated arginfo files compile

* Use stubs for driver classes

* Fix deprecation messages in tests

* Add missing macro

* Fix tests relying on value injection

* Parse parameters in disabled constructor/wakup function

* Add note about arginfo files to contribution docs

* Add GitHub action to check generated arginfo files

* PHPC-2115: Use DateTimeInterface in UTCDateTime constructor signature

* Don't install mongodb extension in GitHub actions workflows

* Change indentation in stub files

* Use individual #if conditions for each stub method

* Make disabled constructor/wakeup methods static

* Fix bulkWrite parameter name

* Use %d to match property count in tests

* Ensure all classes with disabled serialisation declare __wakeup
2022-08-03 08:42:07 +02:00
Jeremy Mikola
03fcb6b9ef PHPC-2099: crypt_shared testing (#1333)
* Use non-breaking space in OS axis labels

* Revise titles and Manager construction in autoEncryption tests

* Define CSFLE_KEY_VAULT_NS and CSFLE_LOCAL_KEY constants

The value for CSFLE_KEY_VAULT_NS is based on the example from PHPLIB-826. This was not required but helps makes all tests consistent and will make it easier if we need to add functionality to a helper to drop the key vault collection before a test.

Using CSFLE_LOCAL_KEY allows removal of a duplicated string literal in various CSFLE tests. Although the new constant wasn't required for all tests (empty strings worked fine to satisfy option validation), using a constant helps ensure consistency across the test suite.

Also use create_test_manager() in more places when basic.inc is included. The remaining instances of direct Manager construction should only be in tests where basic.inc isn't used.
2022-06-22 13:37:56 -04:00
Jeremy Mikola
b73afcd482 PHPC-2053: Remove mongodb.mock_service_id INI option
Note: this was only used for internal testing and should not be considered a BC break.
2022-05-23 13:55:40 -04:00
Jeremy Mikola
93efe0aeb6 PHPC-2073: Remove references to pre-3.6 servers (#1305)
* Remove pre-3.6 server versions from Evergreen matrix

* Remove skipped tests for pre-3.6 servers

* Remove old mongo-orchestration configs and Evergreen tasks

* Remove flaky replica set tests

These tests assume a particular replica set member is always the primary, so tag assertions may fail if a different member is elected. The server-getTags-002.phpt test has more flexible assertions for replica set tags, so we can safely remove these tests.
2022-03-01 20:30:00 -05:00
Jeremy Mikola
36f6ce0ebc PHPC-1878 and PHPC-2008: Fix tests using local database (#1277)
* PHPC-1878: Explicitly use w:1 for local database

* PHPC-2008: Skip test requiring role to drop local collection

The "restore" role is required to drop collections in the "local" database. Mongo Orchestration does not yet grant that role for its users.
2021-11-30 10:54:16 -05:00
Jeremy Mikola
594e83bad4 PHPC-1976: Add serviceId to command monitoring events 2021-10-15 13:44:32 -04:00
Jeremy Mikola
ae74c7a1cd PHPC-1752: Fix tests for load balanced topologies
Skip tests expecting gossiped $clusterTime on first command. This may be a bug in libmongoc, per CDRIVER-4174.

Make exception assertion in TLS tests more flexible. Expect parent ConnectionException to accomodate load balanced clients, which do not use server selection. Both exception messages will include a common prefix from libmongoc.

Do not assert exception message for failed TLS connection. While the message will typically include "TLS handshake failed", that is not guaranteed.

Make ping response assertions in TLS tests more flexible. Sharded clusters and replica sets may return additional fields in the ping response (e.g. cluster time). These tests were originally written to expect a standalone response.

Allow unset RTT (-1) for load balanced client.

Note SRV caveat for is_replica_set test function.

Allow load balancers for tests that require sharded clusters. Load balancers should always proxy a mongos, so existing skip functions that check for mongos can now allow a load balancer. If there is some incompatibility specific to LBs, we can address that later with a LB-specific skip function.

Require mongos for pinning tests. Pinning does not apply to load balanced clients, since there is only one connection.
2021-10-15 13:44:32 -04:00
Jeremy Mikola
cfc6bbbe5d PHPC-1978: Expose mongoc_global_mock_service_id as INI option
This also consolidates INI functions (and trace logging) into a separate file and ensure that mongoc logging is disabled during GSHUTDOWN (avoiding a potential segfault).

Enable service ID mocking when testing load balancers with HAProxy.
2021-10-15 13:44:30 -04:00
Jeremy Mikola
ce6b11d475 PHPC-1975: Disable SKIPIF caching for skip_if_not_clean on PHP 8.1 (#1261) 2021-09-24 14:05:16 -04:00
Jeremy Mikola
f663761fd4 Fix message for catching wrong exception in raises() (#1252)
* Fix message for catching wrong exception in raises()

The original implementation of raises() in c6a793d466 apparently referenced an undeclared $exceptionname variable several times. That was later addressed 804f383aea but that commit neglected to fix this reference.

* Refactor raises() and throws() utility functions
2021-09-01 18:32:20 -04:00
Andreas Braun
deead9687e PHPC-1716 Allow configuring server API version in manager (#1204)
* Introduce MongoDB\Driver\ServerApi

* Accept serverApi driver option

* Introduce create_test_manager factory to create manager

A centralised entry point is required to inject the API_VERSION env variable later.

* Add build variant to test with requireApiVersion=true

* Fix wrong configuration for auth variable

This changed when migrating from our own scripts to drivers-evergreen-tools and was not updated properly, causing all tests to run with auth disabled.

* Declare ZEND_PARSE_PARAMETERS_NONE macro

This macro is missing on PHP < 7.3

* Remove duplicated API param storage

* Add missing semicolons

* Add ZEND_PARSE_PARAMETERS_NON_EX macro

* Extract error handling functionality to separate macros

* Throw if internal mongoc_server_api_t is already initialised

* Use imported namespaces in tools file

* Fix type info for reflection

* Use American English spelling

* Only use typed serialize signature on PHP 8+

* Update PHONGO_PARSE_PARAMETERS_NONE macro for PHP < 7.3

* Remove usage of ZEND_STRL within zend_hash_str_add

This causes compile failures on PHP < 7.3 that I have yet to understand.

* Fix errors in new PHONGO_PARSE_PARAMETERS macros
2021-03-26 15:43:48 +01:00
Andreas Braun
ed31cba5cb PHPC-1739 Move from travis-ci to GitHub Actions (#1199)
* Add GitHub Action workflow for tests

* Add workflow to check formatting

* Remove travis-ci config

* Fix clang-format error

* Add shared json extension for tests

* Hide output for xfail tests

* Use mongo-orchestration configs from drivers-evergreen-tools

* Drop obsolete test scripts

This drops the legacy VM environment and remnants of the travis-ci config

* Remove obsolete server_id config

* Add note about MONGO_ORCHESTRATION_URI to contribution docs

* Restore previous XFAIL behaviour

This did not have the expected effect of preventing diff output for tests that expect failures, so it can be reverted.

* Make SSL certificate path configurable for tests

Since mongo-orchestration will always bring its own certificates, we need to set the correct SSL certificate directory for our tests. This is skipped on GitHub Actions as we don't test SSL builds there (yet). If SSL_DIR was not set, tests requiring SSL will be skipped.

* Fix code review nits
2021-02-23 14:49:54 +01:00
Andreas Braun
60febd0f28 PHPC-1699: Ensure all argument parsing errors throw InvalidArgumentException (#1173)
Co-authored-by: Jeremy Mikola <jmikola@gmail.com>
2020-10-28 08:20:32 +01:00
Jeremy Mikola
ca4c52eb1c PHPC-1692: Test suite fixes for PHP 8 2020-10-13 15:24:02 +02:00
Jeremy Mikola
96f97f8d43 PHPC-1653: Resync BSON corpus spec tests
Syncs tests with mongodb/specifications@1713439515. Includes tests for PHPC-1655 and PHPC-1652.

Adds logic to canonicalize $numberDouble values, which allows previously skipped tests to pass. This was noticed because SPEC-1537 changed the description of these tests and they were no loner skipped by convert-bson-corpus-tests.php.
2020-07-23 11:36:09 -04:00
Jeremy Mikola
9ae06e236e Skip known/expected test failures in AppVeyor 2020-05-11 17:43:08 -04:00
Andreas Braun
123f9b0b88 PHPC-1498: Read auto encryption options from driverOptions 2020-01-16 09:23:12 +01:00
Andreas Braun
5e53ac9aab PHPC-1430: Deprecate obsolete driver options 2019-10-25 10:45:51 +02:00
Jeremy Mikola
94a12cd71d Fix undefined var if throws() fails to catch 2019-10-24 11:03:32 -04:00
Andreas Braun
b0414d55c6 PHPC-1290: Improve checks for transaction support 2019-09-02 16:19:33 +02:00
Andreas Braun
d5e077928d PHPC-1435: Fix test checking invalid argument values 2019-08-29 10:44:57 -04:00
Andreas Braun
d750c7013c PHPC-1290: Run relevant tests on sharded clusters 2019-08-29 07:26:43 +02:00
Andreas Braun
201acd92f4 PHPC-1290: Update sharded test clusters to have multiple mongoses
This is necessary because session pinning doesn't work when connected to a single mongos node
2019-08-28 20:10:47 +02:00
Andreas Braun
5ad804ac21 PHPC-1290: Add tests for server selection in sharded transactions 2019-08-28 20:10:47 +02:00
Andreas Braun
ef16f97f6c PHPC-1288: Add checks for conflicting TLS options 2019-08-28 07:34:07 +02:00
Andreas Braun
804f383aea PHPC-1382: Allow applications to set maxTimeMS for commitTransaction 2019-08-21 19:30:29 +02:00
Jeremy Mikola
5f235387d9 PHPC-1414: Skip tests when mongo orchestration is not available 2019-07-22 11:56:14 -04:00
Jeremy Mikola
cad8292e35 PHPC-1373: Accessible WriteResult for executeBulkWrite socket error
executeBulkWrite() will now throw a BulkWriteException on top of any previous exception to ensure that a WriteResult can be attached. InvalidArgumentException is excluded, since that is only thrown before mongoc_bulk_operation_execute does IO (e.g. batch is empty).
2019-05-15 14:27:16 -04:00
Jeremy Mikola
b5193bef3d Make use of use statements 2019-05-14 12:49:24 -04:00
Derick Rethans
4f5f9f0b3e Force date.timezone to be "UTC"
This is necessary, because without it, the check for whether SSL is enabled
fails, as the phpinfo() output buffer that it uses gets aborted with::

	[2018/12/11 16:35:00.441] 099+ date/time support => enabled
	[2018/12/11 16:35:00.441] 100+ "Olson" Timezone Database Version => 2015.5
	[2018/12/11 16:35:00.441] 101+ Timezone Database => internal
	[2018/12/11 16:35:00.441] 102+ skip E_WARNING: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. @ /data/mci/d58ba616b6660bdc1a013e7e0584a4dd/src/tests/utils/tools.php:74
2019-02-14 15:35:31 -05:00
Derick Rethans
603e6651c0 Let it set it's own path, so that we don't run into /tmp size issues 2019-02-14 15:35:31 -05:00
Derick Rethans
a5968f2b58 Change location of logs so that Evergreen's log collector picks them up 2019-02-14 15:35:31 -05:00
Derick Rethans
da45c7404b Merge branch 'v1.5' 2018-09-05 18:37:07 +01:00
Derick Rethans
b45a519c43 Added getMore failpoint skip_if 2018-09-05 18:36:44 +01:00
Derick Rethans
8ece2a3a35 PHPC-1179: Reimplement tests that start servers with Mongo Orchestration 2018-09-05 18:36:44 +01:00
Derick Rethans
985a69f23d Merge branch 'v1.5' 2018-08-31 10:29:39 +01:00
Derick Rethans
1fdb468e36 PHPC-1209: is_replica_set() should return false when connected to RS primary in standalone mode 2018-08-31 10:29:18 +01:00
Derick Rethans
897c3f5b4b Merge branch 'v1.5' 2018-08-30 11:45:37 +01:00
Derick Rethans
8a28fcb6a5 PHPC-1177: Add skip clauses to tests that must run with simple auth 2018-08-30 11:44:07 +01:00
Derick Rethans
19db8d9521 Merge branch 'v1.5' 2018-08-15 11:20:53 +01:00
Derick Rethans
a6544e1f11 PHPC-1178: Reimplement tests that load data fixtures 2018-08-14 14:30:33 +01:00
Derick Rethans
7d1ac7b523 PHPC-1220: Create skip function for insufficient replica set members 2018-08-10 11:26:42 +01:00
Derick Rethans
c80778a153 PHPC-1173: Reimplement replica set seedlist tests 2018-08-10 11:26:42 +01:00
Derick Rethans
3678fa5236 PHPC-1184: Add alternative topologies to Travis 2018-07-16 10:30:39 +01:00