Sha256: 1bdbeda6ae86aa9a4b07ebfc43e991f4472f525951b3e4898ad9e6b98f758d9e

Contents?: true

Size: 1.04 KB

Versions: 31

Compression:

Stored size: 1.04 KB

Contents

require "kontena/cli/stacks/logs_command"

describe Kontena::Cli::Stacks::LogsCommand do
  include ClientHelpers
  include OutputHelpers

  let (:logs) do
    [
      {
        'id' => '57cff2e8cfee65c8b6efc8bd',
        'name' => 'test-stack.mysql-1',
        'created_at' => '2016-09-07T15:19:04.362690',
        'data' => "mysql log message 1",
      },
    ]
  end

  it "shows stack logs" do
    expect(client).to receive(:get).with('stacks/test-grid/test-stack/container_logs', {
      limit: 100,
    }) { { 'logs' => logs } }

    expect{subject.run(['test-stack'])}.to output_lines [
      "2016-09-07T15:19:04.362690 [test-stack.mysql-1]: mysql log message 1",
    ]
  end

  it "shows stack service logs" do
    expect(client).to receive(:get).with('grids/test-grid/container_logs', {
      limit: 100,
      services: 'test-stack/mysql,test-stack/myapp'
    }) { { 'logs' => logs } }

    expect{subject.run(['test-stack', 'mysql', 'myapp'])}.to output_lines [
      "2016-09-07T15:19:04.362690 [test-stack.mysql-1]: mysql log message 1",
    ]
  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

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