-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add openstack charm func test runner #220
Add openstack charm func test runner #220
Conversation
FIP_MIN=$(ipcalc $CIDR| awk '$1=="HostMin:" {print $2}') | ||
FIP_MIN_ABC=${FIP_MIN%.*} | ||
FIP_MIN_D=${FIP_MIN##*.} | ||
FIP_MIN=${FIP_MIN_ABC}.$(($FIP_MIN_D + 64)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turns out to be gateway_ip + 64 since it's always .1 by default, and as long as this is a /25 or larger it's fine, smaller and it will be greater than the max. It's only until they get the gate fixed anyways...
# We need to set TEST_JUJU3 as well as the constraints file | ||
# Ref: https://github.com/openstack-charmers/zaza/blob/e96ab098f00951079fccb34bc38d4ae6ebb38606/setup.py#L47 | ||
export TEST_JUJU3=1 | ||
export NET_ID=$(openstack network show net_${OS_USERNAME}-psd -f value -c id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making sure this wasn't supposed to be -psd-extra network
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah well spotted, this is the "external" network used for fips so for us thats *-psd-extra
2f92996
to
bd35bb2
Compare
While Im testing mysql-router charm zaza test, I realized that I need below env variable export TEST_ZAZA_BUG_LP1987332=1 related code is here if I didn't set it, there was python array index error. just FYI |
Is there way to use PR test ? like below in commit msg func-test-pr: openstack-charmers/zaza-openstack-tests#1252 |
I beleive this is not needed with juju3 but can add it anyway for those wanted to stick with j2 |
I have a need for this myself so would like to find a way but do not yet know how |
081c7e1
to
26d7a43
Compare
With the current version I can now do a successful build and deploy but hit the following error once the tests start:
|
26d7a43
to
7168957
Compare
I have hopefully fixed the above issue which might have been caused by the fact that had forgotten to export CIDR_EXT but I also notice that both the zaza and zaza-openstack-tests repos have duplicate code for e.g. https://github.com/openstack-charmers/zaza/blob/master/zaza/utilities/generic.py#L92 https://github.com/openstack-charmers/zaza-openstack-tests/blob/master/zaza/openstack/utilities/generic.py#L153 which are slightly different in which env vars they look for and it is not clear which is actually used when a test is run so I am now setting both kinds. |
works now but new issue is that nova-compute vms use a flavor too small to be able to boot any vms |
|
7168957
to
4a41ec5
Compare
I had to make the following change to nova-compute constraints to get things working:
|
4a41ec5
to
2d7f740
Compare
Putting this up for final review since I am now able to successfully run tests. |
I tried running the script but I got the same error: Juju.errors.JujuConnectionError: juju server-version 3.5.3 not supported I changed my juju snap version to 2.9 and pointed the credentials to my juju 2.9 controller and it worked. It is not running the tests. I guess whether it supports juju 3 or not varies from charm to charm. I am running nova-compute charm tests. One thing I noticed is that the timeout is set to 3600 instead of 7200 as Trent suggested in his notes: export TEST_DEPLOY_TIMEOUT=7200 Also one thing I don't like is that there is currently to option to specify the bundle we want to run. For example, for my nova-compute tests I am running for the 2023.2 branch, so it started running jammy-antelope, and then later it will run jammy-bobcat. Assuming jammy-bobcat fails for some reason and I have to run it again. If I have already collected a successful output from jammy-antelope I would not want to let it run again, but instead specify that I want only to run jammy-bobcat. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 for lacking an option to specify the bundle to run (example: run just jammy-bobcat instead of the whole suite that would include jammy-antelope, jammy-bobcat and so on).
2d7f740
to
14a7994
Compare
14a7994
to
62bf204
Compare
done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are nits, and not really related to the tool's core functionality. But thought they are worth adding/fixing.
|
||
usage () { echo "USAGE: --func-test-target | --func-test-pr | --skip-build"; } | ||
|
||
while (($# > 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you call the script without any arguments and you're not inside a charm directory it eventually fails. It should check for the current directory being a charm somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will fix this as a followup patch but have put info in the help message about how to run the tool
FUNC_TEST_TARGET= | ||
SKIP_BUILD=false | ||
|
||
usage () { echo "USAGE: --func-test-target | --func-test-pr | --skip-build"; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this would make it more clear how to use the tool, e.g. that you have to call it from within a charm directory, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have put in a much nicer help message
read -p "Destroy model and run next test? [ENTER]" | ||
# cleanup before next run | ||
model=`juju list-models| egrep -o "^zaza-\S+"|tr -d '*'` | ||
juju destroy-model --no-prompt $model --force --no-wait --destroy-storage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail if you have multiple matching models. Ideally it would also print the name of all the models it will destroy before it does, in case you had created another model with a name starting with zaza.
You can also just tell zaza to destroy the model itself automatically by passing an argument, perhaps we should use that by default and then have an option to switch to manual cleanup behaviour for trying to debug the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you happen to know what the argument is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can fix this as a future patch
Tested working OK for me with glance-simplestreams-sync master |
Supports running Openstack charm functional tests manually in a similar way to OSCI. Includes tool to identify func test targets from the charm.
62bf204
to
faa48ba
Compare
Also includes tool to identify func test targets from the charm.