libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit bbe99c48419ee0bf75ee07e95fcc176733dbca68
parent 826d4b45c34d1c3c3f543a718a580518a6719c6e
Author: MS <ms@taler.net>
Date:   Thu, 10 Dec 2020 15:28:17 +0100

Testing harness.

Prefer commands offered by Nexus and Sandbox to
drop their tables, as opposed to a direct shell-based
way of deleting rows.

Diffstat:
Mintegration-tests/tests.py | 15++++++++-------
Mintegration-tests/util.py | 26++++++++++++++++----------
2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py @@ -10,10 +10,9 @@ from util import ( startNexus, startSandbox, assertResponse, - flushTablesSandbox, - flushTablesNexus, makeNexusSuperuser, - removeStaleTables + dropSandboxTables, + dropNexusTables ) # Base URLs @@ -134,17 +133,19 @@ def prepareNexus(): ) ) -removeStaleTables(DB) -startNexus(DB) +dropSandboxTables(DB) startSandbox(DB) +dropNexusTables(DB) +startNexus(DB) def setup_function(): prepareSandbox() prepareNexus() + def teardown_function(): - flushTablesNexus(DB) - flushTablesSandbox(DB) + dropSandboxTables(DB) + dropNexusTables(DB) def test_env(): diff --git a/integration-tests/util.py b/integration-tests/util.py @@ -59,19 +59,25 @@ def makeNexusSuperuser(dbName): f"--args=superuser admin --password x --db-name={dbName}", ]) -def drop_public_schema(dbName): +def dropSandboxTables(dbName): check_call([ - "psql", - "-d", dbName, "-q", - "-h", "127.0.0.1", "-p", "5433", - "-U", "libeufin", - "-c", "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" + "../gradlew", + "-q", "--console=plain", + "-p", "..", + "sandbox:run", + f"--args=drop-tables --db-name={dbName}", + ]) + + +def dropNexusTables(dbName): + check_call([ + "../gradlew", + "-q", "--console=plain", + "-p", "..", + "nexus:run", + f"--args=drop-tables --db-name={dbName}", ]) -def flushTablesSandbox(dbName): - drop_public_schema(dbName) -def flushTablesNexus(dbName): - drop_public_schema(dbName) def startSandbox(dbName): check_call(["../gradlew", "-q", "--console=plain", "-p", "..", "sandbox:assemble"])