Skip to content

Commit

Permalink
Fix integration tests and docs for testing. (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
javierdelapuente authored May 7, 2024
1 parent 50d0497 commit 83b3df5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
24 changes: 9 additions & 15 deletions docs/how-to/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,17 @@ WordPress operator.

To build and deploy wordpress-k8s charm from source follow the steps below.

#### Docker image build
#### Rockcraft image build and upload

Build the `wordpress.Dockerfile` image with the following command.
Enable MicroK8S registry:

```
docker build -t wordpress -f wordpress.Dockerfile .
```

#### Microk8s upload docker artifacts
microk8s enable registry

For microk8s to pick up the locally built image, you must export the image and import it within
microk8s.
The following commands import the images in the Docker daemon and push them into
the registry:

```
docker save wordpress > wordpress.tar
microk8s ctr image import wordpress.tar
```
cd [project_dir]/wordpress_rock && rockcraft pack
skopeo --insecure-policy copy --dest-tls-verify=false oci-archive:wordpress_1.0_amd64.rock docker://localhost:32000/wordpress:latest

#### Build the charm

Expand All @@ -58,8 +52,8 @@ charmcraft pack
Deploy the locally built WordPress charm with the following command.

```
juju deploy ./wordpress-k8s_ubuntu-22.04-amd64_ubuntu-20.04-amd64.charm \
--resource wordpress-image=wordpress
juju deploy ./wordpress-k8s_ubuntu-22.04-amd64.charm \
--resource wordpress-image=localhost:32000/wordpress:latest
```

You should now be able to see your local wordpress-k8s charm progress through the stages of the
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ juju deploy wordpress-k8s
The following commands deploy the mysql-k8s charm and integrate it with the wordpress-k8s charm.

```
juju deploy mysql-k8s
juju deploy mysql-k8s --trust
# 'database' interface is required since mysql-k8s charm provides multiple compatible interfaces
juju relate wordpress-k8s mysql-k8s:database
Expand Down
4 changes: 1 addition & 3 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ async def wordpress_fixture(
@pytest_asyncio.fixture(scope="module")
async def prepare_mysql(ops_test: OpsTest, wordpress: WordpressApp, model: Model):
"""Deploy and relate the mysql-k8s charm for integration tests."""
await ops_test.juju(
"deploy", "mysql-k8s", "--channel=8.0/candidate", "--revision=75", "--trust"
)
await ops_test.juju("deploy", "mysql-k8s", "--channel=8.0/candidate", "--trust")
await model.wait_for_idle(status="active", apps=["mysql-k8s"], timeout=30 * 60)
await model.relate(f"{wordpress.name}:database", "mysql-k8s:database")
await model.wait_for_idle(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ async def test_uploads_owner(wordpress: WordpressApp, ops_test: OpsTest):

retcode, stdout, _ = await ops_test.run(*cmd)
assert retcode == 0
assert "584792" == stdout
assert "584792" == stdout.strip()

0 comments on commit 83b3df5

Please sign in to comment.