Skip to content

Commit

Permalink
Add integration tests (#53)
Browse files Browse the repository at this point in the history
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!😎
  • Loading branch information
camille-bouvy-frequenz authored Nov 12, 2024
2 parents 4755a86 + c1e13af commit b9d9985
Show file tree
Hide file tree
Showing 4 changed files with 481 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Electricity-Trading-API-Integration-Tests

on:
workflow_dispatch:
release:
types: [published]

env:
DEFAULT_PYTHON_VERSION: '3.11'

jobs:
run-tests:
name: Integration tests
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
python:
- "3.11"
runs-on: ${{ matrix.os }}

steps:
- name: Setup Git
uses: frequenz-floss/[email protected]

- name: Print environment (debug)
run: env

- name: Fetch sources
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'

- name: Install required Python packages
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev-pytest]
pip freeze
- name: Run the integration tests
env:
API_KEY: ${{ secrets.API_KEY }}
GRIDPOOL_ID: ${{ secrets.GRIDPOOL_ID }}
run: |
pytest -vv integration_tests/
timeout-minutes: 10


2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* Remove dependency to `googleapis-common-protos`
* Replace `Energy` with `Power` for the `quantity` representation
* Add str function for `DeliveryPeriod` object
* Add integration tests for the API
* Add an equality function to the Order type

## Bug Fixes

Expand Down
Loading

0 comments on commit b9d9985

Please sign in to comment.