Move common groovy test code for jenkins into git repo and add test result matrix
This commit is contained in:
parent
1771f18437
commit
f5f6e44369
2 changed files with 105 additions and 2 deletions
|
@ -1,6 +1,15 @@
|
|||
# k8s-integration-tests
|
||||
# Kubespray cloud deployment tests
|
||||
|
||||
## Amazon Web Service
|
||||
|
||||
| Calico | Flannel | Weave |
|
||||
------------- | ------------- | ------------- | ------------- |
|
||||
Debian Jessie | [![Build Status](https://ci.kubespray.io/job/kubespray-aws-calico-jessie/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-calico-jessie) | [![Build Status](https://ci.kubespray.io/job/kubespray-aws-flannel-jessie/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-flannel-jessie/) | [![Build Status](https://ci.kubespray.io/job/kubespray-aws-weave-jessie/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-weave-jessie/) |
|
||||
Ubuntu Trusty |[![Build Status](https://ci.kubespray.io/job/kubespray-aws-calico-trusty/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-calico-trusty/)|[![Build Status](https://ci.kubespray.io/job/kubespray-aws-flannel-trusty/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-flannel-trusty/)|[![Build Status](https://ci.kubespray.io/job/kubespray-aws-weave-trusty/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-weave-trusty)|
|
||||
RHEL 7.2 |[![Build Status](https://ci.kubespray.io/job/kubespray-aws-calico-rhel72/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-calico-rhel72/)|[![Build Status](https://ci.kubespray.io/job/kubespray-aws-flannel-rhel72/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-flannel-rhel72/)|[![Build Status](https://ci.kubespray.io/job/kubespray-aws-weave-rhel72/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-weave-rhel72/)|
|
||||
CentOS 7 |[![Build Status](https://ci.kubespray.io/job/kubespray-aws-calico-centos7/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-calico-centos7/)|[![Build Status](https://ci.kubespray.io/job/kubespray-aws-flannel-centos7/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-flannel-centos7/)|[![Build Status](https://ci.kubespray.io/job/kubespray-aws-weave-centos7/badge/icon)](https://ci.kubespray.io/job/kubespray-aws-weave-centos7/)|
|
||||
|
||||
|
||||
*Work In Progress*
|
||||
|
||||
## Test environment variables
|
||||
|
||||
|
|
94
tests/support/aws.groovy
Normal file
94
tests/support/aws.groovy
Normal file
|
@ -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;
|
Loading…
Reference in a new issue