-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy path1_basic.bats
More file actions
60 lines (51 loc) · 1.31 KB
/
1_basic.bats
File metadata and controls
60 lines (51 loc) · 1.31 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
#!/usr/bin/env bats
setup() {
load "../test_helper"
}
@test "meta: docker is installed" {
run docker version
echo "$output">&2
[ "$status" -eq 0 ]
}
@test "meta: can build the test container image" {
run build_docker_image_nocache
echo "$output"
[ "$status" -eq 0 ]
}
@test "meta: can start the test container" {
run in_tmp_container fake-waagent
echo "$output"
[ "$output" = "Usage: /usr/sbin/fake-waagent <handlerCommand>" ]
[ "$status" -eq 1 ]
}
@test "meta: can create vm private/public keys" {
run mk_certs
echo "$output"
[ "$status" -eq 0 ]
thumbprint="$output"
[ -f "$certs_dir/$thumbprint.prv" ]
[ -f "$certs_dir/$thumbprint.crt" ]
}
@test "meta: encrypt a protected settings" {
run mk_certs
echo "$output"
[ "$status" -eq 0 ]
tp="$output"
run encrypt_settings "$tp" "`seq 0 1000`"
echo "$output"
[ "$status" -eq 0 ]
[ -n "$output" ]
}
@test "meta: can create a .settings json with public/protected config" {
tp="$mk_certs"
run mk_settings_json '' '{"commandToExecute":"touch /a.txt"}' "$tp"
echo "$output"
[ "$status" -eq 0 ]
}
@test "meta: can create a temporary file" {
run save_tmp_file "foobar"
echo "$output"
[ "$status" -eq 0 ]
[ -f "$output" ]
[[ "$(cat "$output")" == "foobar" ]]
}