brightbox-cli 4.3.2 → 4.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +5 -5
- data/brightbox-cli.gemspec +1 -1
- data/lib/brightbox-cli/commands/configmaps.rb +183 -0
- data/lib/brightbox-cli/commands/sql/instances_reset.rb +33 -0
- data/lib/brightbox-cli/commands/sql/instances_resize.rb +42 -0
- data/lib/brightbox-cli/config_map.rb +53 -0
- data/lib/brightbox-cli/database_server.rb +8 -0
- data/lib/brightbox-cli/version.rb +1 -1
- data/lib/brightbox_cli.rb +1 -0
- data/locales/en.yml +50 -0
- data/spec/commands/configmaps/create_spec.rb +257 -0
- data/spec/commands/configmaps/destroy_spec.rb +156 -0
- data/spec/commands/configmaps/list_spec.rb +96 -0
- data/spec/commands/configmaps/show_spec.rb +236 -0
- data/spec/commands/configmaps/update_spec.rb +342 -0
- data/spec/commands/sql/instances/reset_spec.rb +87 -0
- data/spec/commands/sql/instances/resize_spec.rb +112 -0
- metadata +23 -5
@@ -0,0 +1,112 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "brightbox sql instances resize" do
|
4
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
5
|
+
let(:stdout) { output.stdout }
|
6
|
+
let(:stderr) { output.stderr }
|
7
|
+
|
8
|
+
before do
|
9
|
+
config_from_contents(API_CLIENT_CONFIG_CONTENTS)
|
10
|
+
|
11
|
+
stub_request(:post, "http://api.brightbox.localhost/token")
|
12
|
+
.to_return(
|
13
|
+
status: 200,
|
14
|
+
body: JSON.dump(
|
15
|
+
access_token: "ACCESS-TOKEN",
|
16
|
+
refresh_token: "REFRESH_TOKEN"
|
17
|
+
)
|
18
|
+
)
|
19
|
+
|
20
|
+
Brightbox.config.reauthenticate
|
21
|
+
end
|
22
|
+
|
23
|
+
context "without arguments" do
|
24
|
+
let(:argv) { %w[sql instances resize] }
|
25
|
+
|
26
|
+
it "does not error" do
|
27
|
+
expect { output }.to_not raise_error
|
28
|
+
|
29
|
+
expect(stderr).to eq("ERROR: You must specify a valid SQL instance ID as the first argument\n")
|
30
|
+
|
31
|
+
expect(stdout).to match("")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with invalid ID" do
|
36
|
+
let(:argv) { %w[sql instances resize --type dbt-12345 dbs-xsd23] }
|
37
|
+
|
38
|
+
before do
|
39
|
+
stub_request(:get, "http://api.brightbox.localhost/1.0/database_servers/dbs-xsd23")
|
40
|
+
.with(query: hash_including(account_id: "acc-12345"))
|
41
|
+
.to_return(
|
42
|
+
status: 404,
|
43
|
+
body: ""
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "does not error" do
|
48
|
+
expect { output }.to_not raise_error
|
49
|
+
|
50
|
+
expect(stderr).to eq("ERROR: Couldn't find 'dbs-xsd23'\n")
|
51
|
+
|
52
|
+
expect(stdout).to match("")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "with valid ID and invalid 'type'" do
|
57
|
+
let(:argv) { %w[sql instances resize --type embiggen dbs-e23ss] }
|
58
|
+
|
59
|
+
it "does not error" do
|
60
|
+
expect { output }.to_not raise_error
|
61
|
+
|
62
|
+
expect(stderr).to eq("ERROR: Cloud SQL type format is invalid\n")
|
63
|
+
|
64
|
+
expect(stdout).to match("")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "with valid ID and 'type'" do
|
69
|
+
let(:argv) { %w[sql instances resize --type dbt-abcde dbs-zzasa] }
|
70
|
+
|
71
|
+
before do
|
72
|
+
stub_request(:get, "http://api.brightbox.localhost/1.0/database_servers/dbs-zzasa")
|
73
|
+
.with(query: hash_including(account_id: "acc-12345"))
|
74
|
+
.to_return(
|
75
|
+
status: 200,
|
76
|
+
body: {
|
77
|
+
id: "dbs-zzasa",
|
78
|
+
database_type: "dbt-12345"
|
79
|
+
}.to_json
|
80
|
+
)
|
81
|
+
.to_return(
|
82
|
+
status: 200,
|
83
|
+
body: {
|
84
|
+
id: "dbs-zzasa",
|
85
|
+
database_type: "dbt-abcde"
|
86
|
+
}.to_json
|
87
|
+
)
|
88
|
+
|
89
|
+
stub_request(:post, "http://api.brightbox.localhost/1.0/database_servers/dbs-zzasa/resize")
|
90
|
+
.with(query: hash_including(account_id: "acc-12345"),
|
91
|
+
body: {
|
92
|
+
new_type: "dbt-abcde"
|
93
|
+
}
|
94
|
+
)
|
95
|
+
.to_return(
|
96
|
+
status: 202,
|
97
|
+
body: {
|
98
|
+
id: "dbs-zzasa",
|
99
|
+
database_type: "dbt-abcde"
|
100
|
+
}.to_json
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
it "does not error" do
|
105
|
+
expect { output }.to_not raise_error
|
106
|
+
|
107
|
+
expect(stderr).to eq("Resizing dbs-zzasa\n")
|
108
|
+
|
109
|
+
expect(stdout).to match("dbs-zzasa")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightbox-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Leach
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.11.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
27
|
+
version: 1.11.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: fog-core
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,6 +318,7 @@ files:
|
|
318
318
|
- lib/brightbox-cli/commands/config/client_list.rb
|
319
319
|
- lib/brightbox-cli/commands/config/client_remove.rb
|
320
320
|
- lib/brightbox-cli/commands/config/user_add.rb
|
321
|
+
- lib/brightbox-cli/commands/configmaps.rb
|
321
322
|
- lib/brightbox-cli/commands/firewall/policies_apply.rb
|
322
323
|
- lib/brightbox-cli/commands/firewall/policies_create.rb
|
323
324
|
- lib/brightbox-cli/commands/firewall/policies_destroy.rb
|
@@ -370,7 +371,9 @@ files:
|
|
370
371
|
- lib/brightbox-cli/commands/sql/instances_destroy.rb
|
371
372
|
- lib/brightbox-cli/commands/sql/instances_list.rb
|
372
373
|
- lib/brightbox-cli/commands/sql/instances_locking.rb
|
374
|
+
- lib/brightbox-cli/commands/sql/instances_reset.rb
|
373
375
|
- lib/brightbox-cli/commands/sql/instances_reset_password.rb
|
376
|
+
- lib/brightbox-cli/commands/sql/instances_resize.rb
|
374
377
|
- lib/brightbox-cli/commands/sql/instances_show.rb
|
375
378
|
- lib/brightbox-cli/commands/sql/instances_snapshot.rb
|
376
379
|
- lib/brightbox-cli/commands/sql/instances_update.rb
|
@@ -412,6 +415,7 @@ files:
|
|
412
415
|
- lib/brightbox-cli/config/two_factor_auth.rb
|
413
416
|
- lib/brightbox-cli/config/two_factor_helper.rb
|
414
417
|
- lib/brightbox-cli/config/user_application.rb
|
418
|
+
- lib/brightbox-cli/config_map.rb
|
415
419
|
- lib/brightbox-cli/connection_manager.rb
|
416
420
|
- lib/brightbox-cli/database_server.rb
|
417
421
|
- lib/brightbox-cli/database_snapshot.rb
|
@@ -598,6 +602,11 @@ files:
|
|
598
602
|
- spec/commands/config/client_list_spec.rb
|
599
603
|
- spec/commands/config/client_remove_spec.rb
|
600
604
|
- spec/commands/config/user_add_spec.rb
|
605
|
+
- spec/commands/configmaps/create_spec.rb
|
606
|
+
- spec/commands/configmaps/destroy_spec.rb
|
607
|
+
- spec/commands/configmaps/list_spec.rb
|
608
|
+
- spec/commands/configmaps/show_spec.rb
|
609
|
+
- spec/commands/configmaps/update_spec.rb
|
601
610
|
- spec/commands/firewall_policies/update_spec.rb
|
602
611
|
- spec/commands/groups/add_server_spec.rb
|
603
612
|
- spec/commands/groups/create_spec.rb
|
@@ -649,6 +658,8 @@ files:
|
|
649
658
|
- spec/commands/servers/update_spec.rb
|
650
659
|
- spec/commands/sql/instances/create_spec.rb
|
651
660
|
- spec/commands/sql/instances/locking_spec.rb
|
661
|
+
- spec/commands/sql/instances/reset_spec.rb
|
662
|
+
- spec/commands/sql/instances/resize_spec.rb
|
652
663
|
- spec/commands/sql/instances/show_spec.rb
|
653
664
|
- spec/commands/sql/instances/snapshot_spec.rb
|
654
665
|
- spec/commands/sql/instances/update_spec.rb
|
@@ -806,9 +817,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
806
817
|
version: '2.5'
|
807
818
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
808
819
|
requirements:
|
809
|
-
- - "
|
820
|
+
- - ">"
|
810
821
|
- !ruby/object:Gem::Version
|
811
|
-
version:
|
822
|
+
version: 1.3.1
|
812
823
|
requirements: []
|
813
824
|
rubygems_version: 3.3.20
|
814
825
|
signing_key:
|
@@ -960,6 +971,11 @@ test_files:
|
|
960
971
|
- spec/commands/config/client_list_spec.rb
|
961
972
|
- spec/commands/config/client_remove_spec.rb
|
962
973
|
- spec/commands/config/user_add_spec.rb
|
974
|
+
- spec/commands/configmaps/create_spec.rb
|
975
|
+
- spec/commands/configmaps/destroy_spec.rb
|
976
|
+
- spec/commands/configmaps/list_spec.rb
|
977
|
+
- spec/commands/configmaps/show_spec.rb
|
978
|
+
- spec/commands/configmaps/update_spec.rb
|
963
979
|
- spec/commands/firewall_policies/update_spec.rb
|
964
980
|
- spec/commands/groups/add_server_spec.rb
|
965
981
|
- spec/commands/groups/create_spec.rb
|
@@ -1011,6 +1027,8 @@ test_files:
|
|
1011
1027
|
- spec/commands/servers/update_spec.rb
|
1012
1028
|
- spec/commands/sql/instances/create_spec.rb
|
1013
1029
|
- spec/commands/sql/instances/locking_spec.rb
|
1030
|
+
- spec/commands/sql/instances/reset_spec.rb
|
1031
|
+
- spec/commands/sql/instances/resize_spec.rb
|
1014
1032
|
- spec/commands/sql/instances/show_spec.rb
|
1015
1033
|
- spec/commands/sql/instances/snapshot_spec.rb
|
1016
1034
|
- spec/commands/sql/instances/update_spec.rb
|