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

Assessment runner refactors #2123

Merged

Commits on Oct 29, 2024

  1. test/e2e: Refactor out common patterns

    We have some repeated patterns of looking through
    list of pods to find the one matching our expected name
    and then extracting some information from it. Rather than
    repeat this in multiple places we can refactor this pattern out
    in assessment_helpers and re-use it.
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    1f8d476 View commit details
    Browse the repository at this point in the history
  2. test/e2e: Rework PodEventExtractor

    I used the `PodEventExtractor` method to compare against an expected
    error message, but didn't realise at the time that it just watched for the
    first warning message and returned that. We then use this output in
    `assessment_runner` to see if our expected error description is there.
    
    Note: As we use it in the `Assess` phase of testing and the pod should
    be in the expected state after the `WithSetup`, we should be able to
    replace the need for the watch and just get a list of the events
    
    - Rename to clarify that only warning (and error) events are considered
    and create a `ComparePodEventDescriptions` method in
    `assessment_helper` to help simplify the logic in `assessment_runner`
    and process all warning events looking for a description match, not just
    the first match. If no error was expected then mark the test as failing.
    - In some of the tests that expect failure events, as we are no longer
    watching for the first error, we should wait for pod to have gone into
    failed state before processing the events, in others we add a retry to
    check for the message.
    
    Based on the above logic we can simplify the instance type testing
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    fd57b7e View commit details
    Browse the repository at this point in the history
  3. test/e2e: InstanceType refactor

    Refactor out the instance type check to the
    assessment_helper, to make the assessment_runner
    flow easier to read
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    003edef View commit details
    Browse the repository at this point in the history
  4. test/e2e: Refactor out VerifyAlternateImage

    Refactor out the logic that checks the alternativeImage
    is used to make the assessment_runner flow cleaner
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    c6d937a View commit details
    Browse the repository at this point in the history
  5. tests/e2e: Refactor out VerifyNydusSnapshotter

    - Refactor out the logic that checks if nydus snapshotter
    was used for image pull, to make the assessment_runner
    flow cleaner.
    - Refactor IsPulledWithNydusSnapshotter to use remove
    the duplicated code and re-use other helper functions
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    6012a5d View commit details
    Browse the repository at this point in the history
  6. test/e2e: Create more helper functions

    Create new methods for VerifyCaaPodLogContains
    and getCaaPod to avoid duplication and improve
    readability.
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    54993fa View commit details
    Browse the repository at this point in the history
  7. test/e2e: Remove fail reason test case option

    No tests are using the `WithFailReason` option,
    so remove the code to reduce clutter
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    98855c2 View commit details
    Browse the repository at this point in the history
  8. test/e2e: Remove t.Fatal from Assess methods

    The [Go Wiki]|(https://go.dev/wiki/TestComments) states
    > On a practical level, prefer calling t.Error over t.Fatal.
    >  t.Fatal is usually only appropriate when some piece
    > of test setup fails, without which you cannot run the
    > test at all.
    
    - Update t.Fatal's in assess methods to t.Error's
    - Pass pointers to pods rather than the Pod, like
    the Kubernetes e2e pod base does
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    01254bc View commit details
    Browse the repository at this point in the history
  9. test/e2e: Refactor VerifyImagePullTimer

    Refactor out the logic that checks if the image pull timing,
    to make the assessment_runner flow cleaner.
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    3790a9a View commit details
    Browse the repository at this point in the history
  10. versions: Remove rust version

    After confidential-containers#2121 the rust version is no longer needed
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    e1767d2 View commit details
    Browse the repository at this point in the history
  11. tests: e2e: Add nodeName filter to getCaaPod

    As Wainer pointed out in the review, if we ran the e2e tests
    on a cluster with multiple worker nodes, then our logic for
    only checking for a single CAA pod might fail, so add an
    additional nodeName filter, so get the CAA that is running
    on the same node as the pod.
    
    Signed-off-by: stevenhorsman <steven@uk.ibm.com>
    stevenhorsman committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    69e05f0 View commit details
    Browse the repository at this point in the history