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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire up the local and remote persisters #1203

Merged
merged 15 commits into from
Feb 13, 2024

Commits on Feb 12, 2024

  1. Add a Persister interface

    ankur22 committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    1a566d1 View commit details
    Browse the repository at this point in the history
  2. Refactor LocalPersister.Persist

    This refactor will enable us to swap out the LocalFilePersister and
    RemotePersister. The Persist method in LocalFilePersist must match what
    is a requirement for the RemotePersister, which is the addition of the
    context as a param, even though the LocalFilePersister doesn't work
    with it.
    
    These two persisters will be interchangeable at a later stage depending
    on the environment setup.
    ankur22 committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    d705095 View commit details
    Browse the repository at this point in the history
  3. Add the screenshots output env var

    This env var will be used to configure the remote persister. When this
    env var is available and setup correctly, it will help configure the
    module to swap out the LocalFilePersister with the RemotePersister.
    ankur22 committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    6cf44ca View commit details
    Browse the repository at this point in the history
  4. Add parser for K6_BROWSER_SCREENSHOTS_OUTPUT

    This will parse the url, basePath and headers from
    K6_BROWSER_SCREENSHOTS_OUTPUT. It will also help determine whether the
    module should use a RemoteFilePersister or a LocalPersister.
    ankur22 committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    8897570 View commit details
    Browse the repository at this point in the history
  5. Add NewFilePersister

    This method will help determine whether to use the LocalFilePersister
    or the RemoteFilePersister. It mainly depends on whether a valid
    K6_BROWSER_SCREENSHOTS_OUTPUT env var has been setup.
    ankur22 committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    4df7fc4 View commit details
    Browse the repository at this point in the history
  6. Add init of FilePersister in module

    This initialise a FilePersister (either a local or remote) depending on
    the environment, which is dictated by K6_BROWSER_SCREENSHOTS_OUTPUT.
    ankur22 committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    6b1eb4a View commit details
    Browse the repository at this point in the history
  7. Use LocalPersister interface

    Use the interface instead of the LocalFilePersister throughout the
    codebase so that we can easily swap it out for a different persister.
    ankur22 committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    2dd480e View commit details
    Browse the repository at this point in the history

Commits on Feb 13, 2024

  1. Refactor interfaces for persisting files

    The packages will now own their own interfaces instead of borrowing one
    that was implemented in storage.
    ankur22 committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    4c74f14 View commit details
    Browse the repository at this point in the history
  2. Move newFilePersister to browser package

    The browser package is the work horse on initialising and setting up
    the environment for the global test run, iteration or vu. The decision
    on whether to create a Local or Remote persister should rest in the
    browser package's hands, but leave the details of what and how the two
    persisters do their job in the storage package.
    ankur22 committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    1172bc8 View commit details
    Browse the repository at this point in the history
  3. Add presignedURLConfig

    This type helps encapsulate and helps document what the parsed types
    and usages are from the K6_BROWSER_SCREENSHOTS_OUTPUT env var.
    ankur22 committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    6150b17 View commit details
    Browse the repository at this point in the history
  4. Add test for parseEnvVar

    ankur22 committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    07434ff View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    b9a2bea View commit details
    Browse the repository at this point in the history
  6. Rename to parsePresignedURLEnvVar

    This explains what it is doing better than parseEnvVar.
    ankur22 committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    cfe22e6 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    93cc48f View commit details
    Browse the repository at this point in the history
  8. Use mockPersister

    Use a mock persister when there's no need for either a local or remote
    persister in a test. These tests do not need to validate that a
    screenshot was saved.
    ankur22 committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    d7dad6a View commit details
    Browse the repository at this point in the history