From 55b3973b7b227e4901dc8bd33a35e7fdd8665e78 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Wed, 1 Nov 2023 20:22:45 -0300 Subject: [PATCH] run postgres tests in CI? --- .github/workflows/tests.yml | 2 +- tests/conftest.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ef22322..05567c93 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: os: [ubuntu-latest] python-version: ["3.10.4"] poetry-version: ["1.5.1"] - db-url: ["", "postgres://cashu:cashu@localhost:5432/cashu"] + db-url: ["", "postgres://cashu:cashu@localhost:5432/test"] steps: - name: Checkout repository and submodules uses: actions/checkout@v2 diff --git a/tests/conftest.py b/tests/conftest.py index 02751323..56edac4f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -57,11 +57,14 @@ async def start_mint_init(ledger: Ledger): await ledger.load_used_proofs() await ledger.init_keysets() - db_file = "test_data/mint/test.sqlite3" - if os.path.exists(db_file): - os.remove(db_file) + # clear sqlite database + if not settings.mint_database.startswith("postgres"): + db_file = os.path.join(settings.mint_database, "test.sqlite3") + if os.path.exists(db_file): + os.remove(db_file) + ledger = Ledger( - db=Database("test", "test_data/mint"), + db=Database("test", settings.mint_database), seed=settings.mint_private_key, derivation_path=settings.mint_derivation_path, lightning=FakeWallet(),