Merge pull request #2375 from jeanlaurent/vbox-test

Move vbox integration test to core
This commit is contained in:
David Gageot 2015-11-23 14:20:03 +01:00
commit 9a7414fc80
11 changed files with 80 additions and 168 deletions

Binary file not shown.

View File

@ -1,24 +0,0 @@
{
"DriverName": "virtualbox",
"Driver": {
"MachineName": "test-vbox",
"SSHUser": "docker",
"SSHPort": 45515,
"Memory": 1024,
"DiskSize": 20000,
"Boot2DockerURL": "",
"CaCertPath": "/tmp/store/certs/ca.pem",
"PrivateKeyPath": "/tmp/store/certs/ca-key.pem",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": ""
},
"CaCertPath": "/tmp/store/certs/ca.pem",
"ServerCertPath": "",
"ServerKeyPath": "",
"PrivateKeyPath": "/tmp/store/certs/ca-key.pem",
"ClientCertPath": "",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": ""
}

View File

@ -1,49 +0,0 @@
{
"DriverName": "virtualbox",
"Driver": {
"MachineName": "test-vbox",
"SSHUser": "docker",
"SSHPort": 51575,
"Memory": 1024,
"DiskSize": 20000,
"Boot2DockerURL": "",
"CaCertPath": "/tmp/store/certs/ca.pem",
"PrivateKeyPath": "/tmp/store/certs/ca-key.pem",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": ""
},
"CaCertPath": "/tmp/store/certs/ca.pem",
"PrivateKeyPath": "/tmp/store/certs/ca-key.pem",
"ServerCertPath": "",
"ServerKeyPath": "",
"ClientCertPath": "",
"StorePath": "/tmp/store/machines/test-vbox",
"EngineOptions": {
"Dns": null,
"GraphDir": "",
"Ipv6": false,
"Labels": null,
"LogLevel": "",
"StorageDriver": "",
"SelinuxEnabled": false,
"TlsCaCert": "",
"TlsCert": "",
"TlsKey": "",
"TlsVerify": false,
"RegistryMirror": null
},
"SwarmOptions": {
"Address": "",
"Discovery": "",
"Master": false,
"Host": "",
"Strategy": "",
"Heartbeat": 0,
"Overcommit": 0,
"TlsCaCert": "",
"TlsCert": "",
"TlsKey": "",
"TlsVerify": false
}
}

View File

@ -1,89 +0,0 @@
#!/usr/bin/env bats
load ${BASE_TEST_DIR}/helpers.bash
## THIS IS VIRTUALBOX ONLY
force_env DRIVER virtualbox
@test "$DRIVER: create a new virtualbox machine" {
run machine create -d $DRIVER $NAME
echo ${output}
[ "$status" -eq 0 ]
}
@test "$DRIVER: pause the newly created machine" {
run vboxmanage controlvm $NAME pause
echo ${output}
[ "$status" -eq 0 ]
}
@test "$DRIVER: status should show paused after pause" {
run machine status $NAME
echo ${output}
[ "$status" -eq 0 ]
[[ ${output} == *"Paused"* ]]
}
@test "$DRIVER: should stop a paused machine" {
run machine stop $NAME
echo ${output}
[ "$status" -eq 0 ]
}
@test "$DRIVER: status should show Stopped after stop" {
run machine status $NAME
echo ${output}
[ "$status" -eq 0 ]
[[ ${output} == *"Stopped"* ]]
}
@test "$DRIVER: restart the machine" {
run machine start $NAME
echo ${output}
[ "$status" -eq 0 ]
}
@test "$DRIVER: status should show Running after restart" {
run machine status $NAME
echo ${output}
[ "$status" -eq 0 ]
[[ ${output} == *"Running"* ]]
}
@test "$DRIVER: savestate the machine" {
run VBoxManage controlvm $NAME savestate
[ "$status" -eq 0 ]
}
@test "$DRIVER: status should show Saved after save" {
run machine status $NAME
echo ${output}
[ "$status" -eq 0 ]
[[ ${output} == *"Saved"* ]]
}
@test "$DRIVER: should start after save" {
run machine start $NAME
echo ${output}
[ "$status" -eq 0 ]
}
@test "$DRIVER: status should show Running after restart" {
run machine status $NAME
echo ${output}
[ "$status" -eq 0 ]
[[ ${output} == *"Running"* ]]
}
@test "$DRIVER: pause the machine again" {
run vboxmanage controlvm $NAME pause
echo ${output}
[ "$status" -eq 0 ]
}
@test "$DRIVER: remove the paused machine" {
run machine rm $NAME
echo ${output}
[ "$status" -eq 0 ]
}

View File

@ -2,7 +2,12 @@
load ${BASE_TEST_DIR}/helpers.bash
force_env DRIVER virtualbox
# this should move to the makefile
if [[ "$DRIVER" != "virtualbox" ]]; then
exit 0
fi
export RANCHEROS_VERSION="v0.3.1"
export RANCHEROS_ISO="https://github.com/rancherio/os/releases/download/$RANCHEROS_VERSION/machine-rancheros.iso"

View File

@ -2,7 +2,11 @@
load ${BASE_TEST_DIR}/helpers.bash
force_env DRIVER amazonec2
# this should move to the makefile
if [[ "$DRIVER" != "amazonec2" ]]; then
exit 0
fi
require_env AWS_VPC_ID
require_env AWS_ACCESS_KEY_ID

View File

@ -2,7 +2,9 @@
load ${BASE_TEST_DIR}/helpers.bash
force_env DRIVER virtualbox
if [[ "$DRIVER" != "virtualbox" ]]; then
exit 0
fi
export BAD_URL="http://dev.null:9111/bad.iso"

View File

@ -2,7 +2,9 @@
load ${BASE_TEST_DIR}/helpers.bash
force_env DRIVER virtualbox
if [[ "$DRIVER" != "virtualbox" ]]; then
exit 0
fi
@test "$DRIVER: create" {
run machine create -d $DRIVER $NAME

View File

@ -2,7 +2,9 @@
load ${BASE_TEST_DIR}/helpers.bash
force_env DRIVER virtualbox
if [[ "$DRIVER" != "virtualbox" ]]; then
exit 0
fi
# Default memsize is 1024MB and disksize is 20000MB
# These values are defined in drivers/virtualbox/virtualbox.go

View File

@ -0,0 +1,57 @@
#!/usr/bin/env bats
load ${BASE_TEST_DIR}/helpers.bash
if [[ "$DRIVER" != "virtualbox" ]]; then
exit 0
fi
@test "$DRIVER: create" {
run machine create -d $DRIVER $NAME
[ "$status" -eq 0 ]
}
@test "$DRIVER: VBoxManage pause" {
run VBoxManage controlvm $NAME pause
[ "$status" -eq 0 ]
}
@test "$DRIVER: machine should show paused after VBoxManage pause" {
run machine ls
[ "$status" -eq 0 ]
[[ ${lines[1]} == *"Paused"* ]]
}
@test "$DRIVER: start after paused" {
run machine start $NAME
[ "$status" -eq 0 ]
}
@test "$DRIVER: machine should show running after start" {
run machine ls
[ "$status" -eq 0 ]
[[ ${lines[1]} == *"Running"* ]]
}
@test "$DRIVER: VBoxManage savestate" {
run VBoxManage controlvm $NAME savestate
[ "$status" -eq 0 ]
}
@test "$DRIVER: machine should show saved after VBoxManage savestate" {
run machine ls
[ "$status" -eq 0 ]
[[ ${lines[1]} == *"$NAME"* ]]
[[ ${lines[1]} == *"Saved"* ]]
}
@test "$DRIVER: start after saved" {
run machine start $NAME
[ "$status" -eq 0 ]
}
@test "$DRIVER: machine should show running after start" {
run machine ls
[ "$status" -eq 0 ]
[[ ${lines[1]} == *"Running"* ]]
}

View File

@ -2,7 +2,9 @@
load ${BASE_TEST_DIR}/helpers.bash
force_env DRIVER virtualbox
if [[ "$DRIVER" != "virtualbox" ]]; then
exit 0
fi
export OLD_ISO_URL="https://github.com/boot2docker/boot2docker/releases/download/v1.4.1/boot2docker.iso"