Sha256: 2a71fbd763cd40b720b3965962ae778e695f0a14bd0287e2c2de9043e71afa11

Contents?: true

Size: 1.68 KB

Versions: 21

Compression:

Stored size: 1.68 KB

Contents

require_relative "../../../spec_helper"
require "kontena/cli/grid_options"
require "kontena/cli/services/update_command"

describe Kontena::Cli::Services::UpdateCommand do

  include ClientHelpers

  describe '#execute' do

    before(:each) do
      allow(subject).to receive(:update_service).and_return({})
    end

    it 'requires api url' do
      expect(subject).to receive(:require_api_url).once
      subject.run(['service'])
    end

    it 'requires token' do
      expect(subject).to receive(:require_token).once
      subject.run(['service'])
    end

    it 'sends update command' do
      expect(subject).to receive(:update_service).with(token, 'service', {privileged: false})
      subject.run(['service'])
    end

    it 'sends --cap-add' do
      expect(subject).to receive(:update_service).with(token, 'service', hash_including(cap_add: ['NET_ADMIN']))
      subject.run(['--cap-add', 'NET_ADMIN', 'service'])
    end

    it 'sends --cap-drop' do
      expect(subject).to receive(:update_service).with(token, 'service', hash_including(cap_drop: ['MKNOD']))
      subject.run(['--cap-drop', 'MKNOD', 'service'])
    end

    it 'sends --log-driver' do
      expect(subject).to receive(:update_service).with(token, 'service', hash_including(log_driver: 'syslog'))
      subject.run(['--log-driver', 'syslog', 'service'])
    end

    it 'sends --log-opt' do
      expect(subject).to receive(:update_service).with(
        token, 'service', hash_including(log_opts: {
          'gelf-address'  => 'udp://log_forwarder-logstash_internal:12201'
        })
      )
      subject.run([
        '--log-opt', 'gelf-address=udp://log_forwarder-logstash_internal:12201', 'service'
      ])
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
kontena-cli-0.15.5 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.5.rc2 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.5.rc1 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.4 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.4.rc2 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.4.rc1 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.4.pre1 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.3 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.2 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.1 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.0 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.0.rc3 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.0.rc2 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.15.0.rc1 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.14.7 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.14.6 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.14.5 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.14.4 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.14.3 spec/kontena/cli/services/update_command_spec.rb
kontena-cli-0.14.2 spec/kontena/cli/services/update_command_spec.rb