Skip to content

Commit f2e50b8

Browse files
authored
Merge pull request #681 from cderici/unit-test-fix
#681 #### Description Looks like a unit test has slipped when we were landing #679 . This PR fixes that, along with other CI problems in pylibjuju. #### QA Steps CI tests should pass. #### Notes & Discussion This PR will act as a set of changes required to fix up the libjuju CI. There seems to be some configuration issues in juju-qa-jenkins too. ~~This shouldn't land until we see all green in the CI.~~ We have some intermittent failures about internal event handling that will be addressed later. - [x] So the time out we see in the integration tests are caused by the ephemeral node configurations on aws, the jobs spawn machines that are not powerful enough to run the tests within 120 mins (global timeout). juju/juju-qa-jenkins#24 will fix that. - [x] The `check-merge` job will be fixed when the [detect-merge-go-version](https://github.com/juju/juju-qa-jenkins/blob/0e87aff16e6e83908926292709b88cf6a153dd5f/jobs/github/github-check-merge.yml#L143) builder is excluded from the python-libjuju jobs.
2 parents 9281e43 + fde499a commit f2e50b8

10 files changed

Lines changed: 30 additions & 13 deletions

File tree

juju/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ async def add_local_resources(self, application, entity_url, metadata, resources
18581858
'description': '',
18591859
'fingerprint': '',
18601860
'name': name,
1861-
'path': path,
1861+
'path': Path(path).name,
18621862
'revision': 0,
18631863
'size': 0,
18641864
'type_': resource_type,

tests/bundle/mini-bundle.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
series: xenial
21
applications:
32
ghost:
43
charm: "ghost"
54
channel: stable
65
num_units: 1
76
mysql:
87
charm: "mysql"
9-
channel: stable
8+
channel: candidate
109
num_units: 1
1110
relations:
1211
- ["ghost", "mysql"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
applications:
2+
file-resource-charm:
3+
charm: ./file-resource-charm
4+
num_units: 1
5+
resources:
6+
file-res: ./file-resource-charm/test.file

tests/integration/bundle/bundle-include-file.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
series: xenial
21
applications:
32
ghost:
43
charm: "ghost"
@@ -8,7 +7,7 @@ applications:
87
config: include-file://config1.yaml
98
mysql:
109
charm: "mysql"
11-
channel: stable
10+
channel: candidate
1211
num_units: 1
1312
test:
1413
charm: "../charm"

tests/integration/bundle/test-overlays/bundle-with-overlay-multi.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
series: xenial
21
applications:
32
ghost:
43
charm: "ghost"
54
channel: stable
65
num_units: 1
76
mysql:
87
charm: "mysql"
9-
channel: stable
8+
channel: candidate
109
num_units: 1
1110
relations:
1211
- ["ghost", "mysql"]

tests/integration/bundle/test-overlays/test-multi-overlay.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ applications:
1111
memcached:
1212
mysql:
1313
charm: "mysql"
14-
channel: stable
14+
channel: candidate
1515
num_units: 1

tests/integration/bundle/test-overlays/test-overlay.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ applications:
77
num_units: 1
88
mysql:
99
charm: "mysql"
10-
channel: stable
10+
channel: candidate
1111
num_units: 1
1212
relations:
1313
- ["ghost", "mysql"]

tests/integration/test_model.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
MB = 1
2424
GB = 1024
2525
SSH_KEY = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsYMJGNGG74HAJha3n2CFmWYsOOaORnJK6VqNy86pj0MIpvRXBzFzVy09uPQ66GOQhTEoJHEqE77VMui7+62AcMXT+GG7cFHcnU8XVQsGM6UirCcNyWNysfiEMoAdZScJf/GvoY87tMEszhZIUV37z8PUBx6twIqMdr31W1J0IaPa+sV6FEDadeLaNTvancDcHK1zuKsL39jzAg7+LYjKJfEfrsQP+lj/EQcjtKqlhVS5kzsJVfx8ZEd0xhW5G7N6bCdKNalS8mKCMaBXJpijNQ82AiyqCIDCRrre2To0/i7pTjRiL0U9f9mV3S4NJaQaokR050w/ZLySFf6F7joJT mathijs@Qrama-Mathijs' # noqa
26-
HERE_DIR = Path(__file__).absolute().parent
27-
TESTS_DIR = HERE_DIR.parent
26+
HERE_DIR = Path(__file__).absolute().parent # tests/integration
27+
TESTS_DIR = HERE_DIR.parent # tests/
2828
OVERLAYS_DIR = HERE_DIR / 'bundle' / 'test-overlays'
2929

3030

@@ -61,6 +61,20 @@ async def test_deploy_local_bundle_file(event_loop):
6161
timeout=60 * 4)
6262

6363

64+
@base.bootstrapped
65+
@pytest.mark.asyncio
66+
async def test_deploy_bundle_local_resource_relative_path(event_loop):
67+
bundle_file_path = HERE_DIR / 'bundle-file-resource.yaml'
68+
69+
async with base.CleanModel() as model:
70+
await model.deploy(str(bundle_file_path))
71+
72+
app = model.applications.get('file-resource-charm')
73+
assert app
74+
await model.block_until(lambda: (len(app.units) == 1),
75+
timeout=60 * 4)
76+
77+
6478
@base.bootstrapped
6579
@pytest.mark.asyncio
6680
async def test_deploy_local_bundle_include_file(event_loop):

tests/integration/test_unit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async def test_resolve_local(event_loop):
213213
)
214214

215215
try:
216-
await model.wait_for_idle(raise_on_error=False, idle_period=3)
216+
await model.wait_for_idle(raise_on_error=False, idle_period=1)
217217
assert app.units[0].workload_status == 'error'
218218

219219
await app.units[0].resolved()

tests/unit/test_bundle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ async def test_run_no_series(self, event_loop):
347347
model._deploy.assert_called_once()
348348
model._deploy.assert_called_with(charm_url="cs:charm1",
349349
application="application",
350-
series="kubernetes",
350+
series=None,
351351
config="options",
352352
constraints="constraints",
353353
endpoint_bindings="endpoint_bindings",

0 commit comments

Comments
 (0)