Commit Graph

92 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
d5e077928d PHPC-1435: Fix test checking invalid argument values 2019-08-29 10:44:57 -04: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
b5193bef3d Make use of use statements 2019-05-14 12:49:24 -04: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
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
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
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
Derick Rethans
b172a20c31 PHPC-1140: Implement Transactions specification 2018-06-19 14:47:29 +01:00
Jeremy Mikola
014f2b6435 Create append_uri_option() helper function
This removes previous assumptions about the structure of the URI string.
2018-05-02 16:04:09 -04:00
Jeremy Mikola
b4062f880c PHPC-1113: Replace CLEANUP() with skip function 2018-05-02 16:04:08 -04:00
Jeremy Mikola
55e3341493 PHPC-1113: Replace NEEDS('STANDALONE_X509') with skip function 2018-05-02 16:04:08 -04:00
Jeremy Mikola
8768f548b4 PHPC-1113: Replace NEEDS('STANDALONE_AUTH') with skip function 2018-05-02 16:04:08 -04:00
Jeremy Mikola
38405a7f19 PHPC-1113: Replace TESTCOMMANDS() with skip function 2018-05-02 16:04:08 -04:00
Jeremy Mikola
fe52b484be PHPC-1113: Replace NEEDS_ATLEAST_MONGODB_VERSION() with skip function 2018-05-02 16:04:07 -04:00
Jeremy Mikola
6960868ab7 PHPC-1113: Replace NEEDS_STORAGE_ENGINE() with skip function 2018-05-02 16:04:07 -04:00
Jeremy Mikola
cf6aa41516 PHPC-1113: Replace NEEDS_SSL() with skip function 2018-05-02 16:04:07 -04:00
Jeremy Mikola
8a83606e9b PHPC-1113: Replace NEEDS_CRYPTO() with skip function 2018-05-02 16:04:07 -04:00
Jeremy Mikola
f4cf0fe3a0 PHPC-1113: Use common URI env var in basic/skipif includes 2018-05-02 16:04:07 -04:00
Jeremy Mikola
2ecee506b4 PHPC-1100: Require SSL or crypto as needed in tests
This addresses test failures when the driver is compiled without SSL.
2018-01-23 09:25:44 -05:00
Jeremy Mikola
83f333065e LibreSSL cannot extract username subject from X509 certs 2018-01-22 12:01:47 -05:00
Derick Rethans
d0d3cc7f96 Ensure these tests only run with wiredTiger engine 2018-01-12 11:55:41 +00:00
Derick Rethans
1e06f3428f Replace check for 'TRAVIS' with MongoDB server version check 2018-01-12 11:55:41 +00:00
Jeremy Mikola
58324ad627 PHPC-992: Rename extended JSON functions to[Canonical|Relaxed]ExtendedJSON() 2017-08-10 12:56:47 -04:00
Jeremy Mikola
65f5091010 PHPC-941: Add MongoDB\BSON\toCanonicalJSON() and toRelaxedJSON()
In CDRIVER-2208, bson_as_json() (used by toJSON()) was reverted to its original output format. Canonical and relaxed extended JSON are now produced by bson_as_canonical_json() and bson_as_relaxed_json(), respectively. This commit removes toExtendedJSON() (added in 980f1fb01a) in favor of the new functions.

Implementations for the BSON functions have been moved to their own file, which is consistent with what we're doing for the APM subscriber functions.
2017-07-28 13:30:06 -04:00
Derick Rethans
611b9f2fc7 PHPC-941: Use toExtendedJSON() for BSON corpus tests 2017-04-07 14:54:54 -04:00
Jeremy Mikola
56f3a9da74 PHPC-714: Script to convert BSON corpus tests 2017-01-13 15:05:41 -05:00
Jeremy Mikola
7f485f921e PHPC-761: Tests can rely on MongoDB\BSON namespace 2016-08-05 14:06:58 -04:00