Feature: Metadata expiry periods are refreshed automatically.

Test results for features/monitor/refresh_expiry.feature

Running behat features/monitor/refresh_expiry.feature results in:

@rugged @monitor @refresh-expiry
Feature: Metadata expiry periods are refreshed automatically.
  In order to keep a TUF systems running smoothly,
  As a TUF administrator
  I need to ensure that metadata expiry periods are refreshed automatically.

  Background:
    Given I reset Rugged
    And I run "sudo rm -rf /opt/post_to_tuf/*"

  Scenario: Ensure that monitor worker has necessary config for testing 'refresh-expiry'.
    When I run the Rugged command "rugged config --worker=monitor-worker"
    Then I should get:
      """
      scheduler_log_level                           DEBUG
      task_timeout                                  3
      scheduler_refresh_period                      5.0
      scheduler_scan_period                         120.0
      """
      'scheduler_log_level                           DEBUG' was not found in command output:
      ------
      === Configuration for monitor-worker ===
      broker_connection_string                      REDACTED
      scheduler_log_level                           INFO
      scheduler_refresh_period                      3600.0
      scheduler_scan_period                         5.0
      workers                                       {'snapshot': {'name': 'snapshot-worker'}, 'targets': {'name': 'targets-worker'}, 'timestamp': {'name': 'timestamp-worker'}}
      log_file                                      /var/log/rugged/rugged.log
      log_format                                    %(asctime)s %(levelname)s (%(module)s.%(funcName)s): %(message)s
      repo_path                                     /var/rugged/tuf_repo
      inbound_targets_path                          /var/rugged/incoming_targets
      post_to_tuf_path                              /opt/post_to_tuf
      repo_targets_path                             /var/rugged/tuf_repo/targets
      repo_metadata_path                            /var/rugged/tuf_repo/metadata
      roles                                         {'root': {'threshold': 1, 'expiry': 31536000}, 'timestamp': {'threshold': 1, 'expiry': 86400}, 'snapshot': {'threshold': 1, 'expiry': 604800}, 'targets': {'threshold': 1, 'expiry': 604800}}
      expiry_refresh_threshold                      43200
      consistent_snapshot                           False
      print_host_headers                            True
      use_hashed_bins                               False
      number_of_bins                                16
      hashed_bins_key_name                          targets
      celery_worker_max_memory_per_child            0
      delete_targets_after_signing                  False
      task_timeout                                  10
      wait_for_processing_task_to_complete_timeout  30
      wait_for_refreshing_task_to_complete_timeout  15
      stale_semaphore_age_thresholds                {'tuf_paused': 3600, 'tuf_processing_': 300, 'tuf_refreshing_expiry': 60}
      
      
      ------
       (Exception)

  Scenario: Ensure that monitor worker is polling for expiry refresh.
    Given I initialize a Rugged repo
    And I wait "6" seconds
    When I run the Rugged command "rugged logs --worker=monitor-worker --limit=0"
    Then I should get:
      """
      Received refresh-expiry task.
      """
      'Received refresh-expiry task.' was not found in command output:
      ------
      === Log for monitor-worker: /var/log/rugged/rugged.log ===
      
      ------
       (Exception)

  Scenario Outline: Metadata expiry periods are refreshed automatically.
    Given I run the Rugged command "rugged pause-processing --refreshing-timeout=0 --processing-timeout=0"
    And I run "sudo cp features/fixtures/config/expiry/short_<ROLE>_expiry.yaml /var/rugged/.config/rugged/config.yaml"
    And I initialize a Rugged repo
    And I record a reference hash of "/var/rugged/tuf_repo/metadata/<ROLE>.json"
    And I record the expiry timestamp from "<ROLE>.json"
    And I run the Rugged command "rugged resume-processing"
    And I wait (up to "60" seconds) for the file "/var/rugged/tuf_repo/metadata/<ROLE>.json" to change
    When I run the Rugged command "rugged logs --worker=monitor-worker --limit=0"
    Then I should get:
      """
      Received refresh-expiry task.
      Fetching expiring metadata from workers.
      Starting fetch of expiring metadata on targets-worker.
      Completed fetch of expiring metadata on targets-worker.
      Starting fetch of expiring metadata on snapshot-worker.
      Completed fetch of expiring metadata on snapshot-worker.
      Starting fetch of expiring metadata on timestamp-worker.
      Completed fetch of expiring metadata on timestamp-worker.
      Expiring metadata from targets-worker:
      Expiring metadata from snapshot-worker:
      Expiring metadata from timestamp-worker:
        <ROLE>.json
      Completed refresh of expiring metadata on <ROLE>-worker.
      """
    When I run the Rugged command "rugged logs --worker=<ROLE>-worker --limit=0"
    Then I should get:
      """
      '<ROLE>.json' metadata expiry is imminent
      """
    And the expiry timestamp from "<ROLE>.json" has changed

    Examples:
      | ROLE      |
      | targets   |
        Failed step: And I wait (up to "60" seconds) for the file "/var/rugged/tuf_repo/metadata/targets.json" to change
        The file /var/rugged/tuf_repo/metadata/targets.json was expected to have changed, but has not changed after waiting 60 seconds. (Exception)
      | snapshot  |
        Failed step: And I wait (up to "60" seconds) for the file "/var/rugged/tuf_repo/metadata/snapshot.json" to change
        The file /var/rugged/tuf_repo/metadata/snapshot.json was expected to have changed, but has not changed after waiting 60 seconds. (Exception)
      | timestamp |
        Failed step: And I wait (up to "60" seconds) for the file "/var/rugged/tuf_repo/metadata/timestamp.json" to change
        The file /var/rugged/tuf_repo/metadata/timestamp.json was expected to have changed, but has not changed after waiting 60 seconds. (Exception)

--- Failed scenarios:

    features/monitor/refresh_expiry.feature:11
    features/monitor/refresh_expiry.feature:21
    features/monitor/refresh_expiry.feature:64
    features/monitor/refresh_expiry.feature:65
    features/monitor/refresh_expiry.feature:66

5 scenarios (5 failed)
52 steps (32 passed, 5 failed, 15 skipped)
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Rugged TUF Server is a trademark of Consensus Enterprises.