Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(refactor): Adjust mail_changedetector + change detection helpers #2997

Merged

Commits on Jan 15, 2023

  1. tests(refactor): mail_changedetector.bats - Leverage DRY methods

    `supervisorctl tail` is not the most reliably way to get logs for the latest change detection and has been known to be fragile in the past.
    
    We can instead read the full log for the service directly with `tac` and `sed` to extract all log content since the last change detection.
    
    Common asserts have also been extracted out into separate methods.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    abafd43 View commit details
    Browse the repository at this point in the history
  2. tests(chore): Remove sleep and redundant change event

    Container 1 is still blocked at this point from an existing lock and change event.
    
    Make the lock stale immediately and no extra sleep is required when paired with the helper method to wait until the event is processed (which should remove the stale lock).
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    5b28815 View commit details
    Browse the repository at this point in the history
  3. tests(refactor): Add more DRY methods

    - Simplify the test case so it's easier to grok.
    - 2nd test case (blocking) extracts out initial setup into a separate method and merges the later service restart logic which is redundant.
    - Additional comments for improved context of what is going on / expected.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    4530f25 View commit details
    Browse the repository at this point in the history
  4. tests(chore): Revise the change detection helper method

    - Add explicit counting arg to change detection support.
    - Extract revised logic into it's own generic helper method.
    - Utilize this for a separate method that monitors for a change event having started, but not waiting for completion.
    
    This allows dropping the 40 sec of remaining `sleep` in `mail_changedetector` test. It was also required due to potentially missing the timing of a change event completing concurrently in a 2nd container that needed to be waited on and then checked.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    4729d10 View commit details
    Browse the repository at this point in the history
  5. tests(chore): Migrate to current test conventions

    - Switch to common container setup helpers
    - Update container name and change usage to variables instead.
    - Adopt the new convention of prefix variable for test cases (revised test case descriptions).
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    4378031 View commit details
    Browse the repository at this point in the history
  6. tests(chore): Remove legacy change detection

    This has since been replaced with the new helper watches the `changedetector` service logs directly instead of only detecting a change has occurred via checksum comparison.
    
    No tests use this method anymore, it was originally for `tests.bats`. Thus the tests in `test_helper.bats` are being dropped too. The new helper has test coverage in `changedetector` tests.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    3596a29 View commit details
    Browse the repository at this point in the history
  7. chore: Lock removal should not incur sleep 5 afterwards

    - A new lock should be created by this script after removal. The sleep doesn't help avoid a race condition with lock file creation after removal.
    - Reduces test time as a bonus.
    - Added some additional comments to test.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    c3dbe4a View commit details
    Browse the repository at this point in the history
  8. tests(chore): tls_letsencrypt.bats leverage improved change detection

    - No need to wait on the change detection service anymore during container startup.
    - No need to count change events processed either as waiting a fixed duration is no longer relied on.
    - This makes the reload count method redundant, dropped.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    5a4bd9b View commit details
    Browse the repository at this point in the history
  9. tests(chore): Convert setup-cli.bats to new test conventions

    This test file was already adapted to the original common setup helpers.
    
    - `TEST_NAME` replaced with `CONTAINER_NAME`.
    - Prefix var added, test case descriptions drop explicit prefix.
    - No other changes.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    c9a8d5c View commit details
    Browse the repository at this point in the history
  10. tests(chore): Extract out helpers related to change-detection

    - New helper file for sharing these helpers to tests.
    - Includes the helpful log method from changedetector tests.
    - No longer need to maintain duplicate copies of these methods during the test migration. All tests that use them are now importing the separate helper file.
    - `tls_letsencrypt.bats` has switched to using the log helper.
    - Generic log count helper is removed from `test_helper/common.bash` as any test that needs it in future can adapt to `helper/common.bash`.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    ae3dc4c View commit details
    Browse the repository at this point in the history
  11. tests(refactor): tls_letsencrypt.bats remove _get_service_logs()

    This helper does not seem useful as moving away from `supervisorctl tail` and no other tests had a need for it.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    fa4ec9c View commit details
    Browse the repository at this point in the history
  12. tests(chore): Remove common setup methods from test_helper/common.bash

    No other tests depend on this. Future tests will adopt the revised versions from `helper/setup.bash`.
    
    Additionally updates `helper/setup.bash` comments that are no longer applicable to `TEST_TMP_CONFIG` and `CONTAINER_NAME`.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    a04a147 View commit details
    Browse the repository at this point in the history
  13. chore: Minor style changes

    Review feedback
    
    Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
    polarathene and georglauterbach committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    a28d19d View commit details
    Browse the repository at this point in the history
  14. chore: Relocate inline docs

    Review feedback request
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    91610dc View commit details
    Browse the repository at this point in the history
  15. chore: Simplify setting EXPECTED_COUNT

    Co-authored-by: Casper <casperklein@users.noreply.github.com>
    polarathene and casperklein committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    32aea55 View commit details
    Browse the repository at this point in the history
  16. Revert "chore: Simplify setting EXPECTED_COUNT"

    This reverts commit ed8078b.
    polarathene committed Jan 15, 2023
    Configuration menu
    Copy the full SHA
    655bb50 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    0893c98 View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2023

  1. Configuration menu
    Copy the full SHA
    cbf58ef View commit details
    Browse the repository at this point in the history