|
1 | 1 | # DeepOps Testing, CI/CD, and Validation
|
2 | 2 |
|
3 |
| -## DeepOps Continuous Integration Testing |
| 3 | + |
| 4 | +## DeepOps end-to-end testing |
4 | 5 |
|
5 | 6 | The DeepOps project leverages a private Jenkins server to run continuous integration tests. Testing is done using the [virtual](../../virtual) deployment mechanism. Several Vagrant VMs are created, the cluster is deployed, tests are executed, and then the VMs are destroyed.
|
6 | 7 |
|
7 | 8 | The goal of the DeepOps CI is to prevent bugs from being introduced into the code base and to identify when changes in 3rd party platforms have occurred or impacted the DeepOps deployment mechanisms. In general, K8s and Slurm deployment issues are detected and resolved with urgency. Many components of DeepOps are 3rd party open source tools that may silently fail or suddenly change without notice. The team will make a best-effort to resolve these issues and include regression tests, however there may be times where a fix is unavailable. Historically, this has been an issue with Rook-Ceph and Kubeflow, and those GitHub communities are best equipped to help with resolutions.
|
8 | 9 |
|
9 |
| -### Testing Methodi |
| 10 | +### Testing Method |
10 | 11 |
|
11 | 12 | DeepOps CI contains two types of automated tests:
|
12 | 13 |
|
@@ -63,6 +64,77 @@ A short description of the nightly testing is outlined below. The full suit of t
|
63 | 64 | | MIG configuration | | | | No testing support
|
64 | 65 |
|
65 | 66 |
|
| 67 | +## DeepOps Ansible role testing |
| 68 | + |
| 69 | +A subset of the Ansible roles in DeepOps have tests defined using [Ansible Molecule](https://molecule.readthedocs.io/en/latest/). |
| 70 | +This testing mechanism allows the roles to be tested individually, providing additional test signal to identify issues which do not appear in the end-to-end tests. |
| 71 | +These tests are run automatically for each pull request using [Github Actions](https://github.com/NVIDIA/deepops/actions). |
| 72 | + |
| 73 | +Molecule testing runs the Ansible role in quesiton inside a Docker container. |
| 74 | +As such, not all roles will be easy to test witth this mechanism. |
| 75 | +Roles which mostly involve installing software, configuring services, or executing scripts should generally be possible to test. |
| 76 | +Roles which rely on the presence of specific hardware (such as GPUs), which reboot the nodes they act on, or which make changes to kernel configuration are going to be harder to test with Molecule. |
| 77 | + |
| 78 | +### Defining Molecule tests for a new role |
| 79 | + |
| 80 | +To add Molecule tests to a new role, the following procedure can be used. |
| 81 | + |
| 82 | +1. Ensure you have Docker installed in your development environment |
| 83 | + |
| 84 | +2. Install Ansible Molecule in your development environment |
| 85 | + |
| 86 | +``` |
| 87 | +$ python3 -m pip install "molecule[docker,lint]" |
| 88 | +``` |
| 89 | + |
| 90 | +3. Initialize Molecule in your new role |
| 91 | + |
| 92 | +``` |
| 93 | +$ cd deepops/roles/<your-role> |
| 94 | +$ molecule init scenario -r <your-role> --driver docker |
| 95 | +``` |
| 96 | + |
| 97 | +4. In the file `molecule/default/molecule.yml`, define the list of platforms to be tested. |
| 98 | +DeepOps currently supports operating systems based on Ubuntu 18.04, Ubuntu 20.04, EL7, and EL8. |
| 99 | +To test these stacks, the following `platforms` stanza can be used. |
| 100 | + |
| 101 | +``` |
| 102 | +platforms: |
| 103 | + - name: ubuntu-1804 |
| 104 | + image: geerlingguy/docker-ubuntu1804-ansible |
| 105 | + pre_build_image: true |
| 106 | + - name: ubuntu-2004 |
| 107 | + image: geerlingguy/docker-ubuntu2004-ansible |
| 108 | + pre_build_image: true |
| 109 | + - name: centos-7 |
| 110 | + image: geerlingguy/docker-centos7-ansible |
| 111 | + pre_build_image: true |
| 112 | + - name: centos-8 |
| 113 | + image: geerlingguy/docker-centos8-ansible |
| 114 | + pre_build_image: true |
| 115 | +``` |
| 116 | + |
| 117 | +5. If you haven't already, define your role's metadata in the file `meta/main.yml`. |
| 118 | +A sample `meta.yml` is shown here: |
| 119 | + |
| 120 | +``` |
| 121 | +galaxy_info: |
| 122 | + role_name: <your-role> |
| 123 | + namespace: deepops |
| 124 | + author: DeepOps Team |
| 125 | + company: NVIDIA |
| 126 | + description: <your-description> |
| 127 | + license: 3-Clause BSD |
| 128 | + min_ansible_version: 2.9 |
| 129 | +``` |
| 130 | + |
| 131 | +6. Once this is done, verify that your role executes successfully in the Molecule environment by running `molecule test`. If you run into any issues, consult the [Molecule documentation](https://molecule.readthedocs.io/en/latest/index.html) for help resolving them. |
| 132 | + |
| 133 | +7. (optional) In addition to testing successful execution, you can add additional tests which will be run after your role completes in a file `molecule/default/verify.yml`. This is an Ansible playbook that will run in the same environment as your playbook ran. For a simple example of such a verify playbook, see the [Enroot role](https://github.com/NVIDIA/ansible-role-enroot/blob/master/molecule/default/verify.yml). |
| 134 | + |
| 135 | +8. Once you're confident that your new tests are all passing, add your role to the `deepops-role` section in the `.github/workflows/molecule.yml` file. |
| 136 | + |
| 137 | + |
66 | 138 | ## DeepOps Deployment Validation
|
67 | 139 |
|
68 | 140 | The Slurm and Kubernetes deployment guides both document cluster verification steps. These should be run during the installation process to validate a GPU workload can be executed on the cluster.
|
|
0 commit comments