brightbox-cli 5.0.0.alpha → 5.0.0.rc2

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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -1
  3. data/CHANGELOG.md +63 -0
  4. data/Gemfile.lock +1 -1
  5. data/lib/brightbox-cli/accounts.rb +5 -1
  6. data/lib/brightbox-cli/api.rb +34 -1
  7. data/lib/brightbox-cli/cloud_ips.rb +6 -6
  8. data/lib/brightbox-cli/collaboration.rb +3 -7
  9. data/lib/brightbox-cli/commands/images/show.rb +5 -1
  10. data/lib/brightbox-cli/commands/lbs/create.rb +0 -2
  11. data/lib/brightbox-cli/commands/lbs/show.rb +9 -1
  12. data/lib/brightbox-cli/commands/servers/show.rb +5 -1
  13. data/lib/brightbox-cli/commands/users/show.rb +5 -1
  14. data/lib/brightbox-cli/commands/volumes/show.rb +5 -1
  15. data/lib/brightbox-cli/config.rb +10 -4
  16. data/lib/brightbox-cli/database_server.rb +20 -20
  17. data/lib/brightbox-cli/database_snapshot.rb +5 -5
  18. data/lib/brightbox-cli/database_type.rb +4 -8
  19. data/lib/brightbox-cli/detailed_server.rb +26 -28
  20. data/lib/brightbox-cli/detailed_server_group.rb +2 -2
  21. data/lib/brightbox-cli/firewall_policy.rb +5 -9
  22. data/lib/brightbox-cli/firewall_rule.rb +14 -15
  23. data/lib/brightbox-cli/images.rb +22 -21
  24. data/lib/brightbox-cli/indifferent_access_hash.rb +50 -0
  25. data/lib/brightbox-cli/load_balancers.rb +27 -11
  26. data/lib/brightbox-cli/server_groups.rb +4 -8
  27. data/lib/brightbox-cli/servers.rb +22 -16
  28. data/lib/brightbox-cli/types.rb +4 -8
  29. data/lib/brightbox-cli/user_collaboration.rb +1 -1
  30. data/lib/brightbox-cli/users.rb +3 -5
  31. data/lib/brightbox-cli/version.rb +1 -1
  32. data/lib/brightbox-cli/volume.rb +9 -13
  33. data/lib/brightbox-cli/zones.rb +0 -4
  34. data/lib/brightbox_cli.rb +1 -0
  35. data/spec/commands/cloudips/update_spec.rb +7 -5
  36. data/spec/commands/configmaps/create_spec.rb +6 -6
  37. data/spec/commands/configmaps/destroy_spec.rb +1 -1
  38. data/spec/commands/configmaps/list_spec.rb +1 -1
  39. data/spec/commands/configmaps/show_spec.rb +3 -3
  40. data/spec/commands/configmaps/update_spec.rb +9 -9
  41. data/spec/commands/images/show_spec.rb +49 -19
  42. data/spec/commands/lbs/create_spec.rb +12 -26
  43. data/spec/commands/lbs/show_spec.rb +120 -22
  44. data/spec/commands/lbs/update_spec.rb +4 -4
  45. data/spec/commands/servers/show_spec.rb +83 -1
  46. data/spec/commands/servers/update_spec.rb +7 -7
  47. data/spec/commands/sql/instances/create_spec.rb +8 -8
  48. data/spec/commands/sql/instances/reset_spec.rb +3 -3
  49. data/spec/commands/sql/instances/resize_spec.rb +4 -4
  50. data/spec/commands/sql/instances/show_spec.rb +2 -1
  51. data/spec/commands/sql/instances/update_spec.rb +3 -3
  52. data/spec/commands/sql/snapshots/list_spec.rb +1 -1
  53. data/spec/commands/sql/snapshots/show_spec.rb +50 -7
  54. data/spec/commands/users/show_spec.rb +66 -1
  55. data/spec/commands/volumes/attach_spec.rb +4 -4
  56. data/spec/commands/volumes/copy_spec.rb +2 -2
  57. data/spec/commands/volumes/destroy_spec.rb +1 -1
  58. data/spec/commands/volumes/detach_spec.rb +1 -1
  59. data/spec/commands/volumes/list_spec.rb +1 -1
  60. data/spec/commands/volumes/resize_spec.rb +3 -3
  61. data/spec/commands/volumes/show_spec.rb +54 -25
  62. data/spec/commands/volumes/update_spec.rb +4 -4
  63. data/spec/spec_helper.rb +14 -10
  64. data/spec/support/shared/api_resource_examples.rb +25 -0
  65. data/spec/unit/brightbox/account/attributes_spec.rb +13 -0
  66. data/spec/unit/brightbox/api/attributes_spec.rb +65 -0
  67. data/spec/unit/brightbox/api/fog_attributes_spec.rb +65 -0
  68. data/spec/unit/brightbox/cloud_ip/attributes_spec.rb +19 -0
  69. data/spec/unit/brightbox/collaborating_account/attributes_spec.rb +13 -0
  70. data/spec/unit/brightbox/database_server/attributes_spec.rb +13 -0
  71. data/spec/unit/brightbox/database_snapshot/attributes_spec.rb +13 -0
  72. data/spec/unit/brightbox/database_type/attributes_spec.rb +20 -0
  73. data/spec/unit/brightbox/detailed_server/attributes_spec.rb +29 -0
  74. data/spec/unit/brightbox/detailed_server_group/attributes_spec.rb +13 -0
  75. data/spec/unit/brightbox/firewall_policy/attributes_spec.rb +21 -0
  76. data/spec/unit/brightbox/firewall_rule/attributes_spec.rb +18 -0
  77. data/spec/unit/brightbox/image/attributes_spec.rb +13 -0
  78. data/spec/unit/brightbox/image/status_spec.rb +67 -0
  79. data/spec/unit/brightbox/load_balancer/acme_cert_spec.rb +75 -0
  80. data/spec/unit/brightbox/load_balancer/attributes_spec.rb +13 -0
  81. data/spec/unit/brightbox/load_balancer/formatted_acme_domains_spec.rb +78 -0
  82. data/spec/unit/brightbox/server/attributes_spec.rb +29 -0
  83. data/spec/unit/brightbox/server_group/attributes_spec.rb +13 -0
  84. data/spec/unit/brightbox/type/attributes_spec.rb +20 -0
  85. data/spec/unit/brightbox/user/attributes_spec.rb +13 -0
  86. data/spec/unit/brightbox/user_collaboration/attributes_spec.rb +13 -0
  87. metadata +50 -10
  88. data/spec/cassettes/brightbox_sql_snapshots/show/when_resource_exists/does_not_output_to_stderr.yml +0 -93
@@ -11,48 +11,34 @@ describe "brightbox lbs" do
11
11
  cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
12
12
  end
13
13
 
14
- context "without required nodes arguments" do
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" => [{ "node" => "srv-12345" }]))
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 eq("Creating a new load balancer\n")
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 required nodes arguments" do
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 eq("Creating a new load balancer\n")
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 nodes" do
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 eq("Creating a new load balancer\n")
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 eq("Creating a new load balancer\n")
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 eq("Creating a new load balancer\n")
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 eq("Creating a new load balancer\n")
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
@@ -11,47 +11,83 @@ describe "brightbox lbs" do
11
11
  cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
12
12
  end
13
13
 
14
- context "without identifier argument" do
14
+ context "without arguments" do
15
15
  let(:argv) { %w[lbs show] }
16
+
17
+ it "reports missing IDs" do
18
+ expect { output }.to_not raise_error
19
+
20
+ aggregate_failures do
21
+ expect(stderr).to include("ERROR: You must specify load balancer IDs to show")
22
+ expect(stdout).to be_empty
23
+ end
24
+ end
25
+ end
26
+
27
+ context "with identifier argument" do
28
+ let(:argv) { %w[lbs show lba-12345] }
16
29
  let(:json_response) do
17
30
  <<~EOS
18
- [
19
- {
20
- "id":"lba-12345",
21
- "name":"app-lb1",
22
- "status":"active",
23
- "created_at":"2012-03-05T12:00:00Z",
24
- "nodes":[
31
+ {
32
+ "id":"lba-12345",
33
+ "name":"app-lb1",
34
+ "status":"active",
35
+ "created_at":"2012-03-05T12:00:00Z",
36
+ "acme": {
37
+ "domains": [
38
+ {
39
+ "identifier": "domain.test",
40
+ "status": "verified"
41
+ },
25
42
  {
26
- "id":"srv-12345",
27
- "status":"active"
43
+ "identifier": "domain2.test",
44
+ "status": "verified"
28
45
  }
29
- ]
30
- }
31
- ]
46
+ ],
47
+ "certificate": {
48
+ "domains": [
49
+ "domain.test"
50
+ ],
51
+ "expires_at": "2025-12-31T23:59:59Z",
52
+ "fingerprint": "fingerprint",
53
+ "issued_at": "2025-01-01T00:00:00Z"
54
+ }
55
+ },
56
+ "nodes":[
57
+ {
58
+ "id":"srv-12345",
59
+ "status":"active"
60
+ }
61
+ ]
62
+ }
32
63
  EOS
33
64
  end
34
65
 
35
66
  before do
36
- stub_request(:get, "http://api.brightbox.localhost/1.0/load_balancers?account_id=acc-12345")
67
+ stub_request(:get, "http://api.brightbox.localhost/1.0/load_balancers/lba-12345?account_id=acc-12345")
37
68
  .to_return(:status => 200, :body => json_response)
38
69
  end
39
70
 
40
71
  it "shows load balancer details" do
41
72
  aggregate_failures do
42
- expect(stderr).to eq("")
73
+ expect(stderr).to be_empty unless ENV["DEBUG"]
43
74
  expect(stdout).to include("id: lba-12345")
44
75
  expect(stdout).to include("status: active")
45
76
  expect(stdout).to include("name: app-lb1")
46
77
  expect(stdout).to include("created_at: 2012-03-05T12:00Z")
47
78
  expect(stdout).to include("nodes: srv-12345")
79
+ expect(stdout).to include("acme_domains: domain.test:verified,domain2.test:verified")
80
+ expect(stdout).to include("acme_cert_subjects: domain.test")
81
+ expect(stdout).to include("acme_cert_expires_at: 2025-12-31T23:59:59Z")
82
+ expect(stdout).to include("acme_cert_fingerprint: fingerprint")
83
+ expect(stdout).to include("acme_cert_issued_at: 2025-01-01T00:00:00Z")
48
84
  end
49
85
  end
50
86
  end
51
87
 
52
- context "with identifier argument" do
53
- let(:argv) { %w[lbs show lba-12345] }
54
- let(:json_response) do
88
+ context "with multiple identifiers" do
89
+ let(:argv) { %w[lbs show lba-12345 lba-54321] }
90
+ let(:json_response_1) do
55
91
  <<~EOS
56
92
  {
57
93
  "id":"lba-12345",
@@ -68,7 +104,15 @@ describe "brightbox lbs" do
68
104
  "identifier": "domain2.test",
69
105
  "status": "verified"
70
106
  }
71
- ]
107
+ ],
108
+ "certificate": {
109
+ "domains": [
110
+ "domain.test"
111
+ ],
112
+ "expires_at": "2025-12-31T23:59:59Z",
113
+ "fingerprint": "fingerprint",
114
+ "issued_at": "2025-01-01T00:00:00Z"
115
+ }
72
116
  },
73
117
  "nodes":[
74
118
  {
@@ -79,21 +123,75 @@ describe "brightbox lbs" do
79
123
  }
80
124
  EOS
81
125
  end
126
+ let(:json_response_2) do
127
+ <<~EOS
128
+ {
129
+ "id":"lba-54321",
130
+ "name":"app-lb2",
131
+ "status":"active",
132
+ "created_at":"2012-03-05T12:00:00Z",
133
+ "acme": {
134
+ "domains": [
135
+ {
136
+ "identifier": "domain.test",
137
+ "status": "verified"
138
+ },
139
+ {
140
+ "identifier": "domain2.test",
141
+ "status": "verified"
142
+ }
143
+ ],
144
+ "certificate": {
145
+ "domains": [
146
+ "domain.test"
147
+ ],
148
+ "expires_at": "2025-12-31T23:59:59Z",
149
+ "fingerprint": "fingerprint",
150
+ "issued_at": "2025-01-01T00:00:00Z"
151
+ }
152
+ },
153
+ "nodes":[
154
+ {
155
+ "id":"srv-54321",
156
+ "status":"active"
157
+ }
158
+ ]
159
+ }
160
+ EOS
161
+ end
82
162
 
83
163
  before do
84
164
  stub_request(:get, "http://api.brightbox.localhost/1.0/load_balancers/lba-12345?account_id=acc-12345")
85
- .to_return(:status => 200, :body => json_response)
165
+ .to_return(:status => 200, :body => json_response_1)
166
+
167
+ stub_request(:get, "http://api.brightbox.localhost/1.0/load_balancers/lba-54321?account_id=acc-12345")
168
+ .to_return(:status => 200, :body => json_response_2)
86
169
  end
87
170
 
88
- it "shows load balancer details" do
171
+ it "shows multiple load balancer details" do
89
172
  aggregate_failures do
90
- expect(stderr).to eq("")
173
+ expect(stderr).to be_empty unless ENV["DEBUG"]
91
174
  expect(stdout).to include("id: lba-12345")
92
175
  expect(stdout).to include("status: active")
93
176
  expect(stdout).to include("name: app-lb1")
94
177
  expect(stdout).to include("created_at: 2012-03-05T12:00Z")
95
178
  expect(stdout).to include("nodes: srv-12345")
96
179
  expect(stdout).to include("acme_domains: domain.test:verified,domain2.test:verified")
180
+ expect(stdout).to include("acme_cert_subjects: domain.test")
181
+ expect(stdout).to include("acme_cert_expires_at: 2025-12-31T23:59:59Z")
182
+ expect(stdout).to include("acme_cert_fingerprint: fingerprint")
183
+ expect(stdout).to include("acme_cert_issued_at: 2025-01-01T00:00:00Z")
184
+
185
+ expect(stdout).to include("id: lba-54321")
186
+ expect(stdout).to include("status: active")
187
+ expect(stdout).to include("name: app-lb2")
188
+ expect(stdout).to include("created_at: 2012-03-05T12:00Z")
189
+ expect(stdout).to include("nodes: srv-54321")
190
+ expect(stdout).to include("acme_domains: domain.test:verified,domain2.test:verified")
191
+ expect(stdout).to include("acme_cert_subjects: domain.test")
192
+ expect(stdout).to include("acme_cert_expires_at: 2025-12-31T23:59:59Z")
193
+ expect(stdout).to include("acme_cert_fingerprint: fingerprint")
194
+ expect(stdout).to include("acme_cert_issued_at: 2025-01-01T00:00:00Z")
97
195
  end
98
196
  end
99
197
  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 eq("Updating load balancer lba-12345\n")
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 eq("Updating load balancer lba-grt24\n")
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 eq("Updating load balancer lba-kl432\n")
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 eq("Updating load balancer lba-12345\n")
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
@@ -6,11 +6,93 @@ describe "brightbox servers" do
6
6
  let(:stdout) { output.stdout }
7
7
  let(:stderr) { output.stderr }
8
8
 
9
- context "" do
9
+ before do
10
+ WebMock.reset!
11
+
12
+ config_from_contents(API_CLIENT_CONFIG_CONTENTS)
13
+ stub_client_token_request
14
+ Brightbox.config.reauthenticate
15
+ end
16
+
17
+ context "without arguments" do
10
18
  let(:argv) { %w[servers show] }
11
19
 
20
+ it "reports missing IDs" do
21
+ expect { output }.to_not raise_error
22
+
23
+ aggregate_failures do
24
+ expect(stderr).to match("ERROR: You must specify server IDs to show")
25
+ expect(stdout).to be_empty
26
+ end
27
+ end
28
+ end
29
+
30
+ context "with identifier argument" do
31
+ let(:argv) { %w[servers show srv-55555] }
32
+
33
+ before do
34
+ stub_request(:get, "#{api_url}/1.0/images")
35
+ .with(query: hash_including(account_id: "acc-12345"))
36
+ .to_return(
37
+ status: 200,
38
+ body: {
39
+ images: [
40
+ {
41
+ id: "img-12345",
42
+ min_ram: 2_048
43
+ }
44
+ ]
45
+ }.to_json
46
+ )
47
+
48
+ stub_request(:get, "#{api_url}/1.0/images/img-12345")
49
+ .with(query: hash_including(account_id: "acc-12345"))
50
+ .to_return(
51
+ status: 200,
52
+ body: {
53
+ id: "img-12345"
54
+ }.to_json
55
+ )
56
+
57
+ stub_request(:get, "#{api_url}/1.0/servers/srv-55555")
58
+ .with(query: hash_including(account_id: "acc-12345"))
59
+ .to_return(
60
+ status: 200,
61
+ body: {
62
+ id: "srv-12345",
63
+ name: "app-server1",
64
+ status: "active",
65
+ image: {
66
+ id: "img-12345"
67
+ },
68
+ server_type: {
69
+ id: "typ-12345"
70
+ },
71
+ cloud_ips: [],
72
+ interfaces: [
73
+ {
74
+ id: "int-12345",
75
+ ipv4_address: "10.0.0.0",
76
+ ipv6_address: "2a02:1234:abcd:5678::1"
77
+ }
78
+ ],
79
+ server_groups: [],
80
+ snapshots: []
81
+ }.to_json
82
+ )
83
+ end
84
+
12
85
  it "does not error" do
86
+ require "pry"
87
+ # binding.pry
13
88
  expect { output }.to_not raise_error
89
+
90
+ aggregate_failures do
91
+ expect(stderr).not_to match("ERROR")
92
+ expect(stdout).to match("id: srv-12345")
93
+ expect(stdout).to match("status: active")
94
+ expect(stdout).to match("name: app-server1")
95
+ end
14
96
  end
15
97
  end
16
98
  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 eq("ERROR: You must specify a valid server id as the first argument\n")
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 eq("Updating server srv-klfkd\n")
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 eq("Updating server srv-ds321\n")
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 eq("Updating server srv-ds321\n")
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 eq("Updating server srv-ds321\n")
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 eq("Updating server srv-ds321 with 0.01k of user data\n")
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 eq("Updating server srv-ds321 with 0.00k of user data\n")
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 eq("")
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 eq("")
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 eq("")
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 eq("")
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 eq("")
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 eq("")
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 eq("")
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 eq("")
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 eq("ERROR: You must specify a valid SQL instance ID as the first argument\n")
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 eq("ERROR: Couldn't find 'dbs-l3kd4'\n")
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 eq("Resetting dbs-po953\n")
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 eq("ERROR: You must specify a valid SQL instance ID as the first argument\n")
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 eq("ERROR: Couldn't find 'dbs-xsd23'\n")
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 eq("ERROR: Cloud SQL type format is invalid\n")
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 eq("Resizing dbs-zzasa\n")
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
@@ -30,7 +30,7 @@ describe "brightbox sql instances" do
30
30
  end
31
31
 
32
32
  it "sets custom maintenance window settings" do
33
- expect(stderr).to eql("Updating dbs-12345\n")
33
+ expect(stderr).to include("Updating dbs-12345\n")
34
34
  expect(stdout).to include("dbs-12345")
35
35
  end
36
36
  end
@@ -54,7 +54,7 @@ describe "brightbox sql instances" do
54
54
  expect(Brightbox::DatabaseServer).to receive(:find).and_return(dbs)
55
55
  expect(dbs).to receive(:update).with(expected_args).and_call_original
56
56
 
57
- expect(stderr).to eq("Updating dbs-12345\n")
57
+ expect(stderr).to include("Updating dbs-12345\n")
58
58
  expect(stdout).to include("dbs-12345")
59
59
  end
60
60
  end
@@ -78,7 +78,7 @@ describe "brightbox sql instances" do
78
78
  expect(Brightbox::DatabaseServer).to receive(:find).and_return(dbs)
79
79
  expect(dbs).to receive(:update).with(expected_args).and_call_original
80
80
 
81
- expect(stderr).to eq("Updating dbs-432sf\n")
81
+ expect(stderr).to include("Updating dbs-432sf\n")
82
82
  expect(stdout).to include("dbs-432sf")
83
83
  end
84
84
  end
@@ -17,7 +17,7 @@ describe "brightbox sql snapshots" do
17
17
  let(:argv) { %w[sql snapshots list] }
18
18
 
19
19
  it "does not output to stderr" do
20
- expect(stderr).to eql("")
20
+ expect(stderr).to be_empty unless ENV["DEBUG"]
21
21
  end
22
22
 
23
23
  it "outputs table details to stdout" do