Skip to content

Commit 1915cf0

Browse files
committed
Add an integration test for charmcraft base check
1 parent 786f238 commit 1915cf0

5 files changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright 2021 Canonical Ltd.
2+
# See LICENSE file for licensing details.
3+
type: charm
4+
bases:
5+
- build-on:
6+
- name: "ubuntu"
7+
channel: "20.04"
8+
run-on:
9+
- name: "ubuntu"
10+
channel: "20.04"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
options:
2+
status:
3+
type: string
4+
default: "active"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
status="$(config-get status)"
4+
5+
if [[ "$status" == "error" ]]; then
6+
if [[ -e .errored ]]; then
7+
status="active"
8+
else
9+
touch .errored
10+
exit 1
11+
fi
12+
fi
13+
status-set "$status"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: charm
2+
summary: "test"
3+
description: "test"
4+
maintainers: ["test"]

tests/integration/test_model.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,18 @@ async def test_deploy_local_charm(event_loop):
158158
assert model.units['charm/0'].workload_status == 'active'
159159

160160

161+
@base.bootstrapped
162+
@pytest.mark.asyncio
163+
async def test_deploy_local_charm_base_charmcraft_yaml(event_loop):
164+
charm_path = HERE_DIR / 'charm-base-charmcraft-yaml'
165+
166+
async with base.CleanModel() as model:
167+
await model.deploy(str(charm_path))
168+
assert 'charm' in model.applications
169+
await model.wait_for_idle(status="active")
170+
assert model.units['charm/0'].workload_status == 'active'
171+
172+
161173
@base.bootstrapped
162174
@pytest.mark.asyncio
163175
async def test_wait_local_charm_blocked(event_loop):

0 commit comments

Comments
 (0)