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.

79 lines
3.5 KiB

  1. #!/bin/bash
  2. set -euxo pipefail
  3. export PYPATH=$([[ ! "$CI_JOB_NAME" =~ "coreos" ]] && echo /usr/bin/python || echo /opt/bin/python)
  4. echo "CI_JOB_NAME is $CI_JOB_NAME"
  5. echo "PYPATH is $PYPATH"
  6. pwd
  7. ls
  8. echo ${PWD}
  9. export ANSIBLE_REMOTE_USER=$SSH_USER
  10. export ANSIBLE_BECOME=true
  11. export ANSIBLE_BECOME_USER=root
  12. cd tests && make create-${CI_PLATFORM} -s ; cd -
  13. ansible-playbook tests/cloud_playbooks/wait-for-ssh.yml
  14. # CoreOS needs auto update disabled
  15. if [[ "$CI_JOB_NAME" =~ "coreos" ]]; then
  16. ansible all -m raw -a 'systemctl disable locksmithd'
  17. ansible all -m raw -a 'systemctl stop locksmithd'
  18. fi
  19. # Check out latest tag if testing upgrade
  20. test "${UPGRADE_TEST}" != "false" && git fetch --all && git checkout "$KUBESPRAY_VERSION"
  21. # Checkout the CI vars file so it is available
  22. test "${UPGRADE_TEST}" != "false" && git checkout "${CI_BUILD_REF}" tests/files/${CI_JOB_NAME}.yml
  23. # Create cluster
  24. ansible-playbook ${LOG_LEVEL} -e @${CI_TEST_VARS} -e local_release_dir=${PWD}/downloads --limit "all:!fake_hosts" cluster.yml
  25. # Repeat deployment if testing upgrade
  26. if [ "${UPGRADE_TEST}" != "false" ]; then
  27. test "${UPGRADE_TEST}" == "basic" && PLAYBOOK="cluster.yml"
  28. test "${UPGRADE_TEST}" == "graceful" && PLAYBOOK="upgrade-cluster.yml"
  29. git checkout "${CI_BUILD_REF}"
  30. ansible-playbook ${LOG_LEVEL} -e @${CI_TEST_VARS} -e local_release_dir=${PWD}/downloads --limit "all:!fake_hosts" $PLAYBOOK
  31. fi
  32. # Tests Cases
  33. ## Test Master API
  34. ansible-playbook -e ansible_python_interpreter=${PYPATH} --limit "all:!fake_hosts" tests/testcases/010_check-apiserver.yml $LOG_LEVEL
  35. ## Test that all pods are Running
  36. ansible-playbook -e ansible_python_interpreter=${PYPATH} --limit "all:!fake_hosts" tests/testcases/015_check-pods-running.yml $LOG_LEVEL
  37. ## Test pod creation and ping between them
  38. ansible-playbook -e ansible_python_interpreter=${PYPATH} --limit "all:!fake_hosts" tests/testcases/030_check-network.yml $LOG_LEVEL
  39. ## Advanced DNS checks
  40. ansible-playbook -e ansible_python_interpreter=${PYPATH} --limit "all:!fake_hosts" tests/testcases/040_check-network-adv.yml $LOG_LEVEL
  41. ## Kubernetes conformance tests
  42. ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -e @${CI_TEST_VARS} --limit "all:!fake_hosts" tests/testcases/100_check-k8s-conformance.yml $LOG_LEVEL
  43. ## Idempotency checks 1/5 (repeat deployment)
  44. if [ "${IDEMPOT_CHECK}" = "true" ]; then
  45. ansible-playbook ${LOG_LEVEL} -e @${CI_TEST_VARS} -e ansible_python_interpreter=${PYPATH} -e local_release_dir=${PWD}/downloads --limit "all:!fake_hosts" cluster.yml
  46. fi
  47. ## Idempotency checks 2/5 (Advanced DNS checks)
  48. if [ "${IDEMPOT_CHECK}" = "true" ]; then
  49. ansible-playbook ${LOG_LEVEL} -e @${CI_TEST_VARS} --limit "all:!fake_hosts" tests/testcases/040_check-network-adv.yml
  50. fi
  51. ## Idempotency checks 3/5 (reset deployment)
  52. if [ "${IDEMPOT_CHECK}" = "true" -a "${RESET_CHECK}" = "true" ]; then
  53. ansible-playbook ${LOG_LEVEL} -e @${CI_TEST_VARS} -e ansible_python_interpreter=${PYPATH} -e reset_confirmation=yes --limit "all:!fake_hosts" reset.yml
  54. fi
  55. ## Idempotency checks 4/5 (redeploy after reset)
  56. if [ "${IDEMPOT_CHECK}" = "true" -a "${RESET_CHECK}" = "true" ]; then
  57. ansible-playbook ${LOG_LEVEL} -e @${CI_TEST_VARS} -e ansible_python_interpreter=${PYPATH} -e local_release_dir=${PWD}/downloads --limit "all:!fake_hosts" cluster.yml
  58. fi
  59. ## Idempotency checks 5/5 (Advanced DNS checks)
  60. if [ "${IDEMPOT_CHECK}" = "true" -a "${RESET_CHECK}" = "true" ]; then
  61. ansible-playbook -e ansible_python_interpreter=${PYPATH} --limit "all:!fake_hosts" tests/testcases/040_check-network-adv.yml $LOG_LEVEL
  62. fi