charmed-kubernetes / pytest-operator

Apache License 2.0
7 stars 13 forks source link

Unable to deploy a bundle using model.deploy #116

Open Gmerold opened 11 months ago

Gmerold commented 11 months ago

Hello Team,

In my integration tests, I'm not able to deploy a bundle using ops_test.model.deploy as shown in the snippet below:

with ops_test.model_context(COS_MODEL_NAME):
    await ops_test.model.deploy(  # type: ignore[union-attr]
        entity_url="https://charmhub.io/cos-lite",
        trust=True,
    )

The error I'm getting is:

File "/actions-runner/_work/sdcore-tests/sdcore-tests/tests/integration/fixtures.py", line 90, in deploy_cos_lite
    await ops_test.model.deploy(  # type: ignore[union-attr]
  File "/actions-runner/_work/sdcore-tests/sdcore-tests/.tox/integration/lib/python3.10/site-packages/juju/model.py", line 1748, in deploy
    await handler.fetch_plan(url, charm_origin, overlays=overlays)
  File "/actions-runner/_work/sdcore-tests/sdcore-tests/.tox/integration/lib/python3.10/site-packages/juju/bundle.py", line 302, in fetch_plan
    raise JujuError(self.plan.errors)
juju.errors.JujuError: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']

My env is:

Workaround is of course running deployment using ops_test.run, but I'd rather use a proper way to deploy bundles.

BR, Bartek

addyess commented 11 months ago

agreed, this is breaking in the integration tests for this plugin itself https://github.com/charmed-kubernetes/pytest-operator/actions/runs/6582862153?pr=118

@cderici i believe this is an issue with python-libjuju. Do you agree?

cderici commented 11 months ago

@cderici i believe this is an issue with python-libjuju. Do you agree?

Yeah that output looks very weird. I'm not quite sure if it's the pylibjuju client in particular, but definitely something seems to be going on on the Juju side. I'll try to reproduce this today and see what might be happening 👍

cderici commented 11 months ago

@addyess looks like it might be something else, I was able to deploy with the following settings just fine:

pylibjuju master branch tip (basically the same with 3.2.2), juju 3.1.6 on microk8s 1.27.6

python -m asyncio
asyncio REPL 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> from juju import model;m=model.Model();await m.connect()
>>> await m.deploy(entity_url="https://charmhub.io/cos-lite", trust=True)
[<Application entity_id="alertmanager">, <Application entity_id="loki">, <Application entity_id="prometheus">, <Application entity_id="traefik">, <Application entity_id="catalogue">, <Application entity_id="grafana">]
>>>

But as I was writing this, I just realized I saw that weird error from bundles before, and sure enough, looks like I fixed it in a run-by not so long ago in https://github.com/juju/python-libjuju/pull/949, you can see a similar error message in the description.

So basically this issue will go away when we make a new latest release on libjuju, which should be pretty soon 👍