brightbox-cli 5.0.0.alpha → 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 +2 -1
- data/CHANGELOG.md +60 -0
- data/Gemfile.lock +1 -1
- 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/lbs/create.rb +0 -2
- data/lib/brightbox-cli/commands/lbs/show.rb +4 -0
- data/lib/brightbox-cli/config.rb +10 -4
- 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 +22 -21
- data/lib/brightbox-cli/indifferent_access_hash.rb +50 -0
- data/lib/brightbox-cli/load_balancers.rb +27 -11
- 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 +12 -26
- data/spec/commands/lbs/show_spec.rb +15 -3
- data/spec/commands/lbs/update_spec.rb +4 -4
- 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 +14 -10
- 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/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_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 +47 -4
- data/spec/cassettes/brightbox_sql_snapshots/show/when_resource_exists/does_not_output_to_stderr.yml +0 -93
@@ -9,26 +9,42 @@ module Brightbox
|
|
9
9
|
new(conn.load_balancers.create(options))
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
if attributes[
|
14
|
-
|
15
|
-
[
|
16
|
-
|
12
|
+
def acme_cert
|
13
|
+
if attributes[:acme] && attributes[:acme][:certificate]
|
14
|
+
OpenStruct.new(
|
15
|
+
:expires_at => attributes[:acme][:certificate][:expires_at],
|
16
|
+
:fingerprint => attributes[:acme][:certificate][:fingerprint],
|
17
|
+
:issued_at => attributes[:acme][:certificate][:issued_at],
|
18
|
+
:subjects => attributes[:acme][:certificate][:domains].join(",")
|
19
|
+
)
|
17
20
|
else
|
18
|
-
|
21
|
+
OpenStruct.new(
|
22
|
+
:expires_at => "",
|
23
|
+
:fingerprint => "",
|
24
|
+
:issued_at => "",
|
25
|
+
:subjects => ""
|
26
|
+
)
|
19
27
|
end
|
20
|
-
rescue StandardError
|
21
|
-
[]
|
22
28
|
end
|
23
29
|
|
24
|
-
def
|
25
|
-
|
30
|
+
def formatted_acme_domains
|
31
|
+
return "" unless attributes[:acme]
|
32
|
+
|
33
|
+
attributes[:acme][:domains].map do |domain|
|
34
|
+
[domain[:identifier], domain[:status]].join(":")
|
35
|
+
end.join(",")
|
36
|
+
rescue StandardError
|
37
|
+
""
|
26
38
|
end
|
27
39
|
|
28
40
|
def to_row
|
29
41
|
attributes.merge(
|
30
42
|
:locked => locked?,
|
31
|
-
:acme_domains =>
|
43
|
+
:acme_domains => formatted_acme_domains,
|
44
|
+
:acme_cert_expires_at => acme_cert.expires_at,
|
45
|
+
:acme_cert_fingerprint => acme_cert.fingerprint,
|
46
|
+
:acme_cert_issued_at => acme_cert.issued_at,
|
47
|
+
:acme_cert_subjects => acme_cert.subjects,
|
32
48
|
:ssl_minimum_version => ssl_minimum_version,
|
33
49
|
:ssl_issuer => certificate_issuer,
|
34
50
|
:ssl_subject => certificate_subject,
|
@@ -34,15 +34,11 @@ module Brightbox
|
|
34
34
|
fog_model.destroy
|
35
35
|
end
|
36
36
|
|
37
|
-
def attributes
|
38
|
-
fog_model.attributes
|
39
|
-
end
|
40
|
-
|
41
37
|
def to_row
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
super.merge(
|
39
|
+
servers: server_string,
|
40
|
+
server_count: server_count
|
41
|
+
).to_h
|
46
42
|
end
|
47
43
|
|
48
44
|
def server_ids
|
@@ -37,25 +37,31 @@ module Brightbox
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def attributes
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
40
|
+
fog_attributes.tap do |attrs|
|
41
|
+
attrs[:created_at] = created_at
|
42
|
+
attrs[:created_on] = created_on
|
43
|
+
attrs[:hostname] = hostname
|
44
|
+
attrs[:image] = image_id
|
45
|
+
attrs[:locked] = locked?
|
46
|
+
attrs[:status] = fog_model.state
|
47
|
+
attrs[:type] = server_type["handle"]
|
48
|
+
attrs[:zone] = zone && zone["handle"]
|
49
|
+
|
50
|
+
unless cloud_ips.empty?
|
51
|
+
attrs[:public_hostname] = "public.#{fqdn}"
|
52
|
+
end
|
53
|
+
|
54
|
+
if interfaces.any? { |i| i["ipv6_address"] }
|
55
|
+
attrs[:ipv6_hostname] = ipv6_fqdn
|
56
|
+
end
|
57
|
+
end
|
52
58
|
end
|
53
59
|
|
54
60
|
def to_row
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
61
|
+
attributes.merge(
|
62
|
+
cloud_ips: cloud_ips.map { |i| i["public_ip"] }.join(", "),
|
63
|
+
ips: interfaces.map { |i| i["ipv4_address"] }.join(", ")
|
64
|
+
)
|
59
65
|
end
|
60
66
|
|
61
67
|
def deleted?
|
data/lib/brightbox-cli/types.rb
CHANGED
@@ -3,10 +3,10 @@ module Brightbox
|
|
3
3
|
def self.require_account?; true; end
|
4
4
|
|
5
5
|
def attributes
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
fog_attributes.tap do |attrs|
|
7
|
+
attrs[:ram] = ram
|
8
|
+
attrs[:disk] = disk
|
9
|
+
end
|
10
10
|
end
|
11
11
|
|
12
12
|
def ram
|
@@ -17,10 +17,6 @@ module Brightbox
|
|
17
17
|
fog_model.disk.to_i
|
18
18
|
end
|
19
19
|
|
20
|
-
def to_row
|
21
|
-
attributes
|
22
|
-
end
|
23
|
-
|
24
20
|
def render_cell
|
25
21
|
fog_model.handle
|
26
22
|
end
|
data/lib/brightbox-cli/users.rb
CHANGED
data/lib/brightbox-cli/volume.rb
CHANGED
@@ -57,19 +57,15 @@ module Brightbox
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def attributes
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
def to_row
|
72
|
-
attributes
|
60
|
+
super.merge(
|
61
|
+
id: fog_model.id,
|
62
|
+
image: image_id,
|
63
|
+
locked: locked?,
|
64
|
+
server: server_id,
|
65
|
+
status: state,
|
66
|
+
type: storage_type,
|
67
|
+
zone: zone_id
|
68
|
+
)
|
73
69
|
end
|
74
70
|
|
75
71
|
def update(options)
|
data/lib/brightbox-cli/zones.rb
CHANGED
data/lib/brightbox_cli.rb
CHANGED
@@ -71,6 +71,7 @@ require_relative "brightbox/cli/config"
|
|
71
71
|
require_relative "brightbox-cli/connection_manager"
|
72
72
|
require_relative "brightbox-cli/tables"
|
73
73
|
require_relative "brightbox-cli/logging"
|
74
|
+
require_relative "brightbox-cli/indifferent_access_hash"
|
74
75
|
require_relative "brightbox-cli/api"
|
75
76
|
require_relative "brightbox-cli/config/cache"
|
76
77
|
require_relative "brightbox-cli/config/gpg_encrypted_passwords"
|
@@ -59,7 +59,9 @@ describe "brightbox cloudips update" do
|
|
59
59
|
|
60
60
|
it "puts new name in update" do
|
61
61
|
expect(Brightbox::CloudIP.conn).to receive(:update_cloud_ip).with(*expected_args).and_call_original
|
62
|
-
|
62
|
+
|
63
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
64
|
+
|
63
65
|
expect(stdout).to include("cip-12345")
|
64
66
|
expect(stdout).to include("New name")
|
65
67
|
end
|
@@ -82,7 +84,7 @@ describe "brightbox cloudips update" do
|
|
82
84
|
|
83
85
|
it "puts new name in update" do
|
84
86
|
expect(Brightbox::CloudIP.conn).to receive(:update_cloud_ip).with(*expected_args).and_call_original
|
85
|
-
expect(stderr).to
|
87
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
86
88
|
expect(stdout).to include("cip-12345")
|
87
89
|
end
|
88
90
|
end
|
@@ -114,7 +116,7 @@ describe "brightbox cloudips update" do
|
|
114
116
|
end
|
115
117
|
|
116
118
|
it "puts new name in update" do
|
117
|
-
expect(stderr).to
|
119
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
118
120
|
expect(stdout).to include("cip-dfsa3")
|
119
121
|
expect(stdout).to include("domain.example")
|
120
122
|
end
|
@@ -146,7 +148,7 @@ describe "brightbox cloudips update" do
|
|
146
148
|
end
|
147
149
|
|
148
150
|
it "puts new name in update" do
|
149
|
-
expect(stderr).to
|
151
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
150
152
|
expect(stdout).to include("cip-dfsa3")
|
151
153
|
end
|
152
154
|
end
|
@@ -155,7 +157,7 @@ describe "brightbox cloudips update" do
|
|
155
157
|
let(:argv) { ["cloudips", "update", "--reverse-dns", "domain.example", "--delete-reverse-dns", "cip-dfsa3"] }
|
156
158
|
|
157
159
|
it "puts new name in update" do
|
158
|
-
expect(stderr).to
|
160
|
+
expect(stderr).to include("ERROR: You must either specify a reverse DNS record or --delete-reverse-dns\n")
|
159
161
|
expect(stdout).to eq("")
|
160
162
|
end
|
161
163
|
end
|
@@ -109,7 +109,7 @@ describe "brightbox configmaps create" do
|
|
109
109
|
it "does not error" do
|
110
110
|
expect { output }.to_not raise_error
|
111
111
|
|
112
|
-
expect(stderr).to
|
112
|
+
expect(stderr).to include("ERROR: Config map data was not valid JSON\n")
|
113
113
|
|
114
114
|
expect(stdout).to eq("")
|
115
115
|
end
|
@@ -156,7 +156,7 @@ describe "brightbox configmaps create" do
|
|
156
156
|
it "does not error" do
|
157
157
|
expect { output }.to_not raise_error
|
158
158
|
|
159
|
-
expect(stderr).to
|
159
|
+
expect(stderr).to include("Creating config map\n")
|
160
160
|
|
161
161
|
aggregate_failures do
|
162
162
|
expect(stdout).to match("cfg-s432l")
|
@@ -169,7 +169,7 @@ describe "brightbox configmaps create" do
|
|
169
169
|
it "does not error" do
|
170
170
|
expect { output }.to_not raise_error
|
171
171
|
|
172
|
-
expect(stderr).to
|
172
|
+
expect(stderr).to include("ERROR: Config map data was not valid JSON\n")
|
173
173
|
|
174
174
|
expect(stdout).to eq("")
|
175
175
|
end
|
@@ -219,7 +219,7 @@ describe "brightbox configmaps create" do
|
|
219
219
|
it "does not error" do
|
220
220
|
expect { output }.to_not raise_error
|
221
221
|
|
222
|
-
expect(stderr).to
|
222
|
+
expect(stderr).to include("Creating config map\n")
|
223
223
|
|
224
224
|
aggregate_failures do
|
225
225
|
expect(stdout).to match("cfg-mj53s")
|
@@ -232,7 +232,7 @@ describe "brightbox configmaps create" do
|
|
232
232
|
it "does not error" do
|
233
233
|
expect { output }.to_not raise_error
|
234
234
|
|
235
|
-
expect(stderr).to
|
235
|
+
expect(stderr).to include("ERROR: Config map data was not valid JSON\n")
|
236
236
|
|
237
237
|
expect(stdout).to eq("")
|
238
238
|
end
|
@@ -248,7 +248,7 @@ describe "brightbox configmaps create" do
|
|
248
248
|
it "does not error" do
|
249
249
|
expect { output }.to_not raise_error
|
250
250
|
|
251
|
-
expect(stderr).to
|
251
|
+
expect(stderr).to include("ERROR: Config map data can only be passed by either 'data' or 'data-file'\n")
|
252
252
|
|
253
253
|
expect(stdout).to eq("")
|
254
254
|
end
|
@@ -26,7 +26,7 @@ describe "brightbox configmaps destroy" 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 config map IDs as arguments\n")
|
30
30
|
|
31
31
|
expect(stdout).to match("")
|
32
32
|
end
|
@@ -35,7 +35,7 @@ describe "brightbox configmaps show" do
|
|
35
35
|
it "does not error" do
|
36
36
|
expect { output }.to_not raise_error
|
37
37
|
|
38
|
-
expect(stderr).to
|
38
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
39
39
|
|
40
40
|
aggregate_failures do
|
41
41
|
expect(stdout).to match("id: cfg-12345")
|
@@ -81,7 +81,7 @@ describe "brightbox configmaps show" do
|
|
81
81
|
it "does not error" do
|
82
82
|
expect { output }.to_not raise_error
|
83
83
|
|
84
|
-
expect(stderr).to
|
84
|
+
expect(stderr).to include("ERROR: You can only access data for a single config map at a time\n")
|
85
85
|
|
86
86
|
expect(stdout).to eq("")
|
87
87
|
end
|
@@ -137,7 +137,7 @@ describe "brightbox configmaps show" do
|
|
137
137
|
it "does not error" do
|
138
138
|
expect { output }.to_not raise_error
|
139
139
|
|
140
|
-
expect(stderr).to
|
140
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
141
141
|
|
142
142
|
expect(stdout).to eq(%({"key":"value","name":"key name"}\n))
|
143
143
|
end
|
@@ -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,48 +11,34 @@ describe "brightbox lbs" do
|
|
11
11
|
cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
|
12
12
|
end
|
13
13
|
|
14
|
-
context "without
|
14
|
+
context "without nodes arguments" do
|
15
15
|
let(:argv) { %w[lbs create] }
|
16
|
-
|
17
|
-
it "does not error" do
|
18
|
-
expect { output }.to_not raise_error
|
19
|
-
|
20
|
-
expect(stderr).to eq("ERROR: You must specify which servers to balance connections to\n")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context "with required nodes arguments" do
|
25
|
-
let(:argv) { %w[lbs create srv-12345] }
|
26
|
-
let(:expected_args) { { nodes: [{ node: "srv-12345" }] } }
|
16
|
+
let(:expected_args) { { nodes: [] } }
|
27
17
|
|
28
18
|
let(:json_response) do
|
29
19
|
<<~EOS
|
30
20
|
{
|
31
21
|
"id": "lba-12345",
|
32
|
-
"nodes": [
|
33
|
-
{
|
34
|
-
"id": "srv-12345"
|
35
|
-
}
|
36
|
-
]
|
22
|
+
"nodes": []
|
37
23
|
}
|
38
24
|
EOS
|
39
25
|
end
|
40
26
|
|
41
27
|
before do
|
42
28
|
stub_request(:post, "http://api.brightbox.localhost/1.0/load_balancers?account_id=acc-12345")
|
43
|
-
.with(:body => hash_including("nodes" => [
|
29
|
+
.with(:body => hash_including("nodes" => []))
|
44
30
|
.to_return(:status => 202, :body => json_response)
|
45
31
|
end
|
46
32
|
|
47
33
|
it "makes request" do
|
48
34
|
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
49
35
|
|
50
|
-
expect(stderr).to
|
36
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
51
37
|
expect(stdout).to include("lba-12345")
|
52
38
|
end
|
53
39
|
end
|
54
40
|
|
55
|
-
context "with
|
41
|
+
context "with a nodes argument" do
|
56
42
|
let(:argv) { %w[lbs create srv-12345] }
|
57
43
|
let(:expected_args) { { nodes: [{ node: "srv-12345" }] } }
|
58
44
|
|
@@ -78,12 +64,12 @@ describe "brightbox lbs" do
|
|
78
64
|
it "makes request" do
|
79
65
|
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
80
66
|
|
81
|
-
expect(stderr).to
|
67
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
82
68
|
expect(stdout).to include("lba-12345")
|
83
69
|
end
|
84
70
|
end
|
85
71
|
|
86
|
-
context "with multiple
|
72
|
+
context "with multiple node arguments" do
|
87
73
|
let(:argv) { %w[lbs create srv-12345 srv-54321] }
|
88
74
|
let(:expected_args) { { nodes: [{ node: "srv-12345" }, { node: "srv-54321" }] } }
|
89
75
|
|
@@ -112,7 +98,7 @@ describe "brightbox lbs" do
|
|
112
98
|
it "makes request" do
|
113
99
|
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
114
100
|
|
115
|
-
expect(stderr).to
|
101
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
116
102
|
expect(stdout).to include("lba-12345")
|
117
103
|
end
|
118
104
|
end
|
@@ -139,7 +125,7 @@ describe "brightbox lbs" do
|
|
139
125
|
it "includes buffer_size in response" do
|
140
126
|
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
141
127
|
|
142
|
-
expect(stderr).to
|
128
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
143
129
|
expect(stdout).to include("lba-12345")
|
144
130
|
end
|
145
131
|
end
|
@@ -165,7 +151,7 @@ describe "brightbox lbs" do
|
|
165
151
|
|
166
152
|
it "includes ssl_minimum_version in response" do
|
167
153
|
expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
|
168
|
-
expect(stderr).to
|
154
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
169
155
|
expect(stdout).to include("lba-12345")
|
170
156
|
end
|
171
157
|
end
|
@@ -206,7 +192,7 @@ describe "brightbox lbs" do
|
|
206
192
|
end
|
207
193
|
|
208
194
|
it "includes acme_certificate_domain in response" do
|
209
|
-
expect(stderr).to
|
195
|
+
expect(stderr).to include("Creating a new load balancer\n")
|
210
196
|
expect(stdout).to include("lba-12345")
|
211
197
|
end
|
212
198
|
end
|
@@ -39,7 +39,7 @@ describe "brightbox lbs" do
|
|
39
39
|
|
40
40
|
it "shows load balancer details" do
|
41
41
|
aggregate_failures do
|
42
|
-
expect(stderr).to
|
42
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
43
43
|
expect(stdout).to include("id: lba-12345")
|
44
44
|
expect(stdout).to include("status: active")
|
45
45
|
expect(stdout).to include("name: app-lb1")
|
@@ -68,7 +68,15 @@ describe "brightbox lbs" do
|
|
68
68
|
"identifier": "domain2.test",
|
69
69
|
"status": "verified"
|
70
70
|
}
|
71
|
-
]
|
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
|
+
}
|
72
80
|
},
|
73
81
|
"nodes":[
|
74
82
|
{
|
@@ -87,13 +95,17 @@ describe "brightbox lbs" do
|
|
87
95
|
|
88
96
|
it "shows load balancer details" do
|
89
97
|
aggregate_failures do
|
90
|
-
expect(stderr).to
|
98
|
+
expect(stderr).to be_empty unless ENV["DEBUG"]
|
91
99
|
expect(stdout).to include("id: lba-12345")
|
92
100
|
expect(stdout).to include("status: active")
|
93
101
|
expect(stdout).to include("name: app-lb1")
|
94
102
|
expect(stdout).to include("created_at: 2012-03-05T12:00Z")
|
95
103
|
expect(stdout).to include("nodes: srv-12345")
|
96
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")
|
97
109
|
end
|
98
110
|
end
|
99
111
|
end
|
@@ -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
|
@@ -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
|
@@ -95,7 +95,7 @@ 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
|
@@ -139,7 +139,7 @@ describe "brightbox lbs" do
|
|
139
139
|
end
|
140
140
|
|
141
141
|
it "includes acme_certificate_domain in response" do
|
142
|
-
expect(stderr).to
|
142
|
+
expect(stderr).to include("Updating load balancer lba-12345\n")
|
143
143
|
expect(stdout).to include("lba-12345")
|
144
144
|
end
|
145
145
|
end
|