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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/VERSION +1 -1
  4. data/bin/kontena +8 -28
  5. data/kontena-cli.gemspec +2 -2
  6. data/lib/kontena/cli/app_command.rb +14 -27
  7. data/lib/kontena/cli/certificate_command.rb +4 -7
  8. data/lib/kontena/cli/cloud/master_command.rb +5 -12
  9. data/lib/kontena/cli/cloud_command.rb +4 -7
  10. data/lib/kontena/cli/container_command.rb +4 -9
  11. data/lib/kontena/cli/etcd/health_command.rb +1 -0
  12. data/lib/kontena/cli/etcd_command.rb +6 -13
  13. data/lib/kontena/cli/external_registry_command.rb +3 -7
  14. data/lib/kontena/cli/grid_command.rb +14 -29
  15. data/lib/kontena/cli/grids/cloud_config_command.rb +1 -0
  16. data/lib/kontena/cli/grids/common.rb +2 -0
  17. data/lib/kontena/cli/grids/create_command.rb +5 -0
  18. data/lib/kontena/cli/grids/trusted_subnet_command.rb +6 -8
  19. data/lib/kontena/cli/grids/user_command.rb +3 -6
  20. data/lib/kontena/cli/master/config_command.rb +6 -12
  21. data/lib/kontena/cli/master/token_command.rb +6 -11
  22. data/lib/kontena/cli/master/users/role_command.rb +2 -4
  23. data/lib/kontena/cli/master/users_command.rb +4 -8
  24. data/lib/kontena/cli/master_command.rb +14 -33
  25. data/lib/kontena/cli/node_command.rb +7 -15
  26. data/lib/kontena/cli/nodes/health_command.rb +1 -1
  27. data/lib/kontena/cli/nodes/label_command.rb +3 -9
  28. data/lib/kontena/cli/nodes/show_command.rb +1 -1
  29. data/lib/kontena/cli/nodes/ssh_command.rb +13 -4
  30. data/lib/kontena/cli/plugin_command.rb +5 -9
  31. data/lib/kontena/cli/registry_command.rb +2 -5
  32. data/lib/kontena/cli/service_command.rb +22 -45
  33. data/lib/kontena/cli/services/container_command.rb +2 -3
  34. data/lib/kontena/cli/services/env_command.rb +3 -6
  35. data/lib/kontena/cli/services/secret_command.rb +2 -4
  36. data/lib/kontena/cli/stack_command.rb +11 -24
  37. data/lib/kontena/cli/stacks/registry_command.rb +5 -12
  38. data/lib/kontena/cli/stacks/upgrade_command.rb +6 -0
  39. data/lib/kontena/cli/stacks/yaml/reader.rb +17 -2
  40. data/lib/kontena/cli/subcommand_loader.rb +82 -0
  41. data/lib/kontena/cli/vault_command.rb +7 -15
  42. data/lib/kontena/cli/version.rb +6 -1
  43. data/lib/kontena/cli/vpn_command.rb +3 -7
  44. data/lib/kontena/command.rb +28 -1
  45. data/lib/kontena/machine/cloud_config/cloudinit.yml +1 -1
  46. data/lib/kontena/main_command.rb +22 -38
  47. data/lib/kontena/scripts/completer +2 -233
  48. data/lib/kontena/scripts/completer.rb +230 -0
  49. data/lib/kontena/scripts/init +5 -8
  50. data/lib/kontena/scripts/kontena.bash +8 -0
  51. data/lib/kontena/scripts/kontena.zsh +11 -0
  52. data/lib/kontena_cli.rb +9 -1
  53. data/omnibus/wrappers/sh/kontena +1 -1
  54. data/spec/fixtures/stack-with-liquid-optional.yml +14 -0
  55. data/spec/fixtures/stack-with-liquid-undefined.yml +12 -0
  56. data/spec/kontena/cli/app/build_command_spec.rb +1 -2
  57. data/spec/kontena/cli/app/common_spec.rb +1 -2
  58. data/spec/kontena/cli/app/config_command_spec.rb +0 -1
  59. data/spec/kontena/cli/app/deploy_command_spec.rb +2 -3
  60. data/spec/kontena/cli/app/docker_helper_spec.rb +0 -1
  61. data/spec/kontena/cli/app/init_command_spec.rb +0 -1
  62. data/spec/kontena/cli/app/logs_command_spec.rb +0 -1
  63. data/spec/kontena/cli/app/scale_spec.rb +2 -3
  64. data/spec/kontena/cli/app/service_generator_spec.rb +1 -2
  65. data/spec/kontena/cli/app/service_generator_v2_spec.rb +0 -1
  66. data/spec/kontena/cli/app/yaml/reader_spec.rb +0 -1
  67. data/spec/kontena/cli/app/yaml/service_extender_spec.rb +0 -1
  68. data/spec/kontena/cli/app/yaml/validator_spec.rb +0 -1
  69. data/spec/kontena/cli/app/yaml/validator_v2_spec.rb +0 -1
  70. data/spec/kontena/cli/cloud/login_command_spec.rb +0 -1
  71. data/spec/kontena/cli/cloud/logout_command_spec.rb +0 -1
  72. data/spec/kontena/cli/cloud/master/add_command_spec.rb +0 -1
  73. data/spec/kontena/cli/common_spec.rb +0 -1
  74. data/spec/kontena/cli/containers/list_command_spec.rb +0 -1
  75. data/spec/kontena/cli/containers/logs_command_spec.rb +0 -1
  76. data/spec/kontena/cli/etcd/health_command_spec.rb +2 -0
  77. data/spec/kontena/cli/grids/trusted_subnets/add_command_spec.rb +0 -11
  78. data/spec/kontena/cli/grids/trusted_subnets/list_command_spec.rb +4 -13
  79. data/spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb +0 -11
  80. data/spec/kontena/cli/grids/use_command_spec.rb +0 -1
  81. data/spec/kontena/cli/helpers/log_helper_spec.rb +0 -1
  82. data/spec/kontena/cli/main_command_spec.rb +2 -3
  83. data/spec/kontena/cli/master/current_command_spec.rb +5 -15
  84. data/spec/kontena/cli/master/init_cloud_command_spec.rb +0 -1
  85. data/spec/kontena/cli/master/login_command_spec.rb +0 -1
  86. data/spec/kontena/cli/master/logout_command_spec.rb +0 -1
  87. data/spec/kontena/cli/master/use_command_spec.rb +0 -1
  88. data/spec/kontena/cli/master/users/invite_command_spec.rb +1 -5
  89. data/spec/kontena/cli/master/users/remove_command_spec.rb +2 -14
  90. data/spec/kontena/cli/master/users/roles/add_command_spec.rb +0 -1
  91. data/spec/kontena/cli/master/users/roles/remove_command_spec.rb +0 -1
  92. data/spec/kontena/cli/nodes/list_command_spec.rb +2 -0
  93. data/spec/kontena/cli/services/containers_command_spec.rb +0 -18
  94. data/spec/kontena/cli/services/exec_command_spec.rb +6 -4
  95. data/spec/kontena/cli/services/link_command_spec.rb +5 -19
  96. data/spec/kontena/cli/services/restart_command_spec.rb +0 -16
  97. data/spec/kontena/cli/services/secrets/link_command_spec.rb +0 -11
  98. data/spec/kontena/cli/services/secrets/unlink_command_spec.rb +1 -12
  99. data/spec/kontena/cli/services/services_helper_spec.rb +0 -1
  100. data/spec/kontena/cli/services/unlink_command_spec.rb +7 -21
  101. data/spec/kontena/cli/services/update_command_spec.rb +0 -15
  102. data/spec/kontena/cli/stacks/build_command_spec.rb +0 -1
  103. data/spec/kontena/cli/stacks/deploy_command_spec.rb +10 -13
  104. data/spec/kontena/cli/stacks/install_command_spec.rb +0 -15
  105. data/spec/kontena/cli/stacks/list_command_spec.rb +4 -10
  106. data/spec/kontena/cli/stacks/remove_command_spec.rb +1 -16
  107. data/spec/kontena/cli/stacks/service_generator_spec.rb +0 -1
  108. data/spec/kontena/cli/stacks/service_generator_v2_spec.rb +0 -1
  109. data/spec/kontena/cli/stacks/show_command_spec.rb +1 -14
  110. data/spec/kontena/cli/stacks/upgrade_command_spec.rb +19 -1
  111. data/spec/kontena/cli/stacks/yaml/reader_spec.rb +163 -130
  112. data/spec/kontena/cli/stacks/yaml/service_extender_spec.rb +0 -1
  113. data/spec/kontena/cli/stacks/yaml/validator_v3_spec.rb +0 -1
  114. data/spec/kontena/cli/vault/export_spec.rb +0 -1
  115. data/spec/kontena/cli/vault/import_spec.rb +4 -5
  116. data/spec/kontena/cli/version_command_spec.rb +8 -6
  117. data/spec/kontena/cli/vpn/create_command_spec.rb +3 -4
  118. data/spec/kontena/client_spec.rb +0 -1
  119. data/spec/kontena/config_spec.rb +0 -1
  120. data/spec/kontena/kontena_cli_spec.rb +1 -1
  121. data/spec/kontena/main_command_spec.rb +0 -1
  122. data/spec/kontena/plugin_manager_spec.rb +0 -1
  123. data/spec/spec_helper.rb +1 -0
  124. data/spec/support/client_helpers.rb +1 -1
  125. data/spec/support/exit_with_error_helper.rb +36 -0
  126. data/spec/support/fixtures_helpers.rb +5 -2
  127. metadata +18 -7
@@ -0,0 +1,230 @@
1
+ require 'kontena/client'
2
+ require 'kontena/cli/common'
3
+ require 'yaml'
4
+
5
+ class Helper
6
+ include Kontena::Cli::Common
7
+
8
+ def client
9
+ token = require_token
10
+ super(token)
11
+ end
12
+
13
+ def grids
14
+ client.get("grids")['grids'].map{|grid| grid['id']}
15
+ rescue
16
+ []
17
+ end
18
+
19
+ def nodes
20
+ client.get("grids/#{current_grid}/nodes")['nodes'].map{|node| node['name']}
21
+ rescue
22
+ []
23
+ end
24
+
25
+ def stacks
26
+ stacks = client.get("grids/#{current_grid}/stacks")['stacks']
27
+ results = []
28
+ results.push stacks.map{|s| s['name']}
29
+ results.delete('null')
30
+ results
31
+ rescue
32
+ []
33
+ end
34
+
35
+ def services
36
+ services = client.get("grids/#{current_grid}/services")['services']
37
+ results = []
38
+ results.push services.map{ |s|
39
+ stack = s['stack']['id'].split('/').last
40
+ if stack != 'null'
41
+ "#{stack}/#{s['name']}"
42
+ else
43
+ s['name']
44
+ end
45
+ }
46
+ results
47
+ rescue
48
+ []
49
+ end
50
+
51
+ def containers
52
+ results = []
53
+ client.get("grids/#{current_grid}/services")['services'].each do |service|
54
+ containers = client.get("services/#{service['id']}/containers")['containers']
55
+ results.push(containers.map{|c| c['name'] })
56
+ results.push(containers.map{|c| c['id'] })
57
+ end
58
+ results
59
+ rescue
60
+ []
61
+ end
62
+
63
+ def yml_services
64
+ if File.exist?('kontena.yml')
65
+ yaml = YAML.safe_load(File.read('kontena.yml'))
66
+ services = yaml['services']
67
+ services.keys
68
+ end
69
+ rescue
70
+ []
71
+ end
72
+
73
+ def yml_files
74
+ Dir["./*.yml"].map{|file| file.sub('./', '')}
75
+ rescue
76
+ []
77
+ end
78
+
79
+ def master_names
80
+ config_file = File.expand_path('~/.kontena_client.json')
81
+ if(File.exist?(config_file))
82
+ config = JSON.parse(File.read(config_file))
83
+ return config['servers'].map{|s| s['name']}
84
+ end
85
+ rescue
86
+ []
87
+ end
88
+
89
+ end
90
+
91
+ helper = Helper.new
92
+
93
+ words = ARGV
94
+ words.delete_at(0)
95
+
96
+ completion = []
97
+ completion.push %w(cloud logout grid app service stack vault certificate node master vpn registry container etcd external-registry whoami plugin version) if words.size < 2
98
+ if words.size > 0
99
+ case words[0]
100
+ when 'plugin'
101
+ completion.clear
102
+ sub_commands = %w(list ls search install uninstall)
103
+ if words[1]
104
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
105
+ else
106
+ completion.push sub_commands
107
+ end
108
+ when 'etcd'
109
+ completion.clear
110
+ sub_commands = %w(get set mkdir mk list ls rm)
111
+ if words[1]
112
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
113
+ else
114
+ completion.push sub_commands
115
+ end
116
+ when 'registry'
117
+ completion.clear
118
+ sub_commands = %w(create remove rm)
119
+ if words[1]
120
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
121
+ else
122
+ completion.push sub_commands
123
+ end
124
+ when 'grid'
125
+ completion.clear
126
+ sub_commands = %w(add-user audit-log create current list user remove show use)
127
+ if words[1]
128
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
129
+ completion.push helper.grids
130
+ else
131
+ completion.push sub_commands
132
+ end
133
+ when 'node'
134
+ completion.clear
135
+ sub_commands = %w(list show remove)
136
+ if words[1]
137
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
138
+ completion.push helper.nodes
139
+ else
140
+ completion.push sub_commands
141
+ end
142
+ when 'master'
143
+ completion.clear
144
+ sub_commands = %w(list use users current remove rm config cfg login logout token join audit-log init-cloud)
145
+ if words[1] && words[1] == 'use'
146
+ completion.push helper.master_names
147
+ elsif words[1] && words[1] == 'users'
148
+ users_sub_commands = %(invite list role)
149
+ completion.push users_sub_commands
150
+ elsif words[1] && ['config', 'cfg'].include?(words[1])
151
+ config_sub_commands = %(set get dump load import export unset)
152
+ completion.push config_sub_commands
153
+ elsif words[1] && words[1] == 'token'
154
+ token_sub_commands = %(list ls rm remove show current create)
155
+ completion.push token_sub_commands
156
+ elsif words[1]
157
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
158
+ else
159
+ completion.push sub_commands
160
+ end
161
+ when 'cloud'
162
+ completion.clear
163
+ sub_commands = %w(login logout master)
164
+ if words[1] && words[1] == 'master'
165
+ cloud_master_sub_commands = %(list ls remove rm add show update)
166
+ completion.push cloud_master_sub_commands
167
+ elsif words[1]
168
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
169
+ else
170
+ completion.push sub_commands
171
+ end
172
+ when 'service'
173
+ completion.clear
174
+ sub_commands = %w(containers create delete deploy list logs restart
175
+ scale show start stats stop update monitor env
176
+ secret link unlink)
177
+ if words[1]
178
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
179
+ completion.push helper.services
180
+ else
181
+ completion.push sub_commands
182
+ end
183
+ when 'container'
184
+ completion.clear
185
+ sub_commands = %w(exec inspect logs)
186
+ if words[1]
187
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
188
+ completion.push helper.containers
189
+ else
190
+ completion.push sub_commands
191
+ end
192
+ when 'vpn'
193
+ completion.clear
194
+ completion.push %w(config create delete)
195
+ when 'external-registry'
196
+ completion.clear
197
+ completion.push %w(add list delete)
198
+ when 'app'
199
+ completion.clear
200
+ sub_commands = %w(init build config deploy start stop remove rm ps list
201
+ logs monitor show)
202
+ if words[1]
203
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
204
+ completion.push helper.yml_services
205
+ else
206
+ completion.push sub_commands
207
+ end
208
+ when 'stack'
209
+ completion.clear
210
+ sub_commands = %w(build install upgrade deploy start stop remove rm ls list
211
+ logs monitor show registry)
212
+ if words[1]
213
+ if words[1] == 'registry'
214
+ registry_sub_commands = %(push pull search show rm)
215
+ completion.push registry_sub_commands
216
+ elsif %w(install).include?(words[1])
217
+ completion.push helper.yml_files
218
+ elsif words[1] == 'upgrade' && words[3]
219
+ completion.push helper.yml_files
220
+ else
221
+ completion.push(sub_commands) unless sub_commands.include?(words[1])
222
+ completion.push helper.stacks
223
+ end
224
+ else
225
+ completion.push sub_commands
226
+ end
227
+ end
228
+ end
229
+
230
+ puts completion
@@ -1,15 +1,12 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ # This file exists mostly for backwards dependency to
4
+ # allow the old "which kontena && . foofoo/init"
5
+ # completion loading
3
6
  _kontena_complete() {
4
7
  COMPREPLY=()
5
- if [ "$ZSH_VERSION" == "" ]; then
6
- local src="${BASH_SOURCE[0]}"
7
- else
8
- local src="${(%):-%x}"
9
- fi
10
- DIR=$( cd "$( dirname "$src" )" && pwd )
11
8
  local word="${COMP_WORDS[COMP_CWORD]}"
12
- local completions="$(${DIR}/completer ${COMP_WORDS[*]})"
9
+ local completions="$(kontena complete ${COMP_WORDS[*]})"
13
10
  COMPREPLY=( $(compgen -W "$completions" -- "$word") )
14
11
  }
15
12
 
@@ -18,4 +15,4 @@ if [ "$ZSH_VERSION" != "" ]; then
18
15
  autoload -U +X bashcompinit && bashcompinit
19
16
  fi
20
17
 
21
- complete -F _kontena_complete kontena
18
+ which kontena > /dev/null && complete -F _kontena_complete kontena
@@ -0,0 +1,8 @@
1
+ _kontena_complete() {
2
+ COMPREPLY=()
3
+ local word="${COMP_WORDS[COMP_CWORD]}"
4
+ local completions="$(kontena complete ${COMP_WORDS[*]})"
5
+ COMPREPLY=( $(compgen -W "$completions" -- "$word") )
6
+ }
7
+
8
+ which kontena > /dev/null && complete -F _kontena_complete kontena
@@ -0,0 +1,11 @@
1
+ #compdef kontena
2
+ #autoload
3
+
4
+ _kontena() {
5
+ local -a compreply
6
+ compreply=($(kontena complete ${words[*]}))
7
+ _describe -t kontena 'kontena' compreply
8
+ return 0
9
+ }
10
+
11
+ _kontena
data/lib/kontena_cli.rb CHANGED
@@ -41,7 +41,7 @@ module Kontena
41
41
  end
42
42
 
43
43
  def self.simple_terminal?
44
- on_windows? || ENV['KONTENA_SIMPLE_TERM'] || !$stdout.tty?
44
+ ENV['KONTENA_SIMPLE_TERM'] || !$stdout.tty?
45
45
  end
46
46
 
47
47
  def self.pastel
@@ -74,6 +74,14 @@ module Kontena
74
74
  def self.root
75
75
  File.dirname(__dir__)
76
76
  end
77
+
78
+ def self.cli_root(*joinables)
79
+ if joinables.empty?
80
+ File.join(Kontena.root, 'lib/kontena/cli')
81
+ else
82
+ File.join(Kontena.root, 'lib/kontena/cli', *joinables)
83
+ end
84
+ end
77
85
  end
78
86
 
79
87
  # Monkeypatching string to mimick 'colorize' gem
@@ -4,4 +4,4 @@ export PATH=/opt/kontena/embedded/bin:$PATH
4
4
  export GEM_HOME=/opt/kontena/embedded/lib/ruby/gems/2.1.0
5
5
  export GEM_PATH=$GEM_HOME
6
6
 
7
- exec /opt/kontena/embedded/bin/kontena "$@"
7
+ exec /opt/kontena/embedded/bin/kontena $@
@@ -0,0 +1,14 @@
1
+ stack: user/stackname
2
+ version: 0.1.1
3
+ variables:
4
+ asdf:
5
+ type: string
6
+ required: false
7
+
8
+ services:
9
+ test:
10
+ image: foo
11
+ environment:
12
+ # {% if asdf %}
13
+ - ASDF={{asdf}}
14
+ # {% endif %}
@@ -0,0 +1,12 @@
1
+ stack: user/stackname
2
+ version: 0.1.1
3
+ variables:
4
+ asdf:
5
+ type: string
6
+ default: asdfasdf
7
+
8
+ services:
9
+ test:
10
+ image: foo
11
+ environment:
12
+ - ASDF={{asdflol}}
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require "kontena/cli/apps/build_command"
3
2
 
4
3
  describe Kontena::Cli::Apps::BuildCommand do
@@ -62,7 +61,7 @@ describe Kontena::Cli::Apps::BuildCommand do
62
61
  expect(subject).not_to receive(:process_docker_images)
63
62
  expect {
64
63
  subject.run([])
65
- }.to raise_error SystemExit
64
+ }.to exit_with_error
66
65
  end
67
66
  end
68
67
  end
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require "kontena/cli/apps/common"
3
2
 
4
3
  describe Kontena::Cli::Apps::Common do
@@ -86,7 +85,7 @@ describe Kontena::Cli::Apps::Common do
86
85
  it 'aborts on validation failure' do
87
86
  allow_any_instance_of(Kontena::Cli::Apps::YAML::Validator).to receive(:validate)
88
87
  .and_return({ :errors => [{ 'wordress' => [] }], :notifications => [] })
89
- expect { subject.services_from_yaml('kontena.yml',[],'') }.to raise_error(SystemExit)
88
+ expect { subject.services_from_yaml('kontena.yml',[],'') }.to exit_with_error
90
89
  end
91
90
 
92
91
  it 'returns given service from given YAML file' do
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require "kontena/cli/apps/config_command"
3
2
  require 'ruby_dig'
4
3
 
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require 'kontena/cli/grid_options'
3
2
  require "kontena/cli/apps/deploy_command"
4
3
 
@@ -59,7 +58,7 @@ describe Kontena::Cli::Apps::DeployCommand do
59
58
  allow(subject.config).to receive(:current_master).and_return(
60
59
  Kontena::Cli::Config::Server.new
61
60
  )
62
- expect{subject.run([])}.to raise_error(ArgumentError)
61
+ expect{subject.run([])}.to exit_with_error
63
62
  end
64
63
  end
65
64
 
@@ -68,7 +67,7 @@ describe Kontena::Cli::Apps::DeployCommand do
68
67
  allow(subject.config).to receive(:current_master).and_return(
69
68
  Kontena::Cli::Config::Server.new(url: 'http://foo.com')
70
69
  )
71
- expect{subject.run([])}.to raise_error(ArgumentError)
70
+ expect{subject.run([])}.to exit_with_error
72
71
  end
73
72
  end
74
73
 
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require "kontena/cli/apps/docker_helper"
3
2
 
4
3
  describe Kontena::Cli::Apps::DockerHelper do
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require 'kontena/cli/apps/init_command'
3
2
 
4
3
  describe Kontena::Cli::Apps::InitCommand do
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require 'kontena/cli/grid_options'
3
2
  require "kontena/cli/apps/logs_command"
4
3
 
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require "kontena/cli/apps/scale_command"
3
2
 
4
3
  describe Kontena::Cli::Apps::ScaleCommand do
@@ -28,7 +27,7 @@ describe Kontena::Cli::Apps::ScaleCommand do
28
27
  it 'aborts execution' do
29
28
  expect{
30
29
  subject.run(['wordpress', 3])
31
- }.to raise_error(SystemExit)
30
+ }.to exit_with_error
32
31
  end
33
32
  end
34
33
 
@@ -36,7 +35,7 @@ describe Kontena::Cli::Apps::ScaleCommand do
36
35
  it 'aborts execution' do
37
36
  expect{
38
37
  subject.run(['mysql', 3])
39
- }.to raise_error(SystemExit)
38
+ }.to exit_with_error
40
39
  end
41
40
  end
42
41
 
@@ -1,4 +1,3 @@
1
- require_relative "../../../spec_helper"
2
1
  require "kontena/cli/apps/service_generator"
3
2
 
4
3
  describe Kontena::Cli::Apps::ServiceGenerator do
@@ -381,5 +380,5 @@ describe Kontena::Cli::Apps::ServiceGenerator do
381
380
  expect(result['secrets']).to be_nil
382
381
  end
383
382
  end
384
- end
383
+ end
385
384
  end