Skip to content

Conversation

@Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Dec 6, 2024

Problem

  • The SAM tests are flaky, and sometimes fail CI.
  • SAM file scenarios section includes a ton of copy-pasting.

Solution

The SAM build images can be pulled ahead of time to reduce risk of timeout.

To see this working, see the integ test logs below, and notice in the logs that Fetching public.ecr.aws/sam/build-... Docker container image..., resolved immediately (likely cached from pre-fetching) whereas before this took 60-90 seconds sometimes.

To reduce copy pasting, establish useful defaults, and generate the scenarios based on a few args to avoid copy pasting information.


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.

License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Hweinstock
Copy link
Contributor Author

Hweinstock commented Dec 6, 2024

/runIntegrationTests

@Hweinstock Hweinstock changed the title refactor(sam): avoid copy pasting same config options in tests. build(sam): pull SAM builds in install phase to avoid timeouts Dec 9, 2024
@Hweinstock Hweinstock marked this pull request as ready for review December 9, 2024 15:47
@Hweinstock Hweinstock requested a review from a team as a code owner December 9, 2024 15:47
// vscodeMinimum: '1.67.0',
// },

generateScenario('nodejs', '18.x'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A benefit of the old code is that it was "flat" data that did not require inspecting any logic. Copy-pasting can be very costly for logic, but for data, especially data contained in one place (this file) it can be a useful tradeoff.

However, your new code is certainly easier to read at a glance.

# Ensure that "docker" group has permissions to the socket.
# - chown codebuild-user /var/run/docker.sock
- chmod 666 /var/run/docker.sock
# Pull Docker Images for SAM tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!!

@justinmk3 justinmk3 deleted the branch aws:master December 10, 2024 16:33
@justinmk3 justinmk3 closed this Dec 10, 2024
@justinmk3 justinmk3 reopened this Dec 10, 2024
@justinmk3 justinmk3 changed the base branch from feature/postreinvent to master December 10, 2024 22:35
@justinmk3
Copy link
Contributor

Integ tests on master usually take 25 min, whereas this PR took 35 min. However, on b3823d4 the Integ tests took 35 min, so perhaps this is variable.

Since this will help with reliability, let's merge it and see how it performs over time.

@justinmk3 justinmk3 merged commit 0a40071 into aws:master Dec 10, 2024
58 of 88 checks passed
@Hweinstock
Copy link
Contributor Author

If the tests themselves are pulling the images when we run them, is there any reason pulling them ahead of time would increase the time of the tests?

@Hweinstock Hweinstock deleted the sam/testRefactor branch December 11, 2024 15:57
@justinmk3
Copy link
Contributor

The times I mentioned are total CI time per-job, which includes the "install" phase.

karanA-aws pushed a commit to karanA-aws/aws-toolkit-vscode that referenced this pull request Jan 17, 2025


## Problem
- The SAM tests are flaky, and sometimes fail CI. 
- SAM file scenarios section includes a ton of copy-pasting. 

## Solution
The SAM build images can be pulled ahead of time to reduce risk of
timeout.

To see this working, see the integ test logs below, and notice in the
logs that `Fetching public.ecr.aws/sam/build-... Docker container
image...`, resolved immediately (likely cached from pre-fetching)
whereas before this took 60-90 seconds sometimes.

To reduce copy pasting, establish useful defaults, and generate the
scenarios based on a few args to avoid copy pasting information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants