Summary
Just as the library has a higher line-count of code autogenerated by OpenAPI, and a lower line-count of manual-layer files, so too with testing. In tests/testthat
are many autogenerated files – with function bodies written commented out by OpenAPI. We do not focus our testing in this direction.
Opting in
In inst/tinytest
are manually written tests. These are opt-in: they make TileDB Cloud calls, which we don’t want to push on all users who build the package locally.
To opt in:
- Have either environment variable
TILEDB_REST_TOKEN
, or the pairTILEDB_REST_USERNAME
andTILEDB_REST_PASSWORD
– or all three if you like. - You will also need environment variable
TILEDB_REST_UNIT_TEST_NAMESPACE_TO_CHARGE
for the (very minor) cloud costs associated with invoking UDFs. - Optionally,
TILEDB_REST_HOST
if your cloud installation is local, and/or for TileDB employees pointing at our staging environment. - In R:
tinytest::test_all(".")
Debug information
-
export TILEDB_CLOUD_R_HTTP_DEBUG=true
before launching R will result in helpful printouts to the screen of HTTP requests and responses. - Alternatively, once inside R, you can do
Sys.setenv(TILEDB_CLOUD_R_HTTP_DEBUG='true')
.
Running tests interactively
At the shell prompt:
unset TILEDB_REST_USERNAME
unset TILEDB_REST_PASSWORD
export TILEDB_REST_UNIT_TEST_NAMESPACE_TO_CHARGE=unittest
export TILEDB_REST_TOKEN="..."
Rscript -e 'tinytest::test_all(".")'
Rscript -e 'tinytest::run_test_file("inst/tinytest/test_b_array.R")'
At the R prompt:
tinytest::test_all(".")
tinytest::run_test_file("inst/tinytest/test_c_udf_execution.R")
traceback()