Feature: Command to print Rugged logs.

Test results for features/commands/logs.feature

Running behat features/commands/logs.feature results in:

@rugged @commands @logs @root-worker @snapshot-worker @targets-worker @test-worker @timestamp-worker
Feature: Command to print Rugged logs.
  In order to monitor Rugged operations
  As an administrator
  I need to read Rugged's logs.

  Background:
    Given I reset Rugged

  Scenario: The 'logs' Rugged command exists.
    When I try to run "sudo sudo -u rugged rugged logs --help"
    Then I should not get:
      """
      Error: No such command 'logs'.
      """
    And I should get:
      """
      Usage: rugged logs [OPTIONS]
      
        Print the logs for a TUF repository.
      
      Options:
        --local          Print the local logs. Defaults to true, unless a worker is
                         specified.
        --worker TEXT    The specific worker from which to retrieve logs. Can be
                         passed multiple times.
        --limit INTEGER  The number of lines to print for each log.
        --truncate       Instead of printing logs, empty log file(s).
        --help           Show this message and exit.
      """

  Scenario: Print local logs.
    When I run the Rugged command "rugged --debug echo"
    When I run the Rugged command "rugged --debug logs --local --limit=0"
    Then I should get:
      """
      === Log for local operations: /var/log/rugged/rugged.log ===
      rugged_cli invoked
      Sending test-worker Ping!...
      Initializing connection to RabbitMQ.
      Done. Response was: test-worker PONG: Ping!
      """

  Scenario: Print only the last line from local logs.
    Given I run the Rugged command "rugged echo --worker=test-worker"
    When I run the Rugged command "rugged logs --local --limit 1"
    Then I should get:
      """
      === Log for local operations: /var/log/rugged/rugged.log ===
      Done. Response was: test-worker PONG: Ping!
      """
    And I should not get:
      """
      Sending test-worker Ping!...
      """

  Scenario: Print a worker's logs.
    When I run the Rugged command "rugged echo"
    When I run the Rugged command "rugged --debug logs --worker=test-worker --limit=0"
    Then I should not get:
      """
      === Log for local operations: /var/log/rugged/rugged.log ===
      Sending test-worker Ping!...
      Done. Response was: test-worker PONG: Ping!
      """
    Then I should get:
      """
      === Log for test-worker: /var/log/rugged/rugged.log ===
      test-worker received echo task: Ping!
      """

  Scenario: Print multiple workers' logs.
    When I run the Rugged command "rugged echo"
    When I run the Rugged command "rugged --debug logs --worker=test-worker --worker=root-worker --limit=0"
    Then I should get:
      """
      === Log for test-worker: /var/log/rugged/rugged.log ===
      test-worker received echo task: Ping!
      === Log for root-worker: /var/log/rugged/rugged.log ===
      root-worker received echo task: Ping!
      """
    Then I should not get:
      """
      === Log for snapshot-worker: /var/log/rugged/rugged.log ===
      === Log for targets-worker: /var/log/rugged/rugged.log ===
      === Log for timestamp: /var/log/rugged/rugged.log ===
      """

  Scenario: Truncate local logs.
    When I run the Rugged command "rugged echo"
    When I run the Rugged command "rugged --debug logs --local --truncate"
    Then I should get:
      """
      Truncated local operations log at: /var/log/rugged/rugged.log
      """
    When I run the Rugged command "rugged --debug logs --local"
    Then I should get:
      """
      === Log for local operations: /var/log/rugged/rugged.log ===
      """
    Then I should not get:
      """
      Sending test-worker Ping!...
      Initializing connection to RabbitMQ.
      Done. Response was: test-worker PONG: Ping!
      """

  Scenario: Truncate worker logs.
    Given I run the Rugged command "rugged echo"
    When I run the Rugged command "rugged --debug logs --worker=test-worker --truncate"
    Then I should get:
      """
      Truncated test-worker log at: /var/log/rugged/rugged.log
      """
    When I run the Rugged command "rugged --debug logs --worker=test-worker --limit=0"
    Then I should get:
      """
      === Log for test-worker: /var/log/rugged/rugged.log ===
      """
    Then I should not get:
      """
      test-worker received echo task: Ping!
      """

7 scenarios (7 passed)
37 steps (37 passed)
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Rugged TUF Server is a trademark of Consensus Enterprises.