ropensci / ckanr

R client for the CKAN API
https://docs.ropensci.org/ckanr
Other
99 stars 38 forks source link

Spin-up CKAN for testing in Github Actions #192

Closed fjuniorr closed 1 year ago

fjuniorr commented 1 year ago

Description

Closes #144

Docker is not supported fully on Windows and MacOS runners, therefore the tests against CKAN are run only for ubuntu. Because of this I'm also generating code coverage and running r-devel against ubuntu.

The tricky part for me was discovering that by default docker compose sets up a single network. Each container joins the default network and is both reachable by other containers on that network, and discoverable by them at a hostname identical to the container name. However, the hostname of the docker container cannot be seen from the host unless /etc/hosts is updated.

fjuniorr commented 1 year ago

Because I'm running all tests against http://localhost:5000 after d6931 and there is no CKAN for windows and macosx, the tests are failing.

Some options would be:

Not sure how to approach this. Any ideas @maelle?

maelle commented 1 year ago

Skip tests on windows and macos (bad because locally they could still work)

Would writing a custom skipper help? https://testthat.r-lib.org/articles/skipping.html It'd be a combination of the internal code of testthat:::on_ci() and the code for recognizing which OS is meant.

fjuniorr commented 1 year ago

I've reused ckanr::check_ckan for this, which skips a test if CKAN is offline. A name like skip_if_ckan_offline would probably be easier to understand, but I will leave this change for latter after I've grokked the rationale behind the PRs

The failing tests for CKAN 2.9 are being tracked at #189.