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

Update TeamCity diff checker tool #12426

Merged

Conversation

SarahFrench
Copy link
Contributor

@SarahFrench SarahFrench commented Nov 25, 2024

Description

This PR:

  • Adds testing to the TC diff checker
  • Refactors logic to add more user feedback and provide feedback about mismatches in both directions between TC config and provider code
  • Changes how the tool is invoked from GHAs

Context

TeamCity diff checker has been failing for a few weeks:

Screenshot 2024-11-25 at 15 50 55

Here is an example:
Screenshot 2024-11-25 at 15 51 54

This error is confusing because:

However:

With better user feedback this could be less confusing


@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 hasn't generated any diffs, but I'll let you know if a future commit does.

@SarahFrench SarahFrench changed the title Update teamcity diff checker Update TeamCity diff checker tool Nov 25, 2024
@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 hasn't generated any diffs, but I'll let you know if a future commit does.

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 hasn't generated any diffs, but I'll let you know if a future commit does.

@SarahFrench SarahFrench requested a review from BBBmau November 25, 2024 17:29
@SarahFrench SarahFrench marked this pull request as ready for review November 25, 2024 17:29
@modular-magician

This comment was marked as outdated.

1 similar comment
@modular-magician

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

2 similar comments
@modular-magician

This comment was marked as duplicate.

@modular-magician

This comment was marked as duplicate.

@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 hasn't generated any diffs, but I'll let you know if a future commit does.


# Create lists of service packages in providers. Need to cd into repos where go.mod is to do this command.
cd ${{env.GOOGLE_REPO_PATH}}
go list -f '{{.Name}}' ${{env.GOOGLE_REPO_PATH}}/google/services/... > $GITHUB_WORKSPACE/provider_services_ga.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using go list allows us to list the actual packages present in the services directory. This protects us a bit against people who name the folders differently from the package name (matching names is what is usual).

Copy link
Collaborator

@BBBmau BBBmau left a comment

Choose a reason for hiding this comment

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

looks good! Ran the tests locally:

└─(10:05:08 on update-teamcity-diff-checker)──> go test -timeout 30s -run ^Test_ -v                                                                                                                                                                   ──(Wed,Nov27)─┘
=== RUN   Test_main_happyPaths
=== RUN   Test_main_happyPaths/something_missing_in_TeamCity_config_present_in_provider_code
=== RUN   Test_main_happyPaths/something_missing_in_provider_code_present_in_TeamCity_config
=== RUN   Test_main_happyPaths/everything_matches
--- PASS: Test_main_happyPaths (0.00s)
    --- PASS: Test_main_happyPaths/something_missing_in_TeamCity_config_present_in_provider_code (0.00s)
    --- PASS: Test_main_happyPaths/something_missing_in_provider_code_present_in_TeamCity_config (0.00s)
    --- PASS: Test_main_happyPaths/everything_matches (0.00s)
=== RUN   Test_main_unhappyPaths
=== RUN   Test_main_unhappyPaths/cannot_find_provider_service_file
=== RUN   Test_main_unhappyPaths/cannot_find_TeamCity_service_file
=== RUN   Test_main_unhappyPaths/empty_TeamCity_service_file
=== RUN   Test_main_unhappyPaths/empty_provider_service_file
--- PASS: Test_main_unhappyPaths (0.00s)
    --- PASS: Test_main_unhappyPaths/cannot_find_provider_service_file (0.00s)
    --- PASS: Test_main_unhappyPaths/cannot_find_TeamCity_service_file (0.00s)
    --- PASS: Test_main_unhappyPaths/empty_TeamCity_service_file (0.00s)
    --- PASS: Test_main_unhappyPaths/empty_provider_service_file (0.00s)
=== RUN   Test_listDifference
=== RUN   Test_listDifference/detects_when_lists_match
=== RUN   Test_listDifference/detects_when_items_from_list_A_is_missing_items_present_in_list_B_-_1_missing
=== RUN   Test_listDifference/detects_when_items_from_list_A_is_missing_items_present_in_list_B_-_2_missing
=== RUN   Test_listDifference/doesn't_detect_differences_if_list_A_is_a_superset_of_list_B
--- PASS: Test_listDifference (0.00s)
    --- PASS: Test_listDifference/detects_when_lists_match (0.00s)
    --- PASS: Test_listDifference/detects_when_items_from_list_A_is_missing_items_present_in_list_B_-_1_missing (0.00s)
    --- PASS: Test_listDifference/detects_when_items_from_list_A_is_missing_items_present_in_list_B_-_2_missing (0.00s)
    --- PASS: Test_listDifference/doesn't_detect_differences_if_list_A_is_a_superset_of_list_B (0.00s)
PASS
ok      github.com/GoogleCloudPlatform/magic-modules/tools/teamcity-diff-check  0.232s

@SarahFrench
Copy link
Contributor Author

Thanks! I've manually tested the GHA yaml in my fork, but I'll merge this and then run the weekly check GHA on this repo to confirm all's ok

@SarahFrench SarahFrench merged commit a854242 into GoogleCloudPlatform:main Nov 27, 2024
17 checks passed
@SarahFrench
Copy link
Contributor Author

amanMahendroo pushed a commit to amanMahendroo/magic-modules that referenced this pull request Dec 17, 2024
niharika-98 pushed a commit to niharika-98/magic-modules that referenced this pull request Feb 17, 2025
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