Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration: completely remove LocalHarness. #912

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 2 additions & 4 deletions tests/integration/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,15 @@ 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()
elif config.SUBSTRATE == "juju":
h = harness.JujuHarness()
else:
raise harness.HarnessError(
"TEST_SUBSTRATE must be one of: local, lxd, multipass, juju"
"TEST_SUBSTRATE must be one of: lxd, multipass, juju"
)

yield h
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.

Loading