test_k8s_common.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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_UKP_US_VFKP_TC_001
  16. # Execute k8s_common role in manager & compute nodes with os installed centos 7.8
  17. - name: OMNIA_UKP_US_VFKP_TC_001
  18. hosts: manager, compute
  19. vars_files:
  20. - test_vars/test_k8s_common_vars.yml
  21. tasks:
  22. - block:
  23. - name: Call common role
  24. include_role:
  25. name: ../roles/k8s_common
  26. tags: TC_001
  27. - name: Checking common packages installation status
  28. command: "'{{ item }}' --version"
  29. with_items:
  30. - "{{ common_packages }}"
  31. register: common_packages_status
  32. changed_when: false
  33. ignore_errors: True
  34. tags: TC_001, VERIFY_001
  35. - name: Checking K8s packages installation status
  36. command: "'{{ item }}' version"
  37. with_items:
  38. - "{{ k8_packages }}"
  39. register: k8s_packages_status
  40. changed_when: false
  41. ignore_errors: True
  42. tags: TC_001, VERIFY_001
  43. - name: Checking docker service status
  44. systemd:
  45. name: docker
  46. register: docker_service
  47. tags: TC_001, VERIFY_001
  48. - name: Checking K8s service status
  49. systemd:
  50. name: kubelet
  51. register: kubelet_service
  52. tags: TC_001, VERIFY_001
  53. - name: Validate common & K8s packages status
  54. assert:
  55. that:
  56. - "'command not found' not in {{ item }}"
  57. fail_msg: "{{ packages_status_fail_msg }}"
  58. success_msg: "{{ packages_status_success_msg }}"
  59. with_items:
  60. - "{{ common_packages_status.results }}"
  61. - "{{ k8s_packages_status.results }}"
  62. tags: TC_001, VERIFY_001
  63. - name: Validating docker service status
  64. assert:
  65. that:
  66. - docker_service.status.ActiveState == 'active'
  67. fail_msg: "{{ docker_service_fail_msg }}"
  68. success_msg: "{{ docker_service_success_msg }}"
  69. tags: TC_001, VERIFY_001
  70. - name: Validating K8s service status
  71. assert:
  72. that:
  73. - kubelet_service.status.ActiveState == 'active'
  74. fail_msg: "{{ kubelet_service_fail_msg }}"
  75. success_msg: "{{ kubelet_service_success_msg }}"
  76. tags: TC_001, VERIFY_001
  77. # Testcase OMNIA_UKP_US_VFKP_TC_002
  78. # Execute k8s_common role in manager & compute nodes with common and K8s packages already installed
  79. - name: OMNIA_UKP_US_VFKP_TC_002
  80. hosts: manager, compute
  81. vars_files:
  82. - test_vars/test_k8s_common_vars.yml
  83. tasks:
  84. - block:
  85. - name: Call common role
  86. include_role:
  87. name: ../roles/k8s_common
  88. tags: TC_002, VERIFY_002
  89. - name: Checking common packages installation status
  90. command: "'{{ item }}' --version"
  91. with_items:
  92. - "{{ common_packages }}"
  93. register: common_packages_status
  94. changed_when: false
  95. ignore_errors: True
  96. tags: TC_002, VERIFY_002
  97. - name: Checking K8s packages installation status
  98. command: "'{{ item }}' version"
  99. with_items:
  100. - "{{ k8_packages }}"
  101. register: k8s_packages_status
  102. changed_when: false
  103. ignore_errors: True
  104. tags: TC_002, VERIFY_002
  105. - name: Checking docker service status
  106. systemd:
  107. name: docker
  108. register: docker_service
  109. tags: TC_002, VERIFY_002
  110. - name: Checking K8s service status
  111. systemd:
  112. name: kubelet
  113. register: kubelet_service
  114. tags: TC_002, VERIFY_002
  115. - name: Validate common & K8s packages status
  116. assert:
  117. that:
  118. - "'command not found' not in {{ item }}"
  119. fail_msg: "{{ packages_status_fail_msg }}"
  120. success_msg: "{{ packages_status_success_msg }}"
  121. quiet: true
  122. with_items:
  123. - "{{ common_packages_status.results }}"
  124. - "{{ k8s_packages_status.results }}"
  125. tags: TC_002, VERIFY_002
  126. - name: Validating docker service status
  127. assert:
  128. that:
  129. - docker_service.status.ActiveState == 'active'
  130. fail_msg: "{{ docker_service_fail_msg }}"
  131. success_msg: "{{ docker_service_success_msg }}"
  132. tags: TC_002, VERIFY_002
  133. - name: Validating K8s service status
  134. assert:
  135. that:
  136. - kubelet_service.status.ActiveState == 'active'
  137. fail_msg: "{{ kubelet_service_fail_msg }}"
  138. success_msg: "{{ kubelet_service_success_msg }}"
  139. tags: TC_002, VERIFY_002