Spider relies on a fault-tolerant storage to store metadata and data. Spider's unit tests also require this storage backend.
-
Start a MySQL database running in background.
-
Create an empty database.
CREATE DATABASE <db_name>;
-
Set the password for
rootor create another user with password and grant access to database created in step 2.ALTER USER 'root'@'localhost' IDENTIFIED BY '<pwd>'; --- OR create a new user CREATE USER '<usr>'@'localhost' IDENTIFIED BY '<pwd>'; GRANT ALL PRIVILEGES ON <db_name>.* TO '<usr>'@'localhost';
-
Set the
cStorageUrlintests/storage/StorageTestHelper.hpptojdbc:mariadb://localhost:3306/<db_name>?user=<usr>&password=<pwd>. -
Set the
storage-urlintests/integration/client.pytojdbc:mariadb://localhost:3306/<db_name>?user=<usr>&password=<pwd>.
You can use the following tasks to run the set of unit tests that's appropriate.
| Task | Description |
|---|---|
test:all |
Runs all unit tests. |
test:non-storage-unit-tests |
Runs all unit tests which don't require a storage backend to run. |
test:storage-unit-tests |
Runs all unit tests which require a storage backend to run. |
If any tests show error messages for the connection function below, revisit the
setup section and verify that cStorageUrl was set correctly.
REQUIRE( storage->connect(spider::test::cStorageUrl).success() )The unit_tests.yaml GitHub workflow runs the unit tests on push, pull requests, and daily. Currently, it only runs unit tests that don't require a storage backend.
You can use the following tasks to run integration tests.
| Task | Description |
|---|---|
test:integration |
Runs all integration tests. |