openstack-charmers / zaza

A Python3-only functional test framework for Charms
Apache License 2.0
11 stars 47 forks source link

scoping juju calls to controller #215

Open fnordahl opened 5 years ago

fnordahl commented 5 years ago

In my local environment I may have Zaza performing tests on one juju controller (i.e. localhost-localhost) and at the same time using my juju environmet to interface with a local or remote maas controller.

If I have a model on a different controller in focus Zaza will bomb out.

Example Traceback:

Deploy of bundle completed.
INFO:root:Waiting for environment to settle
INFO:root:Waiting for a unit to appear
INFO:root:Waiting for all units to be idle
INFO:root:Checking workload status of cinder-ceph/0
INFO:root:Checking workload status message of cinder-ceph/0
INFO:root:Checking workload status of ceph-mon/0
INFO:root:Checking workload status message of ceph-mon/0
INFO:root:Checking workload status of ceph-mon/1
INFO:root:Checking workload status message of ceph-mon/1
INFO:root:Checking workload status of ceph-mon/2
INFO:root:Checking workload status message of ceph-mon/2
INFO:root:Checking workload status of ceph-mon-b/0
INFO:root:Checking workload status message of ceph-mon-b/0
INFO:root:Checking workload status of ceph-mon-b/1
INFO:root:Checking workload status message of ceph-mon-b/1
INFO:root:Checking workload status of ceph-mon-b/2
INFO:root:Checking workload status message of ceph-mon-b/2
INFO:root:Checking workload status of ceph-osd/0
INFO:root:Checking workload status message of ceph-osd/0
INFO:root:Checking workload status of ceph-osd/1
INFO:root:Checking workload status message of ceph-osd/1
INFO:root:Checking workload status of ceph-osd/2
INFO:root:Checking workload status message of ceph-osd/2
INFO:root:Checking workload status of ceph-osd-b/0
INFO:root:Checking workload status message of ceph-osd-b/0
INFO:root:Checking workload status of ceph-osd-b/1
INFO:root:Checking workload status message of ceph-osd-b/1
INFO:root:Checking workload status of ceph-osd-b/2
INFO:root:Checking workload status message of ceph-osd-b/2
INFO:root:Checking workload status of ceph-rbd-mirror/0
INFO:root:Checking workload status message of ceph-rbd-mirror/0
INFO:root:Checking workload status of ceph-rbd-mirror-b/0
INFO:root:Checking workload status message of ceph-rbd-mirror-b/0
INFO:root:Checking workload status of cinder/0
INFO:root:Checking workload status message of cinder/0
INFO:root:Checking workload status of glance/0
INFO:root:Checking workload status message of glance/0
INFO:root:Checking workload status of keystone/0
INFO:root:Checking workload status message of keystone/0
INFO:root:Checking workload status of mysql/0
INFO:root:Checking workload status message of mysql/0
INFO:root:Checking workload status of rabbitmq-server/0
INFO:root:Checking workload status message of rabbitmq-server/0
Traceback (most recent call last):
  File "/tmp/tox/func/bin/functest-run-suite", line 10, in <module>
    sys.exit(main())
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/charm_lifecycle/func_test_runner.py", line 130, in main
    bundle=args.bundle)
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/charm_lifecycle/func_test_runner.py", line 62, in func_test_runner
    configure.configure(model_name, test_config['configure'])
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/charm_lifecycle/configure.py", line 45, in configure
    run_configure_list(functions)
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/charm_lifecycle/configure.py", line 35, in run_configure_list
    utils.get_class(func)()
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/charm_tests/glance/setup.py", line 97, in add_lts_image
    image_name=image_name)
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/charm_tests/glance/setup.py", line 46, in add_image
    keystone_session = openstack_utils.get_overcloud_keystone_session()
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/utilities/openstack.py", line 335, in get_overcloud_keystone_session
    return get_keystone_session(get_overcloud_auth(),
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/utilities/openstack.py", line 1401, in get_overcloud_auth
    remote_interface_name='certificates')
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/__init__.py", line 44, in _wrapper
    return run(_run_it())
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/__init__.py", line 32, in run
    return task.result()
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/__init__.py", line 43, in _run_it
    return await f(*args, **kwargs)
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/model.py", line 1188, in async_get_relation_id
    async with run_in_model(model_name) as model:
  File "/tmp/tox/func/lib/python3.6/site-packages/async_generator/_util.py", line 34, in __aenter__
    return await self._agen.asend(None)
  File "/tmp/tox/func/lib/python3.6/site-packages/async_generator/_impl.py", line 366, in step
    return await ANextIter(self._it, start_fn, *args)
  File "/tmp/tox/func/lib/python3.6/site-packages/async_generator/_impl.py", line 197, in __next__
    return self._invoke(first_fn, *first_args)
  File "/tmp/tox/func/lib/python3.6/site-packages/async_generator/_impl.py", line 209, in _invoke
    result = fn(*args)
  File "/tmp/tox/func/lib/python3.6/site-packages/zaza/model.py", line 153, in run_in_model
    await model.connect_model(model_name)
  File "/tmp/tox/func/lib/python3.6/site-packages/juju/model.py", line 554, in connect_model
    return await self.connect(model_name=model_name)
  File "/tmp/tox/func/lib/python3.6/site-packages/juju/model.py", line 511, in connect
    await self._connector.connect_model(model_name, **kwargs)
  File "/tmp/tox/func/lib/python3.6/site-packages/juju/client/connector.py", line 126, in connect_model
    raise JujuConnectionError('Model not found: {}'.format(model_name))
juju.errors.JujuConnectionError: Model not found: admin/zaza-f91698b3b7c3
ERROR: InvocationError: '/tmp/tox/func/bin/functest-run-suite --keep-model'
___________________________________ summary ____________________________________
ERROR:   func: commands failed
ChrisMacNaughton commented 5 years ago

A workaround for this issue would likely be to run JUJU_CONTROLLER=localhost-localhost functest-run-suite. Would you be able to try that and see if it is a viable workaround until we can identify the best way to manage controller as well?