brightbox-cli 4.8.0 → 5.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +6 -2
- data/CHANGELOG.md +60 -0
- data/Gemfile.lock +17 -10
- data/brightbox-cli.gemspec +3 -7
- data/lib/brightbox-cli/accounts.rb +5 -1
- data/lib/brightbox-cli/api.rb +34 -1
- data/lib/brightbox-cli/cloud_ips.rb +6 -6
- data/lib/brightbox-cli/collaboration.rb +3 -7
- data/lib/brightbox-cli/commands/cloudips/unmap.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_apply.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_create.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_destroy.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_list.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_remove.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_show.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_update.rb +1 -1
- data/lib/brightbox-cli/commands/lbs/create.rb +28 -16
- data/lib/brightbox-cli/commands/lbs/show.rb +5 -0
- data/lib/brightbox-cli/commands/lbs/update.rb +9 -2
- data/lib/brightbox-cli/config.rb +12 -5
- data/lib/brightbox-cli/database_server.rb +20 -20
- data/lib/brightbox-cli/database_snapshot.rb +5 -5
- data/lib/brightbox-cli/database_type.rb +4 -8
- data/lib/brightbox-cli/detailed_server.rb +26 -28
- data/lib/brightbox-cli/detailed_server_group.rb +2 -2
- data/lib/brightbox-cli/firewall_policy.rb +5 -9
- data/lib/brightbox-cli/firewall_rule.rb +14 -15
- data/lib/brightbox-cli/images.rb +21 -20
- data/lib/brightbox-cli/indifferent_access_hash.rb +50 -0
- data/lib/brightbox-cli/load_balancers.rb +38 -4
- data/lib/brightbox-cli/server_groups.rb +4 -8
- data/lib/brightbox-cli/servers.rb +22 -16
- data/lib/brightbox-cli/types.rb +4 -8
- data/lib/brightbox-cli/user_collaboration.rb +1 -1
- data/lib/brightbox-cli/users.rb +3 -5
- data/lib/brightbox-cli/version.rb +1 -1
- data/lib/brightbox-cli/volume.rb +9 -13
- data/lib/brightbox-cli/zones.rb +0 -4
- data/lib/brightbox_cli.rb +1 -0
- data/spec/commands/cloudips/update_spec.rb +7 -5
- data/spec/commands/configmaps/create_spec.rb +6 -6
- data/spec/commands/configmaps/destroy_spec.rb +1 -1
- data/spec/commands/configmaps/list_spec.rb +1 -1
- data/spec/commands/configmaps/show_spec.rb +3 -3
- data/spec/commands/configmaps/update_spec.rb +9 -9
- data/spec/commands/lbs/create_spec.rb +158 -6
- data/spec/commands/lbs/show_spec.rb +99 -3
- data/spec/commands/lbs/update_spec.rb +50 -6
- data/spec/commands/servers/update_spec.rb +7 -7
- data/spec/commands/sql/instances/create_spec.rb +8 -8
- data/spec/commands/sql/instances/reset_spec.rb +3 -3
- data/spec/commands/sql/instances/resize_spec.rb +4 -4
- data/spec/commands/sql/instances/show_spec.rb +2 -1
- data/spec/commands/sql/instances/update_spec.rb +3 -3
- data/spec/commands/sql/snapshots/list_spec.rb +1 -1
- data/spec/commands/sql/snapshots/show_spec.rb +50 -7
- data/spec/commands/volumes/attach_spec.rb +4 -4
- data/spec/commands/volumes/copy_spec.rb +2 -2
- data/spec/commands/volumes/destroy_spec.rb +1 -1
- data/spec/commands/volumes/detach_spec.rb +1 -1
- data/spec/commands/volumes/list_spec.rb +1 -1
- data/spec/commands/volumes/resize_spec.rb +3 -3
- data/spec/commands/volumes/show_spec.rb +1 -1
- data/spec/commands/volumes/update_spec.rb +4 -4
- data/spec/spec_helper.rb +16 -0
- data/spec/support/shared/api_resource_examples.rb +25 -0
- data/spec/unit/brightbox/account/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/api/attributes_spec.rb +65 -0
- data/spec/unit/brightbox/api/fog_attributes_spec.rb +65 -0
- data/spec/unit/brightbox/bb_config/config_directory_spec.rb +23 -3
- data/spec/unit/brightbox/cloud_ip/attributes_spec.rb +19 -0
- data/spec/unit/brightbox/collaborating_account/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_server/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_snapshot/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_type/attributes_spec.rb +20 -0
- data/spec/unit/brightbox/detailed_server/attributes_spec.rb +29 -0
- data/spec/unit/brightbox/detailed_server_group/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/firewall_policy/attributes_spec.rb +21 -0
- data/spec/unit/brightbox/firewall_rule/attributes_spec.rb +18 -0
- data/spec/unit/brightbox/image/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/image/status_spec.rb +67 -0
- data/spec/unit/brightbox/load_balancer/acme_cert_spec.rb +75 -0
- data/spec/unit/brightbox/load_balancer/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/load_balancer/formatted_acme_domains_spec.rb +78 -0
- data/spec/unit/brightbox/server/attributes_spec.rb +29 -0
- data/spec/unit/brightbox/server/hostname_spec.rb +27 -0
- data/spec/unit/brightbox/server_group/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/type/attributes_spec.rb +20 -0
- data/spec/unit/brightbox/user/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/user_collaboration/attributes_spec.rb +13 -0
- metadata +68 -23
- data/spec/cassettes/brightbox_sql_snapshots/show/when_resource_exists/does_not_output_to_stderr.yml +0 -93
|
@@ -27,7 +27,7 @@ describe "brightbox configmaps update" do
|
|
|
27
27
|
it "does not error" do
|
|
28
28
|
expect { output }.to_not raise_error
|
|
29
29
|
|
|
30
|
-
expect(stderr).to
|
|
30
|
+
expect(stderr).to include("ERROR: You must specify the config map ID as the first argument\n")
|
|
31
31
|
|
|
32
32
|
expect(stdout).to match("")
|
|
33
33
|
end
|
|
@@ -73,7 +73,7 @@ describe "brightbox configmaps update" do
|
|
|
73
73
|
it "does not error" do
|
|
74
74
|
expect { output }.to_not raise_error
|
|
75
75
|
|
|
76
|
-
expect(stderr).to
|
|
76
|
+
expect(stderr).to include("Updating cfg-0932s\n")
|
|
77
77
|
|
|
78
78
|
aggregate_failures do
|
|
79
79
|
expect(stdout).to match("cfg-0932s")
|
|
@@ -134,7 +134,7 @@ describe "brightbox configmaps update" do
|
|
|
134
134
|
it "does not error" do
|
|
135
135
|
expect { output }.to_not raise_error
|
|
136
136
|
|
|
137
|
-
expect(stderr).to
|
|
137
|
+
expect(stderr).to include("Updating cfg-25hrt\n")
|
|
138
138
|
|
|
139
139
|
aggregate_failures do
|
|
140
140
|
expect(stdout).to match("cfg-25hrt")
|
|
@@ -148,7 +148,7 @@ describe "brightbox configmaps update" do
|
|
|
148
148
|
it "does not error" do
|
|
149
149
|
expect { output }.to_not raise_error
|
|
150
150
|
|
|
151
|
-
expect(stderr).to
|
|
151
|
+
expect(stderr).to include("ERROR: Config map data was not valid JSON\n")
|
|
152
152
|
|
|
153
153
|
expect(stdout).to eq("")
|
|
154
154
|
end
|
|
@@ -218,7 +218,7 @@ describe "brightbox configmaps update" do
|
|
|
218
218
|
it "does not error" do
|
|
219
219
|
expect { output }.to_not raise_error
|
|
220
220
|
|
|
221
|
-
expect(stderr).to
|
|
221
|
+
expect(stderr).to include("Updating cfg-gr45a\n")
|
|
222
222
|
|
|
223
223
|
aggregate_failures do
|
|
224
224
|
expect(stdout).to match("cfg-gr45a")
|
|
@@ -231,7 +231,7 @@ describe "brightbox configmaps update" do
|
|
|
231
231
|
it "does not error" do
|
|
232
232
|
expect { output }.to_not raise_error
|
|
233
233
|
|
|
234
|
-
expect(stderr).to
|
|
234
|
+
expect(stderr).to include("ERROR: Config map data was not valid JSON\n")
|
|
235
235
|
|
|
236
236
|
expect(stdout).to eq("")
|
|
237
237
|
end
|
|
@@ -303,7 +303,7 @@ describe "brightbox configmaps update" do
|
|
|
303
303
|
it "does not error" do
|
|
304
304
|
expect { output }.to_not raise_error
|
|
305
305
|
|
|
306
|
-
expect(stderr).to
|
|
306
|
+
expect(stderr).to include("Updating cfg-stdin\n")
|
|
307
307
|
|
|
308
308
|
aggregate_failures do
|
|
309
309
|
expect(stdout).to match("cfg-stdin")
|
|
@@ -316,7 +316,7 @@ describe "brightbox configmaps update" do
|
|
|
316
316
|
it "does not error" do
|
|
317
317
|
expect { output }.to_not raise_error
|
|
318
318
|
|
|
319
|
-
expect(stderr).to
|
|
319
|
+
expect(stderr).to include("ERROR: Config map data was not valid JSON\n")
|
|
320
320
|
|
|
321
321
|
expect(stdout).to eq("")
|
|
322
322
|
end
|
|
@@ -332,7 +332,7 @@ describe "brightbox configmaps update" do
|
|
|
332
332
|
it "does not error" do
|
|
333
333
|
expect { output }.to_not raise_error
|
|
334
334
|
|
|
335
|
-
expect(stderr).to
|
|
335
|
+
expect(stderr).to include("ERROR: Config map data can only be passed by either 'data' or 'data-file'\n")
|
|
336
336
|
|
|
337
337
|
expect(stdout).to eq("")
|
|
338
338
|
end
|
|
@@ -11,20 +11,131 @@ describe "brightbox lbs" do
|
|
|
11
11
|
cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
context "" do
|
|
14
|
+
context "without nodes arguments" do
|
|
15
15
|
let(:argv) { %w[lbs create] }
|
|
16
|
+
let(:expected_args) { { nodes: [] } }
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
let(:json_response) do
|
|
19
|
+
<<~EOS
|
|
20
|
+
{
|
|
21
|
+
"id": "lba-12345",
|
|
22
|
+
"nodes": []
|
|
23
|
+
}
|
|
24
|
+
EOS
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
before do
|
|
28
|
+
stub_request(:post, "http://api.brightbox.localhost/1.0/load_balancers?account_id=acc-12345")
|
|
29
|
+
.with(:body => hash_including("nodes" => []))
|
|
30
|
+
.to_return(:status => 202, :body => json_response)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "makes request" do
|
|
34
|
+
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
|
35
|
+
|
|
36
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
|
37
|
+
expect(stdout).to include("lba-12345")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context "with a nodes argument" do
|
|
42
|
+
let(:argv) { %w[lbs create srv-12345] }
|
|
43
|
+
let(:expected_args) { { nodes: [{ node: "srv-12345" }] } }
|
|
44
|
+
|
|
45
|
+
let(:json_response) do
|
|
46
|
+
<<~EOS
|
|
47
|
+
{
|
|
48
|
+
"id": "lba-12345",
|
|
49
|
+
"nodes": [
|
|
50
|
+
{
|
|
51
|
+
"id": "srv-12345"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
EOS
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
before do
|
|
59
|
+
stub_request(:post, "http://api.brightbox.localhost/1.0/load_balancers?account_id=acc-12345")
|
|
60
|
+
.with(:body => hash_including("nodes" => [{ "node" => "srv-12345" }]))
|
|
61
|
+
.to_return(:status => 202, :body => json_response)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "makes request" do
|
|
65
|
+
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
|
66
|
+
|
|
67
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
|
68
|
+
expect(stdout).to include("lba-12345")
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
context "with multiple node arguments" do
|
|
73
|
+
let(:argv) { %w[lbs create srv-12345 srv-54321] }
|
|
74
|
+
let(:expected_args) { { nodes: [{ node: "srv-12345" }, { node: "srv-54321" }] } }
|
|
75
|
+
|
|
76
|
+
let(:json_response) do
|
|
77
|
+
<<~EOS
|
|
78
|
+
{
|
|
79
|
+
"id": "lba-12345",
|
|
80
|
+
"nodes": [
|
|
81
|
+
{
|
|
82
|
+
"id": "srv-12345"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "srv-54321"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
EOS
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
before do
|
|
93
|
+
stub_request(:post, "http://api.brightbox.localhost/1.0/load_balancers?account_id=acc-12345")
|
|
94
|
+
.with(:body => hash_including("nodes" => [{ "node" => "srv-12345" }, { "node" => "srv-54321" }]))
|
|
95
|
+
.to_return(:status => 202, :body => json_response)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "makes request" do
|
|
99
|
+
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
|
100
|
+
|
|
101
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
|
102
|
+
expect(stdout).to include("lba-12345")
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
context "with --buffer_size" do
|
|
107
|
+
let(:argv) { %w[lbs create --buffer-size 1024 srv-12345] }
|
|
108
|
+
let(:expected_args) { { nodes: [{ node: "srv-12345" }], buffer_size: 1024 } }
|
|
109
|
+
|
|
110
|
+
let(:json_response) do
|
|
111
|
+
<<~EOS
|
|
112
|
+
{
|
|
113
|
+
"id": "lba-12345",
|
|
114
|
+
"buffer_size": 1024
|
|
115
|
+
}
|
|
116
|
+
EOS
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
before do
|
|
120
|
+
stub_request(:post, "http://api.brightbox.localhost/1.0/load_balancers?account_id=acc-12345")
|
|
121
|
+
.with(:body => hash_including("buffer_size" => 1024))
|
|
122
|
+
.to_return(:status => 202, :body => json_response)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it "includes buffer_size in response" do
|
|
126
|
+
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
|
127
|
+
|
|
128
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
|
129
|
+
expect(stdout).to include("lba-12345")
|
|
19
130
|
end
|
|
20
131
|
end
|
|
21
132
|
|
|
22
|
-
context "--ssl-min-ver=TLSv1.0" do
|
|
133
|
+
context "with --ssl-min-ver=TLSv1.0" do
|
|
23
134
|
let(:argv) { ["lbs", "create", "--ssl-min-ver", "TLSv1.0", "srv-12345"] }
|
|
24
135
|
let(:expected_args) { { ssl_minimum_version: "TLSv1.0" } }
|
|
25
136
|
|
|
26
137
|
let(:json_response) do
|
|
27
|
-
|
|
138
|
+
<<~EOS
|
|
28
139
|
{
|
|
29
140
|
"id":"lba-12345",
|
|
30
141
|
"ssl_minimum_version":"TLSv1.0"
|
|
@@ -40,7 +151,48 @@ describe "brightbox lbs" do
|
|
|
40
151
|
|
|
41
152
|
it "includes ssl_minimum_version in response" do
|
|
42
153
|
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
|
43
|
-
expect(stderr).to
|
|
154
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
|
155
|
+
expect(stdout).to include("lba-12345")
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
context "--acme-domains=example.com" do
|
|
160
|
+
let(:argv) { ["lbs", "create", "--acme-domains", "example.com", "--listeners", "443:443:https:5000", "lba-12345"] }
|
|
161
|
+
let(:json_response) do
|
|
162
|
+
<<~EOS
|
|
163
|
+
{
|
|
164
|
+
"id":"lba-12345",
|
|
165
|
+
"acme": {
|
|
166
|
+
"domains": [
|
|
167
|
+
{
|
|
168
|
+
"identifier": "example.com",
|
|
169
|
+
"last_message": null,
|
|
170
|
+
"status": "pending"
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"certificate": null,
|
|
175
|
+
"listeners": [
|
|
176
|
+
{
|
|
177
|
+
"in": 443,
|
|
178
|
+
"out": 443,
|
|
179
|
+
"protocol": "https",
|
|
180
|
+
"proxy_protocol": null,
|
|
181
|
+
"timeout": 5000
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
EOS
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
before do
|
|
189
|
+
stub_request(:post, "http://api.brightbox.localhost/1.0/load_balancers?account_id=acc-12345")
|
|
190
|
+
.with(body: hash_including(domains: ["example.com"]))
|
|
191
|
+
.to_return(:status => 202, :body => json_response)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
it "includes acme_certificate_domain in response" do
|
|
195
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
|
44
196
|
expect(stdout).to include("lba-12345")
|
|
45
197
|
end
|
|
46
198
|
end
|
|
@@ -6,11 +6,107 @@ describe "brightbox lbs" do
|
|
|
6
6
|
let(:stdout) { output.stdout }
|
|
7
7
|
let(:stderr) { output.stderr }
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
before do
|
|
10
|
+
config = config_from_contents(USER_APP_CONFIG_CONTENTS)
|
|
11
|
+
cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context "without identifier argument" do
|
|
10
15
|
let(:argv) { %w[lbs show] }
|
|
16
|
+
let(:json_response) do
|
|
17
|
+
<<~EOS
|
|
18
|
+
[
|
|
19
|
+
{
|
|
20
|
+
"id":"lba-12345",
|
|
21
|
+
"name":"app-lb1",
|
|
22
|
+
"status":"active",
|
|
23
|
+
"created_at":"2012-03-05T12:00:00Z",
|
|
24
|
+
"nodes":[
|
|
25
|
+
{
|
|
26
|
+
"id":"srv-12345",
|
|
27
|
+
"status":"active"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
EOS
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
before do
|
|
36
|
+
stub_request(:get, "http://api.brightbox.localhost/1.0/load_balancers?account_id=acc-12345")
|
|
37
|
+
.to_return(:status => 200, :body => json_response)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "shows load balancer details" do
|
|
41
|
+
aggregate_failures do
|
|
42
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
43
|
+
expect(stdout).to include("id: lba-12345")
|
|
44
|
+
expect(stdout).to include("status: active")
|
|
45
|
+
expect(stdout).to include("name: app-lb1")
|
|
46
|
+
expect(stdout).to include("created_at: 2012-03-05T12:00Z")
|
|
47
|
+
expect(stdout).to include("nodes: srv-12345")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
context "with identifier argument" do
|
|
53
|
+
let(:argv) { %w[lbs show lba-12345] }
|
|
54
|
+
let(:json_response) do
|
|
55
|
+
<<~EOS
|
|
56
|
+
{
|
|
57
|
+
"id":"lba-12345",
|
|
58
|
+
"name":"app-lb1",
|
|
59
|
+
"status":"active",
|
|
60
|
+
"created_at":"2012-03-05T12:00:00Z",
|
|
61
|
+
"acme": {
|
|
62
|
+
"domains": [
|
|
63
|
+
{
|
|
64
|
+
"identifier": "domain.test",
|
|
65
|
+
"status": "verified"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"identifier": "domain2.test",
|
|
69
|
+
"status": "verified"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"certificate": {
|
|
73
|
+
"domains": [
|
|
74
|
+
"domain.test"
|
|
75
|
+
],
|
|
76
|
+
"expires_at": "2025-12-31T23:59:59Z",
|
|
77
|
+
"fingerprint": "fingerprint",
|
|
78
|
+
"issued_at": "2025-01-01T00:00:00Z"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"nodes":[
|
|
82
|
+
{
|
|
83
|
+
"id":"srv-12345",
|
|
84
|
+
"status":"active"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
EOS
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
before do
|
|
92
|
+
stub_request(:get, "http://api.brightbox.localhost/1.0/load_balancers/lba-12345?account_id=acc-12345")
|
|
93
|
+
.to_return(:status => 200, :body => json_response)
|
|
94
|
+
end
|
|
11
95
|
|
|
12
|
-
it "
|
|
13
|
-
|
|
96
|
+
it "shows load balancer details" do
|
|
97
|
+
aggregate_failures do
|
|
98
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
99
|
+
expect(stdout).to include("id: lba-12345")
|
|
100
|
+
expect(stdout).to include("status: active")
|
|
101
|
+
expect(stdout).to include("name: app-lb1")
|
|
102
|
+
expect(stdout).to include("created_at: 2012-03-05T12:00Z")
|
|
103
|
+
expect(stdout).to include("nodes: srv-12345")
|
|
104
|
+
expect(stdout).to include("acme_domains: domain.test:verified,domain2.test:verified")
|
|
105
|
+
expect(stdout).to include("acme_cert_subjects: domain.test")
|
|
106
|
+
expect(stdout).to include("acme_cert_expires_at: 2025-12-31T23:59:59Z")
|
|
107
|
+
expect(stdout).to include("acme_cert_fingerprint: fingerprint")
|
|
108
|
+
expect(stdout).to include("acme_cert_issued_at: 2025-01-01T00:00:00Z")
|
|
109
|
+
end
|
|
14
110
|
end
|
|
15
111
|
end
|
|
16
112
|
end
|
|
@@ -23,7 +23,7 @@ describe "brightbox lbs" do
|
|
|
23
23
|
let(:argv) { ["lbs", "update", "--ssl-min-ver", "TLSv1.0", "lba-12345"] }
|
|
24
24
|
|
|
25
25
|
let(:json_response) do
|
|
26
|
-
|
|
26
|
+
<<~EOS
|
|
27
27
|
{
|
|
28
28
|
"id":"lba-12345",
|
|
29
29
|
"ssl_minimum_version":"TLSv1.0"
|
|
@@ -41,7 +41,7 @@ describe "brightbox lbs" do
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
it "includes ssl_minimum_version in response" do
|
|
44
|
-
expect(stderr).to
|
|
44
|
+
expect(stderr).to include("Updating load balancer lba-12345\n")
|
|
45
45
|
expect(stdout).to include("lba-12345")
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -50,7 +50,7 @@ describe "brightbox lbs" do
|
|
|
50
50
|
let(:argv) { ["lbs", "update", "--sslv3", "lba-grt24"] }
|
|
51
51
|
|
|
52
52
|
let(:json_response) do
|
|
53
|
-
|
|
53
|
+
<<~EOS
|
|
54
54
|
{
|
|
55
55
|
"id":"lba-grt24",
|
|
56
56
|
"ssl_minimum_version":"TLSv1.0"
|
|
@@ -68,7 +68,7 @@ describe "brightbox lbs" do
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
it "includes ssl_minimum_version in response" do
|
|
71
|
-
expect(stderr).to
|
|
71
|
+
expect(stderr).to include("Updating load balancer lba-grt24\n")
|
|
72
72
|
expect(stdout).to include("lba-grt24")
|
|
73
73
|
end
|
|
74
74
|
end
|
|
@@ -77,7 +77,7 @@ describe "brightbox lbs" do
|
|
|
77
77
|
let(:argv) { ["lbs", "update", "--no-sslv3", "lba-kl432"] }
|
|
78
78
|
|
|
79
79
|
let(:json_response) do
|
|
80
|
-
|
|
80
|
+
<<~EOS
|
|
81
81
|
{
|
|
82
82
|
"id":"lba-kl432",
|
|
83
83
|
"ssl_minimum_version":"TLSv1.0"
|
|
@@ -95,9 +95,53 @@ describe "brightbox lbs" do
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
it "includes ssl_minimum_version in response" do
|
|
98
|
-
expect(stderr).to
|
|
98
|
+
expect(stderr).to include("Updating load balancer lba-kl432\n")
|
|
99
99
|
expect(stdout).to include("lba-kl432")
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
|
+
|
|
103
|
+
context "--acme-domains=example.com" do
|
|
104
|
+
let(:argv) { ["lbs", "update", "--acme-domains", "example.com", "--listeners", "443:443:https:5000", "lba-12345"] }
|
|
105
|
+
let(:json_response) do
|
|
106
|
+
<<~EOS
|
|
107
|
+
{
|
|
108
|
+
"id":"lba-12345",
|
|
109
|
+
"acme": {
|
|
110
|
+
"domains": [
|
|
111
|
+
{
|
|
112
|
+
"identifier": "example.com",
|
|
113
|
+
"last_message": null,
|
|
114
|
+
"status": "pending"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"certificate": null,
|
|
119
|
+
"listeners": [
|
|
120
|
+
{
|
|
121
|
+
"in": 443,
|
|
122
|
+
"out": 443,
|
|
123
|
+
"protocol": "https",
|
|
124
|
+
"proxy_protocol": null,
|
|
125
|
+
"timeout": 5000
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
EOS
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
before do
|
|
133
|
+
stub_request(:get, "http://api.brightbox.localhost/1.0/load_balancers/lba-12345?account_id=acc-12345")
|
|
134
|
+
.to_return(:status => 200, :body => '{"id":"lba-12345"}')
|
|
135
|
+
|
|
136
|
+
stub_request(:put, "http://api.brightbox.localhost/1.0/load_balancers/lba-12345?account_id=acc-12345")
|
|
137
|
+
.with(body: hash_including(domains: ["example.com"]))
|
|
138
|
+
.to_return(:status => 202, :body => json_response)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "includes acme_certificate_domain in response" do
|
|
142
|
+
expect(stderr).to include("Updating load balancer lba-12345\n")
|
|
143
|
+
expect(stdout).to include("lba-12345")
|
|
144
|
+
end
|
|
145
|
+
end
|
|
102
146
|
end
|
|
103
147
|
end
|
|
@@ -26,7 +26,7 @@ describe "brightbox servers update" do
|
|
|
26
26
|
it "does not error" do
|
|
27
27
|
expect { output }.to_not raise_error
|
|
28
28
|
|
|
29
|
-
expect(stderr).to
|
|
29
|
+
expect(stderr).to include("ERROR: You must specify a valid server id as the first argument\n")
|
|
30
30
|
|
|
31
31
|
expect(stdout).to match("")
|
|
32
32
|
end
|
|
@@ -66,7 +66,7 @@ describe "brightbox servers update" do
|
|
|
66
66
|
it "does not error" do
|
|
67
67
|
expect { output }.to_not raise_error
|
|
68
68
|
|
|
69
|
-
expect(stderr).to
|
|
69
|
+
expect(stderr).to include("Updating server srv-klfkd\n")
|
|
70
70
|
|
|
71
71
|
expect(stdout).to match("srv-klfkd")
|
|
72
72
|
end
|
|
@@ -104,7 +104,7 @@ describe "brightbox servers update" do
|
|
|
104
104
|
it "does not error" do
|
|
105
105
|
expect { output }.to_not raise_error
|
|
106
106
|
|
|
107
|
-
expect(stderr).to
|
|
107
|
+
expect(stderr).to include("Updating server srv-ds321\n")
|
|
108
108
|
|
|
109
109
|
expect(stdout).to match("srv-ds321")
|
|
110
110
|
end
|
|
@@ -144,7 +144,7 @@ describe "brightbox servers update" do
|
|
|
144
144
|
it "does not error" do
|
|
145
145
|
expect { output }.to_not raise_error
|
|
146
146
|
|
|
147
|
-
expect(stderr).to
|
|
147
|
+
expect(stderr).to include("Updating server srv-ds321\n")
|
|
148
148
|
|
|
149
149
|
expect(stdout).to match("srv-ds321")
|
|
150
150
|
end
|
|
@@ -184,7 +184,7 @@ describe "brightbox servers update" do
|
|
|
184
184
|
it "does not error" do
|
|
185
185
|
expect { output }.to_not raise_error
|
|
186
186
|
|
|
187
|
-
expect(stderr).to
|
|
187
|
+
expect(stderr).to include("Updating server srv-ds321\n")
|
|
188
188
|
|
|
189
189
|
expect(stdout).to match("srv-ds321")
|
|
190
190
|
end
|
|
@@ -224,7 +224,7 @@ describe "brightbox servers update" do
|
|
|
224
224
|
it "does not error" do
|
|
225
225
|
expect { output }.to_not raise_error
|
|
226
226
|
|
|
227
|
-
expect(stderr).to
|
|
227
|
+
expect(stderr).to include("Updating server srv-ds321 with 0.01k of user data\n")
|
|
228
228
|
|
|
229
229
|
expect(stdout).to match("srv-ds321")
|
|
230
230
|
end
|
|
@@ -264,7 +264,7 @@ describe "brightbox servers update" do
|
|
|
264
264
|
it "does not error" do
|
|
265
265
|
expect { output }.to_not raise_error
|
|
266
266
|
|
|
267
|
-
expect(stderr).to
|
|
267
|
+
expect(stderr).to include("Updating server srv-ds321 with 0.00k of user data\n")
|
|
268
268
|
|
|
269
269
|
expect(stdout).to match("srv-ds321")
|
|
270
270
|
end
|
|
@@ -39,7 +39,7 @@ describe "brightbox sql instances" do
|
|
|
39
39
|
|
|
40
40
|
it "correctly sends API parameters" do
|
|
41
41
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
|
42
|
-
expect(stderr).to
|
|
42
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -55,7 +55,7 @@ describe "brightbox sql instances" do
|
|
|
55
55
|
|
|
56
56
|
it "correctly sends API parameters" do
|
|
57
57
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
|
58
|
-
expect(stderr).to
|
|
58
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
after do
|
|
@@ -69,7 +69,7 @@ describe "brightbox sql instances" do
|
|
|
69
69
|
|
|
70
70
|
it "correctly sends API parameters" do
|
|
71
71
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
|
72
|
-
expect(stderr).to
|
|
72
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
73
73
|
expect(stdout).to include("version: 8.0")
|
|
74
74
|
end
|
|
75
75
|
end
|
|
@@ -80,7 +80,7 @@ describe "brightbox sql instances" do
|
|
|
80
80
|
|
|
81
81
|
it "correctly sends API parameters" do
|
|
82
82
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
|
83
|
-
expect(stderr).to
|
|
83
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
84
84
|
expect(stdout).to include("version: 8.0")
|
|
85
85
|
end
|
|
86
86
|
end
|
|
@@ -91,7 +91,7 @@ describe "brightbox sql instances" do
|
|
|
91
91
|
|
|
92
92
|
it "correctly sends API parameters" do
|
|
93
93
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
|
94
|
-
expect(stderr).to
|
|
94
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
@@ -101,7 +101,7 @@ describe "brightbox sql instances" do
|
|
|
101
101
|
|
|
102
102
|
it "correctly sends API parameters" do
|
|
103
103
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
|
104
|
-
expect(stderr).to
|
|
104
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -124,7 +124,7 @@ describe "brightbox sql instances" do
|
|
|
124
124
|
it "includes schedule fields in response" do
|
|
125
125
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
|
126
126
|
expect(stdout).to include("id: #{sql_instance.id}")
|
|
127
|
-
expect(stderr).to
|
|
127
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
130
|
|
|
@@ -136,7 +136,7 @@ describe "brightbox sql instances" do
|
|
|
136
136
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
|
137
137
|
expect(stdout).to include("snapshots_schedule: 0 12 * * 4")
|
|
138
138
|
expect(stdout).to match(/snapshots_schedule_next_at: 20\d{2}-\d{2}-\d{2}T12:\d{2}Z/)
|
|
139
|
-
expect(stderr).to
|
|
139
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
140
140
|
end
|
|
141
141
|
end
|
|
142
142
|
end
|
|
@@ -26,7 +26,7 @@ describe "brightbox sql instances reset" do
|
|
|
26
26
|
it "does not error" do
|
|
27
27
|
expect { output }.to_not raise_error
|
|
28
28
|
|
|
29
|
-
expect(stderr).to
|
|
29
|
+
expect(stderr).to include("ERROR: You must specify a valid SQL instance ID as the first argument\n")
|
|
30
30
|
|
|
31
31
|
expect(stdout).to match("")
|
|
32
32
|
end
|
|
@@ -47,7 +47,7 @@ describe "brightbox sql instances reset" do
|
|
|
47
47
|
it "does not error" do
|
|
48
48
|
expect { output }.to_not raise_error
|
|
49
49
|
|
|
50
|
-
expect(stderr).to
|
|
50
|
+
expect(stderr).to include("ERROR: Couldn't find 'dbs-l3kd4'\n")
|
|
51
51
|
|
|
52
52
|
expect(stdout).to match("")
|
|
53
53
|
end
|
|
@@ -79,7 +79,7 @@ describe "brightbox sql instances reset" do
|
|
|
79
79
|
it "does not error" do
|
|
80
80
|
expect { output }.to_not raise_error
|
|
81
81
|
|
|
82
|
-
expect(stderr).to
|
|
82
|
+
expect(stderr).to include("Resetting dbs-po953\n")
|
|
83
83
|
|
|
84
84
|
expect(stdout).to match("dbs-po953")
|
|
85
85
|
end
|
|
@@ -26,7 +26,7 @@ describe "brightbox sql instances resize" do
|
|
|
26
26
|
it "does not error" do
|
|
27
27
|
expect { output }.to_not raise_error
|
|
28
28
|
|
|
29
|
-
expect(stderr).to
|
|
29
|
+
expect(stderr).to include("ERROR: You must specify a valid SQL instance ID as the first argument\n")
|
|
30
30
|
|
|
31
31
|
expect(stdout).to match("")
|
|
32
32
|
end
|
|
@@ -47,7 +47,7 @@ describe "brightbox sql instances resize" do
|
|
|
47
47
|
it "does not error" do
|
|
48
48
|
expect { output }.to_not raise_error
|
|
49
49
|
|
|
50
|
-
expect(stderr).to
|
|
50
|
+
expect(stderr).to include("ERROR: Couldn't find 'dbs-xsd23'\n")
|
|
51
51
|
|
|
52
52
|
expect(stdout).to match("")
|
|
53
53
|
end
|
|
@@ -59,7 +59,7 @@ describe "brightbox sql instances resize" do
|
|
|
59
59
|
it "does not error" do
|
|
60
60
|
expect { output }.to_not raise_error
|
|
61
61
|
|
|
62
|
-
expect(stderr).to
|
|
62
|
+
expect(stderr).to include("ERROR: Cloud SQL type format is invalid\n")
|
|
63
63
|
|
|
64
64
|
expect(stdout).to match("")
|
|
65
65
|
end
|
|
@@ -104,7 +104,7 @@ describe "brightbox sql instances resize" do
|
|
|
104
104
|
it "does not error" do
|
|
105
105
|
expect { output }.to_not raise_error
|
|
106
106
|
|
|
107
|
-
expect(stderr).to
|
|
107
|
+
expect(stderr).to include("Resizing dbs-zzasa\n")
|
|
108
108
|
|
|
109
109
|
expect(stdout).to match("dbs-zzasa")
|
|
110
110
|
end
|
|
@@ -66,8 +66,9 @@ describe "brightbox sql instances" do
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
it "simplifies the maintenance window" do
|
|
69
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
|
70
|
+
|
|
69
71
|
expect(stdout).to include("maintenance_window: Sunday 06:00 UTC")
|
|
70
|
-
expect(stderr).to be_empty
|
|
71
72
|
end
|
|
72
73
|
|
|
73
74
|
it "includes snapshots schedule fields" do
|