diff options
author | Munyoki Kilyungi | 2024-09-23 14:02:30 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-09-23 16:18:37 +0300 |
commit | f3114d482b25f532d6ffd9aab3e95d00cf996cc9 (patch) | |
tree | 1bca5735912ceb40e120d70be7775f11a2f1d35c /tests | |
parent | f10212c6423fa00b5209d617172a508c181547c2 (diff) | |
download | genenetwork3-f3114d482b25f532d6ffd9aab3e95d00cf996cc9.tar.gz |
Handle missing GN3_SECRETS for CI testing.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fixtures/rdf.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/fixtures/rdf.py b/tests/fixtures/rdf.py index 6d5b6aa..0bafeaa 100644 --- a/tests/fixtures/rdf.py +++ b/tests/fixtures/rdf.py @@ -9,9 +9,20 @@ import pytest def get_sparql_auth_conf() -> dict: """Fetch SPARQL auth configuration for the GN3_SECRETS file.""" sparql_conf = config.Config("") - # When loading from the environment, GN3_CONF precedes - # GN3_SECRETS. Don't change this order. - sparql_conf.from_envvar("GN3_CONF") + if os.environ.get("GN3_CONF"): + # Check whether GN3_CONF has been set, and ignore GN3_CONF + # otherwise. In CD, we use a mixed-text file, so we don't + # have an explicit PATH to point this to. + # https://git.genenetwork.org/gn-machines/tree/genenetwork-development.scm#n517 + sparql_conf.from_envvar("GN3_CONF") + # Set sane defaults for GN3_SECRETS to CD's secret file. In CD, + # this file is set in the genenetwork3 cd gexp: + # https://git.genenetwork.org/gn-machines/tree/genenetwork-development.scm#n516 + # However, during testing GN3_SECRETS isn't set; and by default, + # we run guix's default tests for python projects: `pytest` + # https://git.genenetwork.org/guix-bioinformatics/tree/gn/packages/genenetwork.scm#n182 + if not os.environ.get("GN3_SECRETS"): + os.environ["GN3_SECRETS"] = "/etc/genenetwork/conf/gn3/secrets.py" sparql_conf.from_envvar("GN3_SECRETS") return { "sparql_user": sparql_conf["SPARQL_USER"], @@ -22,6 +33,9 @@ def get_sparql_auth_conf() -> dict: } +# XXXX: Currently we run the tests against CD's virtuoso instance. +# This is not idempotent. Consider having a special virtuoso instance +# just for running tests. @pytest.fixture(scope="module") def rdf_setup(): """Upload RDF to a Virtuoso named graph""" |