kontena-cli 1.1.6 → 1.2.0.dev1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/VERSION +1 -1
- data/bin/kontena +8 -28
- data/kontena-cli.gemspec +2 -2
- data/lib/kontena/cli/app_command.rb +14 -27
- data/lib/kontena/cli/certificate_command.rb +4 -7
- data/lib/kontena/cli/cloud/master_command.rb +5 -12
- data/lib/kontena/cli/cloud_command.rb +4 -7
- data/lib/kontena/cli/container_command.rb +4 -9
- data/lib/kontena/cli/etcd/health_command.rb +1 -0
- data/lib/kontena/cli/etcd_command.rb +6 -13
- data/lib/kontena/cli/external_registry_command.rb +3 -7
- data/lib/kontena/cli/grid_command.rb +14 -29
- data/lib/kontena/cli/grids/cloud_config_command.rb +1 -0
- data/lib/kontena/cli/grids/common.rb +2 -0
- data/lib/kontena/cli/grids/create_command.rb +5 -0
- data/lib/kontena/cli/grids/trusted_subnet_command.rb +6 -8
- data/lib/kontena/cli/grids/user_command.rb +3 -6
- data/lib/kontena/cli/master/config_command.rb +6 -12
- data/lib/kontena/cli/master/token_command.rb +6 -11
- data/lib/kontena/cli/master/users/role_command.rb +2 -4
- data/lib/kontena/cli/master/users_command.rb +4 -8
- data/lib/kontena/cli/master_command.rb +14 -33
- data/lib/kontena/cli/node_command.rb +7 -15
- data/lib/kontena/cli/nodes/health_command.rb +1 -1
- data/lib/kontena/cli/nodes/label_command.rb +3 -9
- data/lib/kontena/cli/nodes/show_command.rb +1 -1
- data/lib/kontena/cli/nodes/ssh_command.rb +13 -4
- data/lib/kontena/cli/plugin_command.rb +5 -9
- data/lib/kontena/cli/registry_command.rb +2 -5
- data/lib/kontena/cli/service_command.rb +22 -45
- data/lib/kontena/cli/services/container_command.rb +2 -3
- data/lib/kontena/cli/services/env_command.rb +3 -6
- data/lib/kontena/cli/services/secret_command.rb +2 -4
- data/lib/kontena/cli/stack_command.rb +11 -24
- data/lib/kontena/cli/stacks/registry_command.rb +5 -12
- data/lib/kontena/cli/stacks/upgrade_command.rb +6 -0
- data/lib/kontena/cli/stacks/yaml/reader.rb +17 -2
- data/lib/kontena/cli/subcommand_loader.rb +82 -0
- data/lib/kontena/cli/vault_command.rb +7 -15
- data/lib/kontena/cli/version.rb +6 -1
- data/lib/kontena/cli/vpn_command.rb +3 -7
- data/lib/kontena/command.rb +28 -1
- data/lib/kontena/machine/cloud_config/cloudinit.yml +1 -1
- data/lib/kontena/main_command.rb +22 -38
- data/lib/kontena/scripts/completer +2 -233
- data/lib/kontena/scripts/completer.rb +230 -0
- data/lib/kontena/scripts/init +5 -8
- data/lib/kontena/scripts/kontena.bash +8 -0
- data/lib/kontena/scripts/kontena.zsh +11 -0
- data/lib/kontena_cli.rb +9 -1
- data/omnibus/wrappers/sh/kontena +1 -1
- data/spec/fixtures/stack-with-liquid-optional.yml +14 -0
- data/spec/fixtures/stack-with-liquid-undefined.yml +12 -0
- data/spec/kontena/cli/app/build_command_spec.rb +1 -2
- data/spec/kontena/cli/app/common_spec.rb +1 -2
- data/spec/kontena/cli/app/config_command_spec.rb +0 -1
- data/spec/kontena/cli/app/deploy_command_spec.rb +2 -3
- data/spec/kontena/cli/app/docker_helper_spec.rb +0 -1
- data/spec/kontena/cli/app/init_command_spec.rb +0 -1
- data/spec/kontena/cli/app/logs_command_spec.rb +0 -1
- data/spec/kontena/cli/app/scale_spec.rb +2 -3
- data/spec/kontena/cli/app/service_generator_spec.rb +1 -2
- data/spec/kontena/cli/app/service_generator_v2_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/reader_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/service_extender_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/validator_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/validator_v2_spec.rb +0 -1
- data/spec/kontena/cli/cloud/login_command_spec.rb +0 -1
- data/spec/kontena/cli/cloud/logout_command_spec.rb +0 -1
- data/spec/kontena/cli/cloud/master/add_command_spec.rb +0 -1
- data/spec/kontena/cli/common_spec.rb +0 -1
- data/spec/kontena/cli/containers/list_command_spec.rb +0 -1
- data/spec/kontena/cli/containers/logs_command_spec.rb +0 -1
- data/spec/kontena/cli/etcd/health_command_spec.rb +2 -0
- data/spec/kontena/cli/grids/trusted_subnets/add_command_spec.rb +0 -11
- data/spec/kontena/cli/grids/trusted_subnets/list_command_spec.rb +4 -13
- data/spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb +0 -11
- data/spec/kontena/cli/grids/use_command_spec.rb +0 -1
- data/spec/kontena/cli/helpers/log_helper_spec.rb +0 -1
- data/spec/kontena/cli/main_command_spec.rb +2 -3
- data/spec/kontena/cli/master/current_command_spec.rb +5 -15
- data/spec/kontena/cli/master/init_cloud_command_spec.rb +0 -1
- data/spec/kontena/cli/master/login_command_spec.rb +0 -1
- data/spec/kontena/cli/master/logout_command_spec.rb +0 -1
- data/spec/kontena/cli/master/use_command_spec.rb +0 -1
- data/spec/kontena/cli/master/users/invite_command_spec.rb +1 -5
- data/spec/kontena/cli/master/users/remove_command_spec.rb +2 -14
- data/spec/kontena/cli/master/users/roles/add_command_spec.rb +0 -1
- data/spec/kontena/cli/master/users/roles/remove_command_spec.rb +0 -1
- data/spec/kontena/cli/nodes/list_command_spec.rb +2 -0
- data/spec/kontena/cli/services/containers_command_spec.rb +0 -18
- data/spec/kontena/cli/services/exec_command_spec.rb +6 -4
- data/spec/kontena/cli/services/link_command_spec.rb +5 -19
- data/spec/kontena/cli/services/restart_command_spec.rb +0 -16
- data/spec/kontena/cli/services/secrets/link_command_spec.rb +0 -11
- data/spec/kontena/cli/services/secrets/unlink_command_spec.rb +1 -12
- data/spec/kontena/cli/services/services_helper_spec.rb +0 -1
- data/spec/kontena/cli/services/unlink_command_spec.rb +7 -21
- data/spec/kontena/cli/services/update_command_spec.rb +0 -15
- data/spec/kontena/cli/stacks/build_command_spec.rb +0 -1
- data/spec/kontena/cli/stacks/deploy_command_spec.rb +10 -13
- data/spec/kontena/cli/stacks/install_command_spec.rb +0 -15
- data/spec/kontena/cli/stacks/list_command_spec.rb +4 -10
- data/spec/kontena/cli/stacks/remove_command_spec.rb +1 -16
- data/spec/kontena/cli/stacks/service_generator_spec.rb +0 -1
- data/spec/kontena/cli/stacks/service_generator_v2_spec.rb +0 -1
- data/spec/kontena/cli/stacks/show_command_spec.rb +1 -14
- data/spec/kontena/cli/stacks/upgrade_command_spec.rb +19 -1
- data/spec/kontena/cli/stacks/yaml/reader_spec.rb +163 -130
- data/spec/kontena/cli/stacks/yaml/service_extender_spec.rb +0 -1
- data/spec/kontena/cli/stacks/yaml/validator_v3_spec.rb +0 -1
- data/spec/kontena/cli/vault/export_spec.rb +0 -1
- data/spec/kontena/cli/vault/import_spec.rb +4 -5
- data/spec/kontena/cli/version_command_spec.rb +8 -6
- data/spec/kontena/cli/vpn/create_command_spec.rb +3 -4
- data/spec/kontena/client_spec.rb +0 -1
- data/spec/kontena/config_spec.rb +0 -1
- data/spec/kontena/kontena_cli_spec.rb +1 -1
- data/spec/kontena/main_command_spec.rb +0 -1
- data/spec/kontena/plugin_manager_spec.rb +0 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/client_helpers.rb +1 -1
- data/spec/support/exit_with_error_helper.rb +36 -0
- data/spec/support/fixtures_helpers.rb +5 -2
- metadata +18 -7
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../../spec_helper"
|
2
1
|
require "kontena/cli/grids/trusted_subnet_command"
|
3
2
|
require "kontena/cli/grids/trusted_subnets/add_command"
|
4
3
|
|
@@ -7,16 +6,6 @@ describe Kontena::Cli::Grids::TrustedSubnets::AddCommand do
|
|
7
6
|
include ClientHelpers
|
8
7
|
|
9
8
|
describe '#execute' do
|
10
|
-
it 'requires api url' do
|
11
|
-
expect(subject).to receive(:require_api_url).once
|
12
|
-
subject.run(['grid', 'subnet'])
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'requires token' do
|
16
|
-
expect(subject).to receive(:require_token).and_return(token)
|
17
|
-
subject.run(['grid', 'subnet'])
|
18
|
-
end
|
19
|
-
|
20
9
|
it 'requires grid as param' do
|
21
10
|
expect {
|
22
11
|
subject.run([])
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../../spec_helper"
|
2
1
|
require "kontena/cli/grids/trusted_subnet_command"
|
3
2
|
require "kontena/cli/grids/trusted_subnets/list_command"
|
4
3
|
|
@@ -7,16 +6,6 @@ describe Kontena::Cli::Grids::TrustedSubnets::ListCommand do
|
|
7
6
|
include ClientHelpers
|
8
7
|
|
9
8
|
describe '#execute' do
|
10
|
-
it 'requires api url' do
|
11
|
-
expect(subject).to receive(:require_api_url).once
|
12
|
-
subject.run(['grid'])
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'requires token' do
|
16
|
-
expect(subject).to receive(:require_token).and_return(token)
|
17
|
-
subject.run(['grid'])
|
18
|
-
end
|
19
|
-
|
20
9
|
it 'requires grid as param' do
|
21
10
|
expect {
|
22
11
|
subject.run([])
|
@@ -24,8 +13,10 @@ describe Kontena::Cli::Grids::TrustedSubnets::ListCommand do
|
|
24
13
|
end
|
25
14
|
|
26
15
|
it 'requests grid details from master' do
|
27
|
-
expect(client).to receive(:get).with("grids/test-grid")
|
28
|
-
|
16
|
+
expect(client).to receive(:get).with("grids/test-grid").and_return('trusted_subnets' => [
|
17
|
+
'192.168.0.1/24',
|
18
|
+
])
|
19
|
+
expect{subject.run(['test-grid'])}.to output("192.168.0.1/24\n").to_stdout
|
29
20
|
end
|
30
21
|
end
|
31
22
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../../spec_helper"
|
2
1
|
require "kontena/cli/grids/trusted_subnet_command"
|
3
2
|
require "kontena/cli/grids/trusted_subnets/remove_command"
|
4
3
|
|
@@ -7,16 +6,6 @@ describe Kontena::Cli::Grids::TrustedSubnets::RemoveCommand do
|
|
7
6
|
include ClientHelpers
|
8
7
|
|
9
8
|
describe '#execute' do
|
10
|
-
it 'requires api url' do
|
11
|
-
expect(subject).to receive(:require_api_url).once
|
12
|
-
subject.run(['--force', 'grid', 'subnet'])
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'requires token' do
|
16
|
-
expect(subject).to receive(:require_token).and_return(token)
|
17
|
-
subject.run(['--force', 'grid', 'subnet'])
|
18
|
-
end
|
19
|
-
|
20
9
|
it 'requires grid as param' do
|
21
10
|
expect {
|
22
11
|
subject.run([])
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../spec_helper"
|
2
1
|
require "kontena/main_command"
|
3
2
|
|
4
3
|
describe Kontena::MainCommand do
|
@@ -7,8 +6,8 @@ describe Kontena::MainCommand do
|
|
7
6
|
describe '#subcommand_missing' do
|
8
7
|
it 'suggests plugin install for known plugin commands' do
|
9
8
|
expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(true)
|
10
|
-
expect(subject).to receive(:exit_with_error).with(/plugin has not been installed/).
|
11
|
-
expect{subject.run(['testplugin', 'master', 'create'])}.to
|
9
|
+
expect(subject).to receive(:exit_with_error).with(/plugin has not been installed/).and_call_original
|
10
|
+
expect{subject.run(['testplugin', 'master', 'create'])}.to exit_with_error
|
12
11
|
end
|
13
12
|
|
14
13
|
it 'runs normal error handling for unknown sub commands' do
|
@@ -1,36 +1,26 @@
|
|
1
|
-
require_relative "../../../spec_helper"
|
2
1
|
require 'kontena/cli/master/current_command'
|
3
2
|
|
4
3
|
describe Kontena::Cli::Master::CurrentCommand do
|
5
4
|
include ClientHelpers
|
6
|
-
|
5
|
+
|
7
6
|
let(:subject) { described_class.new(File.basename($0)) }
|
8
7
|
|
9
8
|
describe '#execute' do
|
10
9
|
it 'puts master name and URL' do
|
11
|
-
expect
|
12
|
-
subject.run([])
|
13
|
-
}.to output(/alias.*someurl/).to_stdout
|
10
|
+
expect{subject.run([])}.to output(/alias.*someurl/).to_stdout
|
14
11
|
end
|
15
12
|
|
16
13
|
it 'only outputs name if name-flag is set' do
|
17
|
-
expect
|
18
|
-
subject.run(['--name'])
|
19
|
-
}.to output("alias\n").to_stdout
|
14
|
+
expect{subject.run(['--name'])}.to output("alias\n").to_stdout
|
20
15
|
end
|
21
16
|
|
22
17
|
it 'does not raise error when logged in' do
|
23
|
-
expect
|
24
|
-
subject.run([])
|
25
|
-
}.to_not raise_error
|
18
|
+
expect{subject.run([])}.not_to exit_with_error
|
26
19
|
end
|
27
20
|
|
28
21
|
it 'raises error when not logged in' do
|
29
22
|
expect(subject.config).to receive(:current_master).and_return(nil)
|
30
|
-
|
31
|
-
expect {
|
32
|
-
subject.run([])
|
33
|
-
}.to raise_error(ArgumentError)
|
23
|
+
expect{subject.run([])}.to exit_with_error
|
34
24
|
end
|
35
25
|
end
|
36
26
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../../spec_helper"
|
2
1
|
require 'kontena/cli/master/users_command'
|
3
2
|
require 'kontena/cli/master/users/invite_command'
|
4
3
|
|
@@ -6,13 +5,10 @@ describe Kontena::Cli::Master::Users::InviteCommand do
|
|
6
5
|
|
7
6
|
include ClientHelpers
|
8
7
|
|
9
|
-
let(:subject) do
|
10
|
-
described_class.new(File.basename($0))
|
11
|
-
end
|
12
|
-
|
13
8
|
describe "#invite" do
|
14
9
|
it 'makes invitation request for all given users' do
|
15
10
|
expect(client).to receive(:post).with("/oauth2/authorize", {email: 'john@example.org', external_id: nil, response_type: "invite"}).once
|
11
|
+
expect(client).to receive(:post).with("/oauth2/authorize", {email: 'jane@example.org', external_id: nil, response_type: "invite"}).once
|
16
12
|
|
17
13
|
subject.run(['john@example.org', 'jane@example.org'])
|
18
14
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../../spec_helper"
|
2
1
|
require 'kontena/cli/master/users_command'
|
3
2
|
require "kontena/cli/master/users/remove_command"
|
4
3
|
|
@@ -12,25 +11,14 @@ describe Kontena::Cli::Master::Users::RemoveCommand do
|
|
12
11
|
allow(subject).to receive(:confirm).and_return(true)
|
13
12
|
end
|
14
13
|
|
15
|
-
it 'requires api url' do
|
16
|
-
expect(subject).to receive(:require_api_url).once
|
17
|
-
subject.run(['john@domain.com'])
|
18
|
-
end
|
19
|
-
|
20
14
|
it 'it requires confirmation' do
|
21
15
|
expect(subject).to receive(:confirm).once
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'requires token' do
|
26
|
-
expect(subject).to receive(:require_token).and_return(token)
|
16
|
+
expect(client).to receive(:delete).with('users/john@domain.com')
|
27
17
|
subject.run(['john@domain.com'])
|
28
18
|
end
|
29
19
|
|
30
20
|
it 'sends email to master' do
|
31
|
-
expect(client).to receive(:delete).with(
|
32
|
-
'users/john@domain.com'
|
33
|
-
)
|
21
|
+
expect(client).to receive(:delete).with('users/john@domain.com')
|
34
22
|
subject.run(['john@domain.com'])
|
35
23
|
end
|
36
24
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../spec_helper"
|
2
1
|
require "kontena/cli/services/containers_command"
|
3
2
|
|
4
3
|
describe Kontena::Cli::Services::ContainersCommand do
|
@@ -6,23 +5,6 @@ describe Kontena::Cli::Services::ContainersCommand do
|
|
6
5
|
include ClientHelpers
|
7
6
|
|
8
7
|
describe '#execute' do
|
9
|
-
|
10
|
-
before(:each) do
|
11
|
-
allow(client).to receive(:get).and_return({
|
12
|
-
'containers' => []
|
13
|
-
})
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'requires api url' do
|
17
|
-
expect(subject).to receive(:require_api_url).once
|
18
|
-
subject.run(['service-a'])
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'requires token' do
|
22
|
-
expect(subject).to receive(:require_token).and_return(token)
|
23
|
-
subject.run(['service-a'])
|
24
|
-
end
|
25
|
-
|
26
8
|
it 'to not throw on missing "overlay_cidr" property' do
|
27
9
|
allow(client).to receive(:get).and_return({
|
28
10
|
'containers' => [
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'kontena/cli/services/exec_command'
|
2
|
+
|
1
3
|
describe Kontena::Cli::Services::ExecCommand do
|
2
4
|
include ClientHelpers
|
3
5
|
include OutputHelpers
|
@@ -98,7 +100,7 @@ describe Kontena::Cli::Services::ExecCommand do
|
|
98
100
|
it "Errors on a nonexistant container if given" do
|
99
101
|
expect(client).to receive(:get).with('services/test-grid/null/test-service/containers').and_return(service_containers)
|
100
102
|
|
101
|
-
expect{subject.run(['--instance=4', 'test-service', 'test'])}.to output(/Service test-service does not have container instance 4/).to_stderr
|
103
|
+
expect{subject.run(['--instance=4', 'test-service', 'test'])}.to exit_with_error.and output(/Service test-service does not have container instance 4/).to_stderr
|
102
104
|
end
|
103
105
|
|
104
106
|
it "Executes on each running container" do
|
@@ -114,7 +116,7 @@ describe Kontena::Cli::Services::ExecCommand do
|
|
114
116
|
expect(client).to receive(:get).with('services/test-grid/null/test-service/containers').and_return(service_containers)
|
115
117
|
expect(client).to receive(:post).with('containers/test-grid/host/test-service.container-1/exec', { cmd: ['test'] }).and_return(exec_fail)
|
116
118
|
|
117
|
-
expect{subject.run(['--silent', '--all', 'test-service', 'test'])}.to output("error\n").to_stderr
|
119
|
+
expect{subject.run(['--silent', '--all', 'test-service', 'test'])}.to exit_with_error.and output("error\n").to_stderr
|
118
120
|
end
|
119
121
|
|
120
122
|
it "Stops if the second container fails" do
|
@@ -122,7 +124,7 @@ describe Kontena::Cli::Services::ExecCommand do
|
|
122
124
|
expect(client).to receive(:post).with('containers/test-grid/host/test-service.container-1/exec', { cmd: ['test'] }).and_return(exec_ok)
|
123
125
|
expect(client).to receive(:post).with('containers/test-grid/host/test-service.container-2/exec', { cmd: ['test'] }).and_return(exec_fail)
|
124
126
|
|
125
|
-
expect{subject.run(['--silent', '--all', 'test-service', 'test'])}.to output("ok\n").to_stdout.and output("error\n").to_stderr
|
127
|
+
expect{subject.run(['--silent', '--all', 'test-service', 'test'])}.to exit_with_error.and output("ok\n").to_stdout.and output("error\n").to_stderr
|
126
128
|
end
|
127
129
|
|
128
130
|
it "Keeps going if the second container fails when using --skip" do
|
@@ -131,7 +133,7 @@ describe Kontena::Cli::Services::ExecCommand do
|
|
131
133
|
expect(client).to receive(:post).with('containers/test-grid/host/test-service.container-2/exec', { cmd: ['test'] }).and_return(exec_fail)
|
132
134
|
expect(client).to receive(:post).with('containers/test-grid/host/test-service.container-3/exec', { cmd: ['test'] }).and_return(exec_ok)
|
133
135
|
|
134
|
-
expect{subject.run(['--silent', '--all', '--skip', 'test-service', 'test'])}.to output("ok\nok\n").to_stdout.and output("error\n").to_stderr
|
136
|
+
expect{subject.run(['--silent', '--all', '--skip', 'test-service', 'test'])}.to exit_with_error.and output("ok\nok\n").to_stdout.and output("error\n").to_stderr
|
135
137
|
end
|
136
138
|
end
|
137
139
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../spec_helper"
|
2
1
|
require "kontena/cli/services/link_command"
|
3
2
|
|
4
3
|
describe Kontena::Cli::Services::LinkCommand do
|
@@ -6,34 +5,21 @@ describe Kontena::Cli::Services::LinkCommand do
|
|
6
5
|
include ClientHelpers
|
7
6
|
|
8
7
|
describe '#execute' do
|
9
|
-
before(:each) do
|
10
|
-
allow(client).to receive(:get).and_return({
|
11
|
-
'links' => []
|
12
|
-
})
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'requires api url' do
|
16
|
-
expect(subject).to receive(:require_api_url).once
|
17
|
-
subject.run(['service-a', 'service-b'])
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'requires token' do
|
21
|
-
expect(subject).to receive(:require_token).and_return(token)
|
22
|
-
subject.run(['service-a', 'service-b'])
|
23
|
-
end
|
24
|
-
|
25
8
|
it 'aborts if service is already linked' do
|
26
|
-
|
9
|
+
expect(client).to receive(:get).with('services/test-grid/null/service-a').and_return({
|
27
10
|
'links' => [
|
28
11
|
{'alias' => 'service-b', 'id' => "grid/null/service-b"}
|
29
12
|
]
|
30
13
|
})
|
31
14
|
expect {
|
32
15
|
subject.run(['service-a', 'service-b'])
|
33
|
-
}.to
|
16
|
+
}.to exit_with_error
|
34
17
|
end
|
35
18
|
|
36
19
|
it 'sends link to master' do
|
20
|
+
expect(client).to receive(:get).with('services/test-grid/null/service-a').and_return({
|
21
|
+
'links' => []
|
22
|
+
})
|
37
23
|
expect(client).to receive(:put).with(
|
38
24
|
'services/test-grid/null/service-a', {links: [{name: 'null/service-b', alias: 'service-b'}]}
|
39
25
|
)
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../spec_helper"
|
2
1
|
require "kontena/cli/services/restart_command"
|
3
2
|
|
4
3
|
describe Kontena::Cli::Services::RestartCommand do
|
@@ -6,21 +5,6 @@ describe Kontena::Cli::Services::RestartCommand do
|
|
6
5
|
include ClientHelpers
|
7
6
|
|
8
7
|
describe '#execute' do
|
9
|
-
|
10
|
-
before(:each) do
|
11
|
-
allow(subject).to receive(:restart_service).and_return({})
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'requires api url' do
|
15
|
-
expect(subject).to receive(:require_api_url).once
|
16
|
-
subject.run(['service'])
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'requires token' do
|
20
|
-
expect(subject).to receive(:require_token).once
|
21
|
-
subject.run(['service'])
|
22
|
-
end
|
23
|
-
|
24
8
|
it 'triggers restart command' do
|
25
9
|
expect(subject).to receive(:restart_service)
|
26
10
|
subject.run(['service'])
|