test_web_ui.yml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. # Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. # Testcase OMNIA_CRM_US_AWXD_TC_001
  16. # Test case to validate the AWX password with empty string
  17. - name: OMNIA_CRM_US_AWXD_TC_001
  18. hosts: localhost
  19. connection: local
  20. gather_subset:
  21. - 'min'
  22. vars_files:
  23. - ../roles/web_ui/vars/main.yml
  24. - ../roles/common/vars/main.yml
  25. - test_vars/test_web_ui_vars.yml
  26. tasks:
  27. - block:
  28. - name: Test the awx password with empty string
  29. include_tasks: ../roles/web_ui/tasks/awx_password.yml
  30. vars:
  31. no_prompt: true
  32. admin_password: "{{ empty_password }}"
  33. admin_password_confirm: "{{ empty_password }}"
  34. rescue:
  35. - name: Validate error message
  36. assert:
  37. that: fail_msg_pwd_format in msg_pwd_format.msg
  38. success_msg: "{{ validate_password_success_msg }}"
  39. fail_msg: "{{ validate_password_fail_msg }}"
  40. tags: TC_001
  41. # Testcase OMNIA_CRM_US_AWXD_TC_002
  42. # Test case to validate the AWX password with exactly 8 characters
  43. - name: OMNIA_CRM_US_AWXD_TC_002
  44. hosts: localhost
  45. connection: local
  46. gather_subset:
  47. - 'min'
  48. vars_files:
  49. - ../roles/web_ui/vars/main.yml
  50. - ../roles/common/vars/main.yml
  51. - test_vars/test_web_ui_vars.yml
  52. tasks:
  53. - name: Test the awx password with 8 characters
  54. include_tasks: ../roles/web_ui/tasks/awx_password.yml
  55. vars:
  56. no_prompt: true
  57. admin_password: "{{ boundary_password }}"
  58. admin_password_confirm: "{{ boundary_password }}"
  59. tags: TC_002
  60. - name: Validate success message
  61. assert:
  62. that: success_msg_pwd_format in msg_pwd_format.msg
  63. success_msg: "{{ validate_password_success_msg }}"
  64. fail_msg: "{{ validate_password_fail_msg }}"
  65. tags: TC_002
  66. # Testcase OMNIA_CRM_US_AWXD_TC_003
  67. # Test case to validate the AWX password with length greater than 15 characters
  68. - name: OMNIA_CRM_US_AWXD_TC_003
  69. hosts: localhost
  70. connection: local
  71. gather_subset:
  72. - 'min'
  73. vars_files:
  74. - ../roles/web_ui/vars/main.yml
  75. - ../roles/common/vars/main.yml
  76. - test_vars/test_web_ui_vars.yml
  77. tasks:
  78. - name: Test the awx password with length greater than 15 characters
  79. include_tasks: ../roles/web_ui/tasks/awx_password.yml
  80. vars:
  81. no_prompt: true
  82. admin_password: "{{ lengthy_password }}"
  83. admin_password_confirm: "{{ lengthy_password }}"
  84. tags: TC_003
  85. - name: Validate success message
  86. assert:
  87. that: success_msg_pwd_format in msg_pwd_format.msg
  88. success_msg: "{{ validate_password_success_msg }}"
  89. fail_msg: "{{ validate_password_fail_msg }}"
  90. tags: TC_003
  91. # Testcase OMNIA_CRM_US_AWXD_TC_004
  92. # Test case to validate the AWX password when confirm password is given incorrect
  93. - name: OMNIA_CRM_US_AWXD_TC_004
  94. hosts: localhost
  95. connection: local
  96. gather_subset:
  97. - 'min'
  98. vars_files:
  99. - ../roles/web_ui/vars/main.yml
  100. - ../roles/common/vars/main.yml
  101. - test_vars/test_web_ui_vars.yml
  102. tasks:
  103. - block:
  104. - name: Test the awx installation if confirm password is given incorrect
  105. include_tasks: ../roles/web_ui/tasks/awx_password.yml
  106. vars:
  107. no_prompt: true
  108. admin_password: "{{ boundary_password }}"
  109. admin_password_confirm: "{{ lengthy_password }}"
  110. rescue:
  111. - name: Validate error message
  112. assert:
  113. that: fail_msg_pwd_confirm in msg_pwd_confirm.msg
  114. success_msg: "{{ validate_password_success_msg }}"
  115. fail_msg: "{{ validate_password_fail_msg }}"
  116. tags: TC_004
  117. # Testcase OMNIA_CRM_US_AWXD_TC_005
  118. # Test case to validate the AWX password with unsupported strings
  119. - name: OMNIA_CRM_US_AWXD_TC_005
  120. hosts: localhost
  121. connection: local
  122. gather_subset:
  123. - 'min'
  124. vars_files:
  125. - ../roles/web_ui/vars/main.yml
  126. - ../roles/common/vars/main.yml
  127. - test_vars/test_web_ui_vars.yml
  128. tasks:
  129. - block:
  130. - name: Test the awx password with unsupported strings
  131. include_tasks: ../roles/web_ui/tasks/awx_password.yml
  132. vars:
  133. no_prompt: true
  134. admin_password: "{{ unsupported_password }}"
  135. admin_password_confirm: "{{ unsupported_password }}"
  136. rescue:
  137. - name: Validate error message
  138. assert:
  139. that: fail_msg_pwd_format in msg_pwd_format.msg
  140. success_msg: "{{ validate_password_success_msg }}"
  141. fail_msg: "{{ validate_password_fail_msg }}"
  142. tags: TC_005
  143. # Testcase OMNIA_CRM_US_AWXD_TC_006
  144. # Test case to verify the prerequisites are installed and execute the AWX deployment
  145. - name: OMNIA_CRM_US_AWXD_TC_006
  146. hosts: localhost
  147. connection: local
  148. gather_subset:
  149. - 'min'
  150. vars_files:
  151. - ../roles/web_ui/vars/main.yml
  152. - test_vars/test_web_ui_vars.yml
  153. tasks:
  154. - name: Get the docker package facts
  155. package_facts:
  156. manager: auto
  157. tags: TC_006
  158. - name: Check if docker-ce is already installed
  159. debug:
  160. var: ansible_facts.packages['{{ package }}']
  161. tags: TC_006
  162. - block:
  163. - name: Calling the role to be tested
  164. include_role:
  165. name: ../roles/web_ui
  166. tags: TC_006
  167. - name: Check that you can connect to github repo and it returns a status 200
  168. uri:
  169. url: "{{ awx_git_repo }}"
  170. status_code: "{{ return_status }}"
  171. return_content: true
  172. tags: TC_006
  173. - name: Check that you can can connect to AWX UI and it returns a status 200
  174. uri:
  175. url: "{{ awx_url }}"
  176. status_code: "{{ return_status }}"
  177. return_content: true
  178. tags: TC_006
  179. - name: verify awx-server is listening on 80
  180. wait_for:
  181. port: "{{ awx_listening_port }}"
  182. timeout: "{{ time }}"
  183. tags: TC_006
  184. - name: Get the containers count
  185. shell: |
  186. set -o pipefail
  187. docker ps -a | grep awx | wc -l
  188. register: containers_count
  189. changed_when: False
  190. tags: TC_006
  191. - name: Validate the containers count
  192. assert:
  193. that: containers_count.stdout | int >= actual_containers
  194. success_msg: "{{ awx_exists_msg }}"
  195. fail_msg: "{{ awx_not_exists_msg }}"
  196. tags: TC_006
  197. # Testcase OMNIA_CRM_US_AWXD_TC_007
  198. # Test case to verify regression testing
  199. - name: OMNIA_CRM_US_AWXD_TC_007
  200. hosts: localhost
  201. connection: local
  202. gather_subset:
  203. - 'min'
  204. vars_files:
  205. - ../roles/web_ui/vars/main.yml
  206. - test_vars/test_web_ui_vars.yml
  207. tasks:
  208. - block:
  209. - name: Calling the role to be tested
  210. include_role:
  211. name: ../roles/web_ui
  212. tags: TC_007
  213. - name: Check that you can connect to github repo and it returns a status 200
  214. uri:
  215. url: "{{ awx_git_repo }}"
  216. status_code: "{{ return_status }}"
  217. return_content: true
  218. tags: TC_007
  219. - name: Check that you can can connect to AWX UI and it returns a status 200
  220. uri:
  221. url: "{{ awx_url }}"
  222. status_code: "{{ return_status }}"
  223. return_content: true
  224. tags: TC_007
  225. - name: verify awx-server is listening on 80
  226. wait_for:
  227. port: "{{ awx_listening_port }}"
  228. timeout: "{{ time }}"
  229. tags: TC_007
  230. - name: Get the containers count
  231. shell: |
  232. set -o pipefail
  233. docker ps -a | grep awx | wc -l
  234. register: containers_count
  235. changed_when: False
  236. tags: TC_007
  237. - name: Validate the containers count
  238. assert:
  239. that: containers_count.stdout | int >= actual_containers
  240. success_msg: "{{ awx_exists_msg }}"
  241. fail_msg: "{{ awx_not_exists_msg }}"
  242. tags: TC_007