test: restructure tests (#2444)

unit, api, wallets
* only run test-api for migration
This commit is contained in:
dni ⚡ 2024-04-19 13:22:06 +02:00 committed by GitHub
parent 67fdb77339
commit e607ab7a3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 605 additions and 563 deletions

View file

@ -12,7 +12,7 @@ jobs:
lint:
uses: ./.github/workflows/lint.yml
tests:
test-api:
needs: [ lint ]
strategy:
matrix:
@ -20,6 +20,35 @@ jobs:
db-url: ["", "postgres://lnbits:lnbits@0.0.0.0:5432/lnbits"]
uses: ./.github/workflows/tests.yml
with:
custom-pytest: "poetry run pytest tests/api"
python-version: ${{ matrix.python-version }}
db-url: ${{ matrix.db-url }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-wallets:
needs: [ lint ]
strategy:
matrix:
python-version: ["3.9", "3.10"]
db-url: ["", "postgres://lnbits:lnbits@0.0.0.0:5432/lnbits"]
uses: ./.github/workflows/tests.yml
with:
custom-pytest: "poetry run pytest tests/wallets"
python-version: ${{ matrix.python-version }}
db-url: ${{ matrix.db-url }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-unit:
needs: [ lint ]
strategy:
matrix:
python-version: ["3.9", "3.10"]
db-url: ["", "postgres://lnbits:lnbits@0.0.0.0:5432/lnbits"]
uses: ./.github/workflows/tests.yml
with:
custom-pytest: "poetry run pytest tests/unit"
python-version: ${{ matrix.python-version }}
db-url: ${{ matrix.db-url }}
secrets:
@ -48,6 +77,7 @@ jobs:
python-version: ["3.9"]
backend-wallet-class: ["LndRestWallet", "LndWallet", "CoreLightningWallet", "CoreLightningRestWallet", "LNbitsWallet", "EclairWallet"]
with:
custom-pytest: "poetry run pytest tests/regtest"
python-version: ${{ matrix.python-version }}
backend-wallet-class: ${{ matrix.backend-wallet-class }}
secrets:

View file

@ -3,8 +3,9 @@ name: regtest
on:
workflow_call:
inputs:
make:
default: test
custom-pytest:
description: "Custom pytest arguments"
required: true
type: string
python-version:
default: "3.9"
@ -76,15 +77,14 @@ jobs:
LNBITS_KEY: "d08a3313322a4514af75d488bcc27eee"
ECLAIR_URL: http://127.0.0.1:8082
ECLAIR_PASS: lnbits
LNBITS_DATA_FOLDER: "./tests/data"
PYTHONUNBUFFERED: 1
DEBUG: true
with:
verbose: false
verbose: true
job-summary: true
emoji: false
click-to-expand: false
custom-pytest: poetry run pytest
click-to-expand: true
custom-pytest: ${{ inputs.custom-pytest }}
report-title: "regtest (${{ inputs.python-version }}, ${{ inputs.backend-wallet-class }}"
- name: Upload coverage to Codecov

View file

@ -3,6 +3,10 @@ name: tests
on:
workflow_call:
inputs:
custom-pytest:
description: "Custom pytest arguments"
required: true
type: string
python-version:
default: "3.9"
type: string
@ -50,16 +54,14 @@ jobs:
env:
LNBITS_DATABASE_URL: ${{ inputs.db-url }}
LNBITS_BACKEND_WALLET_CLASS: FakeWallet
FAKE_WALLET_SECRET: "ToTheMoon1"
LNBITS_DATA_FOLDER: "./tests/data"
PYTHONUNBUFFERED: 1
DEBUG: true
with:
verbose: false
verbose: true
job-summary: true
emoji: false
click-to-expand: false
custom-pytest: poetry run pytest
click-to-expand: true
custom-pytest: ${{ inputs.custom-pytest }}
report-title: "test (${{ inputs.python-version }}, ${{ inputs.db-url }})"
- name: Upload coverage to Codecov