Feature: Delete targets once they have been signed.

Test results for features/misc/preserve_targets.feature

Running behat features/misc/preserve_targets.feature results in:

@rugged @cli @clean-up-targets
Feature: Delete targets once they have been signed.
  In order to reduce required file storage,
  As a Rugged operator,
  I need to be able to configure Rugged to delete targets once they have been signed.

  Background:
    Given I reset Rugged
    And I initialize a Rugged repo

  Scenario: Rugged preserves targets after signing, by default.
    Given I am in the "/var/rugged/incoming_targets" directory
    And file "test0.txt" contains "test0"
    When I run the Rugged command "rugged add-targets"
    And I run the Rugged command "rugged logs --worker=targets-worker --limit=0"
    Then I should not get:
      """
      Deleted '/var/rugged/tuf_repo/targets/test0.txt' after signing.
      """
    When I try to run "ls -la /var/rugged/tuf_repo/targets/test0.txt"
    Then I should get:
      """
      test0.txt
      """
    And I should not get:
      """
      ls: cannot access '/var/rugged/tuf_repo/targets/test0.txt': No such file or directory
      """

  Scenario: Rugged can be configured to preserve targets after signing.
    Given I run "sudo cp features/fixtures/config/preserve_targets.yaml /var/rugged/.config/rugged/config.yaml"
    And I am in the "/var/rugged/incoming_targets" directory
    And file "test0.txt" contains "test0"
    When I run the Rugged command "rugged add-targets"
    And I run the Rugged command "rugged logs --worker=targets-worker --limit=0"
    Then I should not get:
      """
      Deleted '/var/rugged/tuf_repo/targets/test0.txt' after signing.
      """
    When I try to run "ls -la /var/rugged/tuf_repo/targets/test0.txt"
    Then I should get:
      """
      test0.txt
      """
    And I should not get:
      """
      ls: cannot access '/var/rugged/tuf_repo/targets/test0.txt': No such file or directory
      """

  Scenario: Rugged can be configured to delete targets after signing.
    Given I run "sudo cp features/fixtures/config/delete_targets.yaml /var/rugged/.config/rugged/config.yaml"
    And I am in the "/var/rugged/incoming_targets" directory
    And file "test0.txt" contains "test0"
    When I run the Rugged command "rugged --debug add-targets --local"
    Then I should get:
      """
      Added the following targets to the repository:
      test0.txt
      Updated targets metadata.
      """
    When I run "grep -r test0.txt ../tuf_repo/metadata"
    Then I should get:
      """
      targets.json
      """
    When I run the Rugged command "rugged logs --local --limit=0"
    Then I should get:
      """
      Deleted '/var/rugged/tuf_repo/targets/test0.txt' after signing.
      """
    When I try to run "ls -la /var/rugged/tuf_repo/targets/test0.txt"
    Then I should get:
      """
      ls: cannot access '/var/rugged/tuf_repo/targets/test0.txt': No such file or directory
      """

3 scenarios (3 passed)
34 steps (34 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.