Sha256: 152cdfbfe0bfa3a6c639043f0e6ab630eb91d280dff884bcf3868f1396f8febd

Contents?: true

Size: 1.58 KB

Versions: 47

Compression:

Stored size: 1.58 KB

Contents

require_relative "../../../spec_helper"
require 'kontena/cli/grids/update_command'

describe Kontena::Cli::Grids::UpdateCommand do

  include ClientHelpers

  let(:client) do
    Kontena::Client.new('https://foo', {access_token: 'abcd1234'})
  end

  let(:subject) do
    described_class.new(File.basename($0))
  end

  let(:server) do
    Kontena::Cli::Config::Server.new(url: 'https://localhost', token: 'abcd1234')
  end

  describe "#update" do

    context 'log options' do
      it 'should fail if no driver specified' do
        expect {
          subject.run(['--log-opt', 'foo=bar', 'test'])
        }.to exit_with_error

      end

      it 'should send valid options to server' do
        expect(client).to receive(:put).with(
          'grids/test', hash_including({
            logs: {
              forwarder: 'fluentd',
              opts: {
                foo: 'bar'
              }
            }
          })
        )
        subject.run(['--log-forwarder', 'fluentd', '--log-opt', 'foo=bar', 'test'])
      end

      it 'should send empty statsd when --no-statsd-server given' do
        expect(client).to receive(:put).with(
          'grids/test', hash_including({
            stats: { statsd: nil }
          })
        )
        subject.run(['--no-statsd-server', 'test'])
      end

      it 'should send empty default_affinity when --no-default-affinity given' do
        expect(client).to receive(:put).with(
          'grids/test', hash_including({
            default_affinity: []
          })
        )
        subject.run(['--no-default-affinity', 'test'])
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
kontena-cli-1.4.3 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.3.rc1 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.2 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.2.rc1 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.2.pre1 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.1 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.1.rc1 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.1.pre1 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.3.5 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.3.5.rc1 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.rc2 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.rc1 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.pre14 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.pre13 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.pre12 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.pre11 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.pre10 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.pre9 spec/kontena/cli/grids/update_command_spec.rb
kontena-cli-1.4.0.pre8 spec/kontena/cli/grids/update_command_spec.rb