-
Notifications
You must be signed in to change notification settings - Fork 951
Expand file tree
/
Copy pathkms.bats
More file actions
executable file
·127 lines (86 loc) · 2.39 KB
/
kms.bats
File metadata and controls
executable file
·127 lines (86 loc) · 2.39 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env bats
load test_helper
@test "kms standard" {
vcsim_env
run govc kms.ls
assert_success
run govc kms.ls -json
assert_success
run govc kms.ls enoent
assert_failure
host=$(govc env -x GOVC_URL_HOST)
run govc kms.add vcsim-kp
assert_failure # InvalidProperty server.info.name
run govc kms.add -n my-server -a "$host" vcsim-kp
assert_success
run govc kms.add -n my-server vcsim-kp
assert_failure # already registered
run govc kms.ls
assert_success
assert_matches vcsim-kp
run govc kms.ls vcsim-kp
assert_success
run govc kms.default
assert_failure
run govc kms.default vcsim-kp
assert_success
run govc kms.default -
assert_success
run govc kms.rm -s my-server vcsim-kp
assert_success
run govc kms.add -n my-server -a "$host" vcsim-kp
assert_success
run govc kms.export vcsim-kp
assert_failure # export is only supported for native
assert_matches "400 Bad Request"
run govc session.login -r -X DELETE "/api/vcenter/crypto-manager/kms/providers/vcsim-kp"
assert_failure # vapi can only delete native providers
assert_matches "400 Bad Request"
run govc kms.rm vcsim-kp
assert_success
run govc kms.rm vcsim-kp
assert_failure # does not exist
}
@test "kms native" {
vcsim_env
run govc kms.add -N nkp
assert_success
run govc kms.ls nkp
assert_success
run govc kms.export -f /dev/null nkp
assert_success
run govc kms.default nkp
assert_success
run govc kms.rm nkp
assert_success
}
@test "kms.key" {
vcsim_env
run govc kms.add -N nkp
assert_success
host=$(govc env -x GOVC_URL_HOST)
run govc kms.add -n my-server -a "$host" skp
assert_success
export GOVC_SHOW_UNRELEASED=true
run govc kms.key.create nkp
assert_failure # Cannot generate keys with native key provider
run govc kms.key.create skp
assert_success
skey="$output"
run govc kms.key.info -p skp "$skey"
assert_success
run govc kms.key.info -json "$skey"
assert_success
run jq .status[].keyAvailable <<<"$output"
assert_success "false" # provider not specified
run govc kms.key.info -json -p skp "$skey"
assert_success
run jq .status[].keyAvailable <<<"$output"
assert_success "true"
run govc kms.key.info -p nkp "$skey"
assert_success
run govc kms.key.info -json -p nkp "$skey"
assert_success
run jq .status[].keyAvailable <<<"$output"
assert_success "false" # wrong provider for key
}