test_provision_cdip.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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_DIO_US_CDIP_TC_001
  16. # Execute provison role in management station with os installed centos 7
  17. - name: OMNIA_DIO_US_CDIP_TC_001
  18. hosts: localhost
  19. connection: local
  20. vars_files:
  21. - test_vars/test_provision_vars.yml
  22. - ../roles/provision/vars/main.yml
  23. tasks:
  24. - name: Delete the cobbler container if exits
  25. docker_container:
  26. name: "{{ docker_container_name }}"
  27. state: absent
  28. tags: TC_001
  29. - name: Delete docker image if exists
  30. docker_image:
  31. name: "{{ docker_image_name }}"
  32. tag: "{{ docker_image_tag }}"
  33. state: absent
  34. tags: TC_001
  35. - block:
  36. - name: Call common role
  37. include_role:
  38. name: ../roles/common
  39. vars:
  40. input_config_filename: "{{ test_input_config_filename }}"
  41. - name: Call provision role
  42. include_role:
  43. name: ../roles/provision
  44. tasks_from: "{{ item }}"
  45. with_items:
  46. - "{{ cobbler_image_files }}"
  47. tags: TC_001
  48. - name: Inspect cobbler docker image
  49. docker_image_info:
  50. name: "{{ docker_image_name }}"
  51. register: cobbler_image_status
  52. tags: TC_001,VERIFY_001
  53. - name: Validate cobbler docker image
  54. assert:
  55. that:
  56. - cobbler_image_status.images
  57. fail_msg: "{{ cobbler_img_fail_msg }}"
  58. success_msg: "{{ cobbler_img_success_msg }}"
  59. tags: TC_001,VERIFY_001
  60. - name: Inspect cobbler container
  61. docker_container_info:
  62. name: "{{ docker_container_name }}"
  63. register: cobbler_cnt_status
  64. tags: TC_001,VERIFY_001
  65. - name: Validate cobbler docker container
  66. assert:
  67. that:
  68. - cobbler_cnt_status.exists
  69. fail_msg: "{{ cobbler_cnt_fail_msg }}"
  70. success_msg: "{{ cobbler_cnt_success_msg }}"
  71. tags: TC_001,VERIFY_001
  72. # Testcase OMNIA_DIO_US_CDIP_TC_002
  73. # Execute provison role in management station where cobbler container and image already created
  74. - name: OMNIA_DIO_US_CDIP_TC_002
  75. hosts: localhost
  76. connection: local
  77. vars_files:
  78. - test_vars/test_provision_vars.yml
  79. - ../roles/provision/vars/main.yml
  80. tasks:
  81. - block:
  82. - name: Call common role
  83. include_role:
  84. name: ../roles/common
  85. vars:
  86. input_config_filename: "{{ test_input_config_filename }}"
  87. - name: Call provision role
  88. include_role:
  89. name: ../roles/provision
  90. tags: TC_002
  91. - name: Inspect cobbler docker image
  92. docker_image_info:
  93. name: "{{ docker_image_name }}"
  94. register: cobbler_image_status
  95. tags: TC_002,VERIFY_002
  96. - name: Validate cobbler docker image
  97. assert:
  98. that:
  99. - cobbler_image_status.images
  100. fail_msg: "{{ cobbler_img_fail_msg }}"
  101. success_msg: "{{ cobbler_img_success_msg }}"
  102. tags: TC_002,VERIFY_002
  103. - name: Inspect cobbler container
  104. docker_container_info:
  105. name: "{{ docker_container_name }}"
  106. register: cobbler_cnt_status
  107. tags: TC_002,VERIFY_002
  108. - name: Validate cobbler docker container
  109. assert:
  110. that:
  111. - cobbler_cnt_status.exists
  112. fail_msg: "{{ cobbler_cnt_fail_msg }}"
  113. success_msg: "{{ cobbler_cnt_success_msg }}"
  114. tags: TC_002,VERIFY_002
  115. # Testcase OMNIA_DIO_US_CDIP_TC_003
  116. # Execute provison role in management station where docker service not running
  117. - name: OMNIA_DIO_US_CDIP_TC_003
  118. hosts: localhost
  119. connection: local
  120. vars_files:
  121. - test_vars/test_provision_vars.yml
  122. - ../roles/provision/vars/main.yml
  123. tasks:
  124. - name: Delete the cobbler container if exits
  125. docker_container:
  126. name: "{{ docker_container_name }}"
  127. state: absent
  128. tags: TC_003
  129. - name: Delete docker image if exists
  130. docker_image:
  131. name: "{{ docker_image_name }}"
  132. tag: "{{ docker_image_tag }}"
  133. state: absent
  134. tags: TC_003
  135. - name: Stop docker service
  136. service:
  137. name: docker
  138. state: stopped
  139. tags: TC_003
  140. - block:
  141. - name: Call common role
  142. include_role:
  143. name: ../roles/common
  144. vars:
  145. input_config_filename: "{{ test_input_config_filename }}"
  146. - name: Call provision role
  147. include_role:
  148. name: ../roles/provision
  149. - name: Docker service stopped usecase success message
  150. debug:
  151. msg: "{{ docker_check_success_msg }}"
  152. rescue:
  153. - name: Docker service stopped usecase fail message
  154. fail:
  155. msg: "{{ docker_check_fail_msg }}"
  156. always:
  157. - name: Start docker service
  158. service:
  159. name: docker
  160. state: started
  161. tags: TC_003