Using bundletester with tox

Hi guys, I am trying to get bundletester working while testing my charm(specifically, to deploy the built local charm into local lxd via amulet framework)

the command I used in tox.ini for invoking is:

bundletester -vl DEBUG -r json -o func-results.json --no-destroy

But I encountered with the following error:

func27 run-test-pre: PYTHONHASHSEED='0'
func27 runtests: commands[0] | bundletester -vl DEBUG -r json -o func-results.json --no-destroy
DEBUG:bundletester.utils:Updating JUJU_MODEL: "" -> "lxd-controller:admin/default"
DEBUG:root:Bootstrap environment: lxd-controller:admin/default
DEBUG:deployer.env:Connecting to lxd-controller:admin/default...
DEBUG:jujuclient.connector:Connecting to wss://10.45.92.67:17070/model/e8cc8e88-5b5b-4135-86a3-21c89da51e
c5/api
DEBUG:deployer.env:Connected.
DEBUG:deployer.env: Terminating machines forcefully
INFO:deployer.env:  Waiting for machine termination
DEBUG:jujuclient.connector:Connecting to wss://10.45.92.67:17070/model/e8cc8e88-5b5b-4135-86a3-21c89da51e
c5/api
DEBUG:root:Waiting for applications to be removed...
DEBUG:runner:call ['/home/ubuntu/tmp/builds/hraftd/.tox/func27/bin/charm-proof'] (cwd: /tmp/bundletester-
00FVWx/hraftd)
DEBUG:runner:I: `display-name` not provided, add for custom naming in the UI
DEBUG:runner:Exit Code: 0
DEBUG:deployer.env: Terminating machines forcefully
INFO:deployer.env:  Waiting for machine termination
DEBUG:jujuclient.connector:Connecting to wss://10.45.92.67:17070/model/e8cc8e88-5b5b-4135-86a3-21c89da51e
c5/api
DEBUG:root:Waiting for applications to be removed...
DEBUG:runner:call ['/tmp/bundletester-00FVWx/hraftd/tests/10-deploy'] (cwd: /tmp/bundletester-00FVWx/hraf
td)
DEBUG:runner:2019-03-13 16:34:24 Starting deployment of lxd-controller:admin/default
DEBUG:runner:2019-03-13 16:34:24 Deploying applications...
DEBUG:runner:2019-03-13 16:34:24  Deploying application hraftd using /tmp/charmzo8s9own/xenial/hraftd
DEBUG:runner:2019-03-13 16:34:25 Error deploying application 'hraftd'
DEBUG:runner:2019-03-13 16:34:25 Command (juju deploy -m lxd-controller:admin/default --series xenial /tm
p/charmzo8s9own/xenial/hraftd hraftd) Output:
DEBUG:runner:
DEBUG:runner: ERROR cannot repackage charm: symlink ".tox/func27/include/python2.7" is absolute: "/usr/in
clude/python2.7"
DEBUG:runner:
DEBUG:runner:2019-03-13 16:34:25 Deployment stopped. run time: 0.82
DEBUG:runner:E

I consider using bundletester with tox is a common practice in testing, but I didn’t see many issues relate to my case except this

Reference info
tox: tox-3.7.0
dev os: ubuntu xenial
juju version: 2.5.2-xenial-amd64
charm-tools: 2.5.2

So this issue is related to this bug: Bug #1813799 “juju unable to deploy a local charm with absolute ...” : Bugs : juju

Juju 2.6 and the 2.5 edge track support adding a .jujuignore file to your charm that helps it identify build artifacts that are not actually part of the charm so that Juju doesn’t fuss about this.

Juju has to fuss about it because you’ve got symlinks as part of the charm that won’t exist on the deployed charm in a real environment.

I think if you test out the edge snaps and add your .tox setup to your .jujuignore file you’ll be in good shape.

Thank you for your confirmation!

I appreciate this conservative behaviour of juju

But walking on the edge of the blade makes me feel paranoid

I will regress to using plain bundletester without tox until juju-2.6 released

1 Like

Understand. It should be in an updated stable release of 2.5 in the near future as well so keep an eye out.

1 Like