Skip to content

Commit

Permalink
integration: completely remove LocalHarness.
Browse files Browse the repository at this point in the history
Signed-off-by: Nashwan Azhari <[email protected]>
  • Loading branch information
Nashwan Azhari committed Dec 17, 2024
1 parent 737e64f commit 9691673
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 101 deletions.
13 changes: 1 addition & 12 deletions tests/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

End to end tests are written in Python. They are built on top of a [Harness](./tests/conftest.py) fixture so that they can run on multiple environments like LXD, Multipass, Juju, or the local machine.
End to end tests are written in Python. They are built on top of a [Harness](./tests/conftest.py) fixture so that they can run on multiple environments like LXD, Multipass, or Juju.

End to end tests can be configured using environment variables. You can see all available options in [./tests/config.py](./tests/config.py).

Expand All @@ -28,17 +28,6 @@ In general, all end to end tests will require specifying the local path to the s

End to end tests are typically run with: `cd tests/integration && tox -e integration`

### Running end to end tests on the local machine

```bash
export TEST_SNAP=$PWD/k8s.snap
export TEST_SUBSTRATE=local

cd tests/integration && tox -e integration
```

> *NOTE*: When running locally, end to end tests that create more than one instance will fail.
### Running end to end tests on LXD containers

First, make sure that you have initialized LXD:
Expand Down
4 changes: 1 addition & 3 deletions tests/integration/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def _generate_inspection_report(h: harness.Harness, instance_id: str):
@pytest.fixture(scope="session")
def h() -> harness.Harness:
LOG.debug("Create harness for %s", config.SUBSTRATE)
if config.SUBSTRATE == "local":
h = harness.LocalHarness()
elif config.SUBSTRATE == "lxd":
if config.SUBSTRATE == "lxd":
h = harness.LXDHarness()
elif config.SUBSTRATE == "multipass":
h = harness.MultipassHarness()
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tests/test_util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
SNAP_NAME = os.getenv("TEST_SNAP_NAME") or "k8s"

# SUBSTRATE is the substrate to use for running the integration tests.
# One of 'local' (default), 'lxd', 'juju', or 'multipass'.
SUBSTRATE = os.getenv("TEST_SUBSTRATE") or "local"
# One of 'lxd' (default), 'juju', or 'multipass'.
SUBSTRATE = os.getenv("TEST_SUBSTRATE") or "lxd"

# SKIP_CLEANUP can be used to prevent machines to be automatically destroyed
# after the tests complete.
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/tests/test_util/harness/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#
from test_util.harness.base import Harness, HarnessError, Instance
from test_util.harness.juju import JujuHarness
from test_util.harness.local import LocalHarness
from test_util.harness.lxd import LXDHarness
from test_util.harness.multipass import MultipassHarness

Expand All @@ -12,7 +11,6 @@
Harness,
Instance,
JujuHarness,
LocalHarness,
LXDHarness,
MultipassHarness,
]
3 changes: 1 addition & 2 deletions tests/integration/tests/test_util/harness/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def __str__(self) -> str:

class Harness:
"""Abstract how integration tests can start and manage multiple machines. This allows
writing integration tests that can run on the local machine, LXD, or Multipass with minimum
effort.
writing integration tests that can run on LXD, or Multipass with minimum effort.
"""

name: str
Expand Down
80 changes: 0 additions & 80 deletions tests/integration/tests/test_util/harness/local.py

This file was deleted.

0 comments on commit 9691673

Please sign in to comment.