rtortori / rmlab-aci-operator

An Ansible operator that extends Kubernetes APIs in order to implement Cisco ACI Automation
Other
10 stars 0 forks source link

Can we really run the "molecule test -s local" here? #2

Open kentwu1 opened 4 years ago

kentwu1 commented 4 years ago

Hi I'm trying this out and now I already have the operator up and running in my k8s cluster np. Then I started to look into those molecule test cases. I'm still learning molecule but I noticed that the "templates" folder is missing in this repo but looks like we are still referring to it in these 2 files, https://github.com/rtortori/rmlab-aci-operator/blob/master/molecule/test-local/prepare.yml https://github.com/rtortori/rmlab-aci-operator/blob/master/molecule/test-local/playbook.yml

I tried to verify it myself but unfortunately my VM can only install the latest molecule (3.0.2.1) which bailed out right away when I tried to execute this command, noiro@k8s27-node-5:~/rmlab-aci-operator$ sudo molecule test -s local ERROR: 'molecule/local/molecule.yml' glob failed. Exiting.

But my real question is can the test-local be run successfully without the missing templates folder? Or maybe I just miss something completely here?

Thx.

kentwu1 commented 4 years ago

Just a quick update here. I was able to run it with this command "molecule test -s test-local" instead. However it failed here after making some changes to use the latest CR/CRD file and version (v1alpha2) in the prepare and playbook yaml file, https://github.com/rtortori/rmlab-aci-operator/blob/master/molecule/test-local/prepare.yml#L23-L28

And below is the related error messages,

TASK [Create RBAC resources] *** [WARNING]: Unable to find '/home/noiro/rmlab-aci-operator/deploy/role.yaml' in expected paths (use -vvvvv to see paths) fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'template'. Error was a <class 'ansible.errors.AnsibleError'>, original message: the template file /home/noiro/rmlab-aci-operator/deploy/role.yaml could not be found for the lookup"}

I was also able to run the "molecule test -s test-cluster" command successfully, again after making some changes to use the latest CR/CRD file and version (v1alpha2) in the playbook yaml file though.

rtortori commented 4 years ago

Hello, please note that the operator has been built with the operator-sdk at default settings. I then modified everything manually (CRD, CR, playbooks, watches.yaml, etc) to accomplish a POC-level result. Unfortunately I didn't use all features the SDK allows to and definitely didn't create the operator following every best practice possible (i.e. testing). If anyone would like to contribute and make it more production ready, I would be more than happy to get some help and work together!

I believe the error shows up because I removed the content of the deploy directory and create my own structure. I think we need to modify the test files to take the new paths into account - or probably better, refactor the code to be compliant

rtortori commented 3 years ago

A new version of the operator has been released. I still need to customize the molecule tests but I'll try to have a look in the following days