diff --git a/tests/README.md b/tests/README.md index 24b98197f45b424e7f4c8653aaf5ef1f2a6aed2f..b9063561241212049afaea3b0e4eade69a59208e 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,6 +1,15 @@ -# k8s-integration-tests +# Kubespray cloud deployment tests + +## Amazon Web Service + + | Calico | Flannel | Weave | +------------- | ------------- | ------------- | ------------- | +Debian Jessie | [](https://ci.kubespray.io/job/kubespray-aws-calico-jessie) | [](https://ci.kubespray.io/job/kubespray-aws-flannel-jessie/) | [](https://ci.kubespray.io/job/kubespray-aws-weave-jessie/) | +Ubuntu Trusty |[](https://ci.kubespray.io/job/kubespray-aws-calico-trusty/)|[](https://ci.kubespray.io/job/kubespray-aws-flannel-trusty/)|[](https://ci.kubespray.io/job/kubespray-aws-weave-trusty)| +RHEL 7.2 |[](https://ci.kubespray.io/job/kubespray-aws-calico-rhel72/)|[](https://ci.kubespray.io/job/kubespray-aws-flannel-rhel72/)|[](https://ci.kubespray.io/job/kubespray-aws-weave-rhel72/)| +CentOS 7 |[](https://ci.kubespray.io/job/kubespray-aws-calico-centos7/)|[](https://ci.kubespray.io/job/kubespray-aws-flannel-centos7/)|[](https://ci.kubespray.io/job/kubespray-aws-weave-centos7/)| + -*Work In Progress* ## Test environment variables diff --git a/tests/support/aws.groovy b/tests/support/aws.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1d472b8458fc3c94fb09aac3abe0e2f37b987830 --- /dev/null +++ b/tests/support/aws.groovy @@ -0,0 +1,94 @@ +def run(username, credentialsId, ami, network_plugin, aws_access, aws_secret) { + def inventory_path = pwd() + "/inventory/inventory-test.ini" + dir('tests') { + wrap([$class: 'AnsiColorBuildWrapper', colorMapName: "xterm"]) { + try { + create_vm("${env.JOB_NAME}-${env.BUILD_NUMBER}", inventory_path, ami, username, network_plugin, aws_access, aws_secret) + install_cluster(inventory_path, credentialsId, network_plugin) + + test_apiserver(inventory_path, credentialsId) + test_create_pod(inventory_path, credentialsId) + test_network(inventory_path, credentialsId) + } finally { + delete_vm(inventory_path, credentialsId, aws_access, aws_secret) + } + } + } +} + +def create_vm(run_id, inventory_path, ami, username, network_plugin, aws_access, aws_secret) { + ansiblePlaybook( + inventory: 'local_inventory/hosts.cfg', + playbook: 'cloud_playbooks/create-aws.yml', + extraVars: [ + test_id: run_id, + kube_network_plugin: network_plugin, + aws_access_key: [value: aws_access, hidden: true], + aws_secret_key: [value: aws_secret, hidden: true], + aws_ami_id: ami, + aws_security_group: [value: 'sg-cb0327a2', hidden: true], + key_name: 'travis-ci', + inventory_path: inventory_path, + aws_region: 'eu-central-1', + ssh_user: username + ], + colorized: true + ) +} + +def delete_vm(inventory_path, credentialsId, aws_access, aws_secret) { + ansiblePlaybook( + inventory: inventory_path, + playbook: 'cloud_playbooks/delete-aws.yml', + credentialsId: credentialsId, + extraVars: [ + aws_access_key: [value: aws_access, hidden: true], + aws_secret_key: [value: aws_secret, hidden: true] + ], + colorized: true + ) +} + +def install_cluster(inventory_path, credentialsId, network_plugin) { + ansiblePlaybook( + inventory: inventory_path, + playbook: '../cluster.yml', + sudo: true, + credentialsId: credentialsId, + extraVars: [ + kube_network_plugin: network_plugin + ], + extras: "-e '{\"cloud_provider\": true}'", + colorized: true + ) +} + +def test_apiserver(inventory_path, credentialsId) { + ansiblePlaybook( + inventory: inventory_path, + playbook: 'testcases/010_check-apiserver.yml', + credentialsId: credentialsId, + colorized: true + ) +} + +def test_create_pod(inventory_path, credentialsId) { + ansiblePlaybook( + inventory: inventory_path, + playbook: 'testcases/020_check-create-pod.yml', + sudo: true, + credentialsId: credentialsId, + colorized: true + ) +} + +def test_network(inventory_path, credentialsId) { + ansiblePlaybook( + inventory: inventory_path, + playbook: 'testcases/030_check-network.yml', + sudo: true, + credentialsId: credentialsId, + colorized: true + ) +} +return this;