Sha256: a7d7c5457e159db682424821d29540b73fae49e890fd26b4ee2240c6de82af0b

Contents?: true

Size: 1.04 KB

Versions: 68

Compression:

Stored size: 1.04 KB

Contents

require_relative "../../../spec_helper"
require "kontena/cli/services/logs_command"

describe Kontena::Cli::Services::LogsCommand do

  include ClientHelpers

  describe '#execute' do
    before(:each) do
      allow(client).to receive(:get).and_return({
        'logs' => []
      })
    end

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

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

    it 'requests logs from master' do
      expect(client).to receive(:get).with(
        'services/test-grid/null/service-a/container_logs', {limit: 100}
      )
      subject.run(['service-a'])
    end

    context 'when passing instance option ' do
      it 'adds it to query params' do
        expect(client).to receive(:get).with(
          'services/test-grid/null/service-a/container_logs', {instance: '1', limit: 100}
        )
        subject.run(['-i', '1', 'service-a'])
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
kontena-cli-1.5.4 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.4.rc1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.3 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.2 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.0 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.0.rc1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.0.pre5 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.0.pre4 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.0.pre3 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.0.pre2 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.5.0.pre1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.4.3 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.4.3.rc1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.4.2 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.4.2.rc1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.4.2.pre1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.4.1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.4.1.rc1 spec/kontena/cli/services/logs_command_spec.rb
kontena-cli-1.4.1.pre1 spec/kontena/cli/services/logs_command_spec.rb