spec/kontena/cli/services/update_command_spec.rb in kontena-cli-1.1.1 vs spec/kontena/cli/services/update_command_spec.rb in kontena-cli-1.1.2.rc1
- old
+ new
@@ -50,7 +50,75 @@
)
subject.run([
'--log-opt', 'gelf-address=udp://log_forwarder-logstash_internal:12201', 'service'
])
end
+
+ context 'health check' do
+ it 'sends --health-check-port' do
+ expect(subject).to receive(:update_service).with(
+ duck_type(:access_token), 'service', hash_including(health_check: {
+ port: '8080'
+ })
+ )
+ subject.run([
+ '--health-check-port', '8080', 'service'
+ ])
+ end
+
+ it 'sends --health-check-port as nil if none given' do
+ expect(subject).to receive(:update_service).with(
+ duck_type(:access_token), 'service', hash_including(health_check: {
+ port: nil
+ })
+ )
+ subject.run([
+ '--health-check-port', 'none', 'service'
+ ])
+ end
+
+ it 'sends --health-check-protocol' do
+ expect(subject).to receive(:update_service).with(
+ duck_type(:access_token), 'service', hash_including(health_check: {
+ protocol: 'tcp'
+ })
+ )
+ subject.run([
+ '--health-check-protocol', 'tcp', 'service'
+ ])
+ end
+
+ it 'sends --health-check-protocol as nil if none given' do
+ expect(subject).to receive(:update_service).with(
+ duck_type(:access_token), 'service', hash_including(health_check: {
+ protocol: nil
+ })
+ )
+ subject.run([
+ '--health-check-protocol', 'none', 'service'
+ ])
+ end
+
+ it 'sends --health-check-timeout' do
+ expect(subject).to receive(:update_service).with(
+ duck_type(:access_token), 'service', hash_including(health_check: {
+ timeout: '30'
+ })
+ )
+ subject.run([
+ '--health-check-timeout', '30', 'service'
+ ])
+ end
+
+ it 'sends --health-check-uri' do
+ expect(subject).to receive(:update_service).with(
+ duck_type(:access_token), 'service', hash_including(health_check: {
+ uri: '/health'
+ })
+ )
+ subject.run([
+ '--health-check-uri', '/health', 'service'
+ ])
+ end
+ end
end
end