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

chore: Add git sha and url overrides #364

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

avangelillo
Copy link
Contributor

What does this PR do?

Add the ability to override the git sha and repo url to make snapshot testing easier.

Motivation

Requested by a customer in #359

Testing Guidelines

  • Unit tests

Additional Notes

This PR allows you to override the git commit sha without having to modify your stack code, other than making the datadog lambda public on your stack. From a code snippet from the issue, adding the new line will make the snapshot consistent

test('Snapshot', () => {
  const app = new App();
  const stack = new SomeStack(app, 'test', {
    env: {
      account: '0123456789012',
      region: 'us-east-1',
    },
  });

  // New line
  stack.datadogLambda.overrideGitMetadata("fake-sha");

  const template = Template.fromStack(stack);
  expect(template.toJSON()).toMatchSnapshot();
});

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

Add the ability to override the git sha and repo url to make snapshot testing
easier.

JIRA: https://datadoghq.atlassian.net/browse/SVLS-6260

Github Issue: #359
@avangelillo avangelillo changed the title Add git sha and url overrides chore:Add git sha and url overrides Feb 14, 2025
@avangelillo avangelillo changed the title chore:Add git sha and url overrides chore: Add git sha and url overrides Feb 14, 2025
@avangelillo avangelillo marked this pull request as ready for review February 14, 2025 16:05
@avangelillo avangelillo requested a review from a team as a code owner February 14, 2025 16:05
});
});

it("overrides only the sha for both existing and new lambda functions", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is same as the previous test case. Is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, fixed

Fix duplicated test name from comment
@avangelillo avangelillo merged commit d44d53d into main Feb 19, 2025
9 checks passed
@avangelillo avangelillo deleted the alex.angelillo/supportGitOverrides branch February 19, 2025 15:53
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