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

TeamCity: test utils refactor #10290

Merged
merged 9 commits into from
May 13, 2024
Merged

Conversation

SarahFrench
Copy link
Contributor

@SarahFrench SarahFrench commented Mar 26, 2024

This PR:

  • updates the test utils used in the tests for the TeamCity config code.
  • changes error messages to be framed the correct way

Test utils:

Previously there was a getSubProject function that would retrieve a project that was nested 2 levels deep from a starting project. It was always given the root of the TeamCity project and was used to pull out projects from within the Google or Google Beta projects.

Now, getSubProject does something more logical given its name. You supply a Project and the name of a subproject within it, and it'll return a Project object for that subproject. This can be used to make assertions on, etc.

The original functionality of retrieving a project from 2 levels of nesting is now fulfilled by getNestedProjectFromRoot, which uses getSubProject internally.

This PR refactors existing acceptance tests to use the new test utils.

Error message framing

Messages needed to be rewritten to be pointing out why a given test would fail.


Release Note Template for Downstream PRs (will be copied)


@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 81 insertions(+), 75 deletions(-))

@modular-magician

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 76 insertions(+), 83 deletions(-))

1 similar comment
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 76 insertions(+), 83 deletions(-))

@SarahFrench SarahFrench marked this pull request as ready for review April 26, 2024 18:22
@SarahFrench SarahFrench requested a review from BBBmau April 26, 2024 18:22
Comment on lines -32 to +25
(gaProject!!.subProjects + betaProject!!.subProjects).forEach{p ->
(gaProject.subProjects + betaProject.subProjects + projectSweeperProject.subProjects).forEach{p ->
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not having to assert a variable isn't null feels good man

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This refactor makes the tests use the new helpers but also updates the tests to include the new 'project sweeper' project

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't a refactor of a test, this is just straight-up fixing a test that wasn't iterating over anything; the root project contains no build configurations.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 84 insertions(+), 97 deletions(-))

@SarahFrench SarahFrench requested review from shuyama1 and removed request for BBBmau May 8, 2024 12:53
Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

LGTM! 💯

I've also added a new test nonVCRBuildShouldHaveSaveArtifactsToGCS in mmv1/third_party/terraform/.teamcity/tests/build_configuration_features.kt in a recent PR and it probably needs to be updated as well. Let me know if there's anything I can help

@SarahFrench SarahFrench force-pushed the SarahFrench-teamcity-testutils-refactor branch from 506faa3 to 904103c Compare May 13, 2024 12:02
@SarahFrench
Copy link
Contributor Author

I just rebased this branch to get the new stuff from main, and I'll update the new tests

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 91 insertions(+), 104 deletions(-))

1 similar comment
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 91 insertions(+), 104 deletions(-))

@SarahFrench
Copy link
Contributor Author

Waiting to merge until after the service and project sweepers run today

@SarahFrench SarahFrench merged commit 998f8f9 into main May 13, 2024
11 checks passed
kautikdk pushed a commit to kautikdk/magic-modules that referenced this pull request May 16, 2024
pawelJas pushed a commit to pawelJas/magic-modules that referenced this pull request May 16, 2024
ma-g-22 pushed a commit to ma-g-22/magic-modules that referenced this pull request May 21, 2024
pengq-google pushed a commit to pengq-google/magic-modules that referenced this pull request May 21, 2024
Cheriit pushed a commit to Cheriit/magic-modules that referenced this pull request Jun 4, 2024
@SarahFrench SarahFrench deleted the SarahFrench-teamcity-testutils-refactor branch June 10, 2024 13:50
pcostell pushed a commit to pcostell/magic-modules that referenced this pull request Jul 16, 2024
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