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

ops_test.model.deploy behavior not the same as juju 3.6-beta deploy behavior with respect to chosen base of application to deploy #1090

Open
shayancanonical opened this issue Aug 13, 2024 · 3 comments
Labels
area/application kind/bug indicates a bug in the project priority/normal normal priority

Comments

@shayancanonical
Copy link

shayancanonical commented Aug 13, 2024

Description

We are using ops_test.model.deploy in our integration tests. While testing with juju 3.4.4 (along with python-libjuju ^3.2.2) we are able to run the following code:

await ops_test.model.deploy(
    "mysql-test-app",
    application_name="mysql-test-app1",
    num_units=1,
    channel="latest/edge",
)

However, while testing with juju 3.6-beta2 (along with python-libjuju 3.5.2.0), running the above code pulls in base ubuntu@20.04/stable sometimes and base ubuntu@22.04/stable other times. The charm mysql-test-app is available for both focal and jammy.

Example of the same code but different bases pulled:

Because (likely) juju 3.6 no longer supports certain bases (like ubuntu@20.04/stable), the default base python-libjuju uses in ops_test.model.deploy() fails with an error trace (shown in the reproduce section)

Urgency

Annoying bug in our test suite

Python-libjuju version

3.5.2.0

Juju version

3.6-beta2-ubuntu-amd64

Reproduce / Test

Using:

await ops_test.model.deploy(
    "mysql-test-app",
    application_name="mysql-test-app1",
    num_units=1,
    channel="latest/edge",
)

We get the following trace:

=============================================== FAILURES ================================================
_________________________________________ test_build_and_deploy _________________________________________
Traceback (most recent call last):
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/_pytest/runner.py", line 341, in from_call
    result: Optional[TResult] = func()
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/_pytest/runner.py", line 262, in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_hooks.py", line 433, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_manager.py", line 112, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_callers.py", line 155, in _multicall
    return outcome.get_result()
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_result.py", line 108, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_callers.py", line 80, in _multicall
    res = hook_impl.function(*args)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/_pytest/runner.py", line 177, in pytest_runtest_call
    raise e
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/_pytest/runner.py", line 169, in pytest_runtest_call
    item.runtest()
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/_pytest/python.py", line 1792, in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_hooks.py", line 433, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_manager.py", line 112, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_callers.py", line 155, in _multicall
    return outcome.get_result()
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_result.py", line 108, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pluggy/_callers.py", line 80, in _multicall
    res = hook_impl.function(*args)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/_pytest/python.py", line 194, in pytest_pyfunc_call
    result = testfunction(**testargs)
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/pytest_asyncio/plugin.py", line 532, in inner
    _loop.run_until_complete(task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/shayanp/code/mysql-operator/tests/integration/test_deploy_base.py", line 16, in test_build_and_deploy
    await ops_test.model.deploy(
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/juju/model.py", line 1841, in deploy
    return await self._deploy(
  File "/home/shayanp/code/mysql-operator/.tox/integration/lib/python3.10/site-packages/juju/model.py", line 2163, in _deploy
    raise JujuError('\n'.join(errors))
juju.errors.JujuError: base "ubuntu@20.04/stable" is not supported, supported bases are: ubuntu@22.04
------------------------------------------ Captured log setup -----------------------------------------

Using juju 3.6-beta2 directly:

shayanp@brisbane:~/code/mysql-operator$ juju3.6.beta deploy -n 1 mysql-test-app 
Deployed "mysql-test-app" from charm-hub charm "mysql-test-app", revision 46 in channel latest/stable on ubuntu@22.04/stable
shayanp@brisbane:~/code/mysql-operator$ juju3.6.beta deploy -n 1 mysql-test-app mysql-test-app2
Deployed "mysql-test-app2" from charm-hub charm "mysql-test-app", revision 46 in channel latest/stable on ubuntu@22.04/stable
shayanp@brisbane:~/code/mysql-operator$ juju3.6.beta deploy -n 1 mysql-test-app mysql-test-app3
Deployed "mysql-test-app3" from charm-hub charm "mysql-test-app", revision 46 in channel latest/stable on ubuntu@22.04/stable
@hmlanigan
Copy link
Member

@shayancanonical are you able to work around this issue by specifying the base to use?

@hmlanigan hmlanigan added the priority/normal normal priority label Aug 15, 2024
@shayancanonical
Copy link
Author

@hmlanigan yes, i had to explicitly specify the base as a workaround to continue with testing our charms with juju 3.6-beta

@Aflynn50 Aflynn50 added the kind/bug indicates a bug in the project label Aug 22, 2024
taurus-forever added a commit to canonical/mysql-k8s-operator that referenced this issue Sep 17, 2024
…issue

The test is randomly failing on libjuju 3.5.2.0 with Juju 3.6-beta2,
it is a known issue reported as juju/python-libjuju#1090

As a (temporary?) workaround lets add a base here.
@taurus-forever
Copy link

taurus-forever commented Sep 17, 2024

Hi, we have started testing juju 3.6 nightly and it affects our CI.
JFMI: is the fix planned here anytime soon (as Juju 3.6 LTS is approaching).

Thank you!

taurus-forever added a commit to canonical/mysql-k8s-operator that referenced this issue Sep 18, 2024
…#506)

* [DPE-5480] Add base to test_multi_relations.py to workaround libjuju issue

The test is randomly failing on libjuju 3.5.2.0 with Juju 3.6-beta2,
it is a known issue reported as juju/python-libjuju#1090

As a (temporary?) workaround lets add a base here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/application kind/bug indicates a bug in the project priority/normal normal priority
Projects
None yet
Development

No branches or pull requests

4 participants