-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02_compute.bats
More file actions
96 lines (79 loc) · 2.19 KB
/
02_compute.bats
File metadata and controls
96 lines (79 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bats
setup() {
load 'common-setup'
_common_setup
}
setup_file() {
export testinstance="test-instance-bats-$(date '+%Y%m%d%H%M%S')"
}
@test "list instances" {
run openstack server list
assert_success
assert_output -p 'ACTIVE'
}
@test "create instance" {
openstack server create --wait --image cirros-0.5.2-1 --flavor s --network external $testinstance
}
@test "instance is running" {
run openstack server show $testinstance -c status -f value
assert_success
assert_output "ACTIVE"
}
@test "get instance console url" {
run openstack console url show -c url -f value $testinstance
assert_success
assert_output --regexp 'https://'
run curl -sI $output
assert_success
assert_output --regexp 'HTTP/[0-9]+\.[0-9]+ 200 OK'
}
@test "ping instance" {
ip=$(openstack server show -c addresses -f value $testinstance | sed "s/'/\"/g" | jq -r '.external[0]')
ping -c 4 $ip
}
@test "get instance console" {
run openstack console log show $testinstance
assert_success
assert_output -p "login:"
}
@test "reboot instance" {
openstack server reboot --wait $testinstance
}
@test "rebuild instance" {
openstack server rebuild --wait $testinstance
}
@test "resize instance" {
openstack server resize --wait --flavor m $testinstance
run openstack server show $testinstance -c status -f value
assert_success
assert_output "VERIFY_RESIZE"
openstack server resize confirm $testinstance
run openstack server show $testinstance -c status -f value
assert_success
assert_output "ACTIVE"
}
@test "lock instance" {
openstack server lock $testinstance
}
@test "unlock instance" {
openstack server unlock $testinstance
}
@test "create instance snapshot" {
openstack server image create --wait $testinstance
}
@test "instance snapshot is active" {
run openstack image show $testinstance -c status -f value
assert_success
assert_output "active"
}
@test "delete instance snapshot" {
openstack image delete $testinstance
}
teardown_file() {
if openstack server show $testinstance >/dev/null; then
openstack server delete --wait $testinstance
fi
if openstack image show $testinstance >/dev/null; then
openstack image delete $testinstance
fi
}