Fuel CCP - Tests sub-project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

post_install_k8s_checks.py 1.4KB

123456789101112131415161718192021222324252627282930313233
  1. # Copyright 2016 Mirantis, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  4. # not use this file except in compliance with the License. You may obtain
  5. # 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, WITHOUT
  11. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  12. # License for the specific language governing permissions and limitations
  13. # under the License.
  14. from devops.helpers import helpers
  15. def check_calico_network(remote, k8sclient):
  16. dns_pod = [
  17. pod for pod in k8sclient.pods.full_list()
  18. if 'kubedns' in pod.name][0]
  19. pods_json_raw = k8sclient.pods.get(
  20. name=dns_pod.name, namespace=dns_pod.metadata.namespace)._data
  21. pods_json = pods_json_raw.to_dict()
  22. pod_ip = pods_json['status']['pod_ip']
  23. cmd = "ping -q -c1 -w10 {0}".format(pod_ip)
  24. helpers.wait(remote.execute(cmd)['exit_code'] == 0,
  25. timeout_msg='Timeout waiting responce from node with '
  26. 'dns_pod {0} '.format(pod_ip))
  27. options = 'ipip,nat-outgoing'
  28. calico_options = remote.execute(
  29. 'calicoctl pool show --ipv4')['stdout'][3].split('|')[2].strip()
  30. assert calico_options == options