Skip to content

Commit b9d9985

Browse files
Add integration tests (#53)
This PR adds integration test for the API client, service, as well as handel. These tests are performed by creating, updating & deleting orders on the simulation database. As discussed in the latest team meeting, these tests were originally written with the goal of automatising everything. As a consequence, some of them might not be the most coherent: for instance `test_list_public_trades()` just verifies that the returned list isn’t null. It doesn’t check for the correctness of the output at all. These tests might thus have to be split into system tests (that would be performed manually), and integration test. 

Additionally, I think that having these tests run by the CI is not the most appropriate (especially given that they depend on other components than just the client). So please suggest alternatives & improvements, & let's make a next level robust, efficient and awesome test suite!😎
2 parents 4755a86 + c1e13af commit b9d9985

File tree

4 files changed

+481
-0
lines changed

4 files changed

+481
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Electricity-Trading-API-Integration-Tests
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
env:
9+
DEFAULT_PYTHON_VERSION: '3.11'
10+
11+
jobs:
12+
run-tests:
13+
name: Integration tests
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os:
18+
- ubuntu-20.04
19+
python:
20+
- "3.11"
21+
runs-on: ${{ matrix.os }}
22+
23+
steps:
24+
- name: Setup Git
25+
uses: frequenz-floss/[email protected]
26+
27+
- name: Print environment (debug)
28+
run: env
29+
30+
- name: Fetch sources
31+
uses: actions/checkout@v4
32+
with:
33+
submodules: true
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: ${{ matrix.python }}
39+
cache: 'pip'
40+
41+
- name: Install required Python packages
42+
run: |
43+
python -m pip install --upgrade pip
44+
python -m pip install -e .[dev-pytest]
45+
pip freeze
46+
47+
- name: Run the integration tests
48+
env:
49+
API_KEY: ${{ secrets.API_KEY }}
50+
GRIDPOOL_ID: ${{ secrets.GRIDPOOL_ID }}
51+
run: |
52+
pytest -vv integration_tests/
53+
timeout-minutes: 10
54+
55+

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* Remove dependency to `googleapis-common-protos`
1818
* Replace `Energy` with `Power` for the `quantity` representation
1919
* Add str function for `DeliveryPeriod` object
20+
* Add integration tests for the API
21+
* Add an equality function to the Order type
2022

2123
## Bug Fixes
2224

0 commit comments

Comments
 (0)