Skip to content

Commit 29d2ae1

Browse files
committed
Test docs
1 parent a1441de commit 29d2ae1

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

.github/workflows/action-test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ on:
22
workflow_call:
33
inputs:
44
python-version:
5+
description: 'Python version to run test on'
56
required: true
67
type: string
78
environment:
9+
description: 'Environment to read envvars from'
810
required: true
911
type: string
12+
timeout:
13+
description: 'Time to wait between running tests in seconds'
14+
required: false
15+
type: string
16+
default: '30'
1017
secrets:
1118
NOCO_URL:
1219
required: true
@@ -39,3 +46,4 @@ jobs:
3946
NOCO_URL: ${{ secrets.NOCO_URL }}
4047
NOCO_API_KEY: ${{ secrets.NOCO_API_KEY }}
4148
NOCO_BASE_ID: ${{ secrets.NOCO_BASE_ID }}
49+
TIMEOUT: ${{ inputs.environment }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ python -m venv .venv
2727

2828
### Tests in Docker
2929

30+
Create a file `test_config.json` with the parameters, or change the Environment Variables in `tests/Dockerfile`, than run:
31+
3032
```shell
3133
docker run --rm -it $(docker build -q -f tests/Dockerfile .)
3234
```

tests/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ COPY . .
66

77
RUN pip install --no-cache-dir .
88

9+
# Change envvars here, or create a test_config.json file with these values:
10+
# ENV NOCO_URL=https://app.nocodb.com
11+
# ENV NOCO_API_KEY=apikey
12+
# ENV NOCO_BASE_ID=baseid
13+
# ENV TIMEOUT=30
14+
915
CMD python -m unittest discover -v -s ./tests -p "test_*.py"
1016

1117
# docker run --rm -it $(docker build -q -f tests/Dockerfile .)

tests/test_noco.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
CONFIG = {
1818
"NOCO_URL": "https://app.nocodb.com",
1919
"NOCO_API_KEY": "",
20-
"NOCO_BASE_ID": ""
20+
"NOCO_BASE_ID": "",
21+
"TIMEOUT": "30"
2122
}
2223

2324

@@ -46,11 +47,7 @@ class TestData:
4647

4748
@classmethod
4849
def setUpClass(cls) -> None:
49-
sleep(10)
50-
51-
@classmethod
52-
def tearDownClass(cls) -> None:
53-
sleep(10)
50+
sleep(int(CONFIG["TIMEOUT"]))
5451

5552
@classmethod
5653
def get_new_table(cls) -> Table:

0 commit comments

Comments
 (0)