Ansible playbook for test-operator - #12
Conversation
492d538 to
c3b7f22
Compare
Adds an Ansible playbook that allows the tests to be ran by the OpenStack test-operator. The test results are available at /var/lib/AnsibleTests/external_files/test-results.xml.
Removes openshift_client dependency and auth setup/cleanup. Auth will be done declaratively outside of the lightspeed-tests repo.
a814612 to
2476f46
Compare
lpiwowar
left a comment
There was a problem hiding this comment.
Nice one!:) 👍 🎉
Three comments:). We have to really figure out the creation of the dummy resources and the Cluster Role related resources. It might not be part of this playbook but we should be relatively certain about it before we merge.
| @@ -0,0 +1,144 @@ | |||
| --- | |||
There was a problem hiding this comment.
issue (blocking): We have to figure out what to do with the creation of the ClusterRole and the ClusterRoleBinding:
- Can it happen in the ansible test pod? I do not think so but we should check (the mounted SA probably does not have the necessary privileges). If not then where can we put it? Maybe the @malingatembo 's cifmw playbook?
Also, we have to figure out where to create the "dummy" resources:
- Can we create them here for now? If not where will they run?
There was a problem hiding this comment.
@lpiwowar I would not create the ClusterRole and ClusterRoleBinding in Ansible test pod. I was trying that approach and it is messy (that's why I ended up removing all the auth setup/cleanup from this repository).
The dummy resources need to be created before the AnsibleTest CR is created (and before the playbook is executed). Otherwise, the tests will not start running.
The test-operator will throw errors if the AnsibleTest CR is created before the dummy resources. Also, I feel the dummy resources are not related to the lightspeed-tests but they are part of the test-operator setup. I think it would be better to not create them here.
I think everything (dummy and auth resources) should be created in the same place where the AnsibleTest CR will be created. Which I think is Malinga's cifmw playbook, right?
There was a problem hiding this comment.
Which I think is Malinga's cifmw playbook, right?
Sorry! I was too quick with the review yesterday. I'm going to do a proper one soon. You are right, those need to exist prior to the AnsibleTest creation.
I think we have to update the PR from @malingatembo. Maybe you can try to create a stacked PR on top of the @malingatembo's PR and ensure that these resources get created there? 👀 -> https://github.com/openstack-k8s-operators/ci-framework/pulls/malingatembo . It can be a draft for now but once Malinga is done with his job creation we can test the PR you create and potentially merge it with Malinga's PR. Only if you want to. It is a bit of stretch beyond the ticket but it would be nice to do IMO.
For now we are aiming at making this work but in the long term we might want to consider updating test-operator not requiring the dummy resources.
There was a problem hiding this comment.
I agree! I will prepare the PR 👍
lpiwowar
left a comment
There was a problem hiding this comment.
Overall LGTM!:) Thank you! 🎉
I suggest fixing the ansible-lint errors and extending the pre-commit with it.
I'm giving an approve. We have really nothing to lose here and we can polish it later:).
I'm leaving the final merging to @malingatembo though.
| @@ -0,0 +1,146 @@ | |||
| --- | |||
There was a problem hiding this comment.
suggestion (non-blocking): Let's extend the pre-commit checks with ansible-lint [1]. There are couple of minor things ansible-lint is complaining about:
Installed 29 packages in 147ms
WARNING Listing 3 violation(s) that are fatal
yaml[truthy]: Truthy value should be one of [false, true]
playbooks/run_lightspeed_tests.yaml:4
yaml[truthy]: Truthy value should be one of [false, true]
playbooks/run_lightspeed_tests.yaml:27
yaml[truthy]: Truthy value should be one of [false, true]
playbooks/run_lightspeed_tests.yaml:106
Read documentation for instructions on how to ignore specific rule violations.
# Rule Violation Summary
3 yaml profile:basic tags:formatting,yaml
Failed: 3 failure(s), 0 warning(s) in 15 files processed of 20 encountered. Last profile that met the validation criteria was 'min'.
[1]
There was a problem hiding this comment.
thank you! @lpiwowar ansible-lint is added to the pre-commit and the lint errors are fixed.
8531b42 to
e4888dd
Compare
Add ansible-lint pre-commit hook
e4888dd to
df7d046
Compare
OpenStack test-operator with an appropriate
AnsibleTestCR can execute the lightspeed-tests using the committed Ansible playbook.How to run the tests:
Pre-requisities: OpenStack Lightspeed running in your cluster.
Install and run the test-operator with:
# in the test-operator directory make install ENABLE_WEBHOOKS=false make runlightspeed-auth-resources.yamlwith the following content:And run
oc apply -f lightspeed-auth-resources. This will grant Lightspeed service access todefaultservice account used by the test-operator.lightspeed-dummy-resources.yamlwith the following content:And run
oc apply -f lightspeed-dummy-resources.yaml. This will create empty configs that are expected by the test-operator but are not actually used for anything. Without the dummy resources, the test operator will not run the tests.AnsibleTestCR filelightspeed-ansible-test-cr.yamlwith the following content:Run
oc apply -f lightspeed-ansible-test-cr.yamlto run the test suite.If all goes well, you should be able to inspect the logs with
oc logs lightspeed-tests -n openstack-lightspeedand see at the end:The
lightspeed-testspod should report statusCOMPLETED:To re-run the tests, delete the CR and create it again: