Use BaseUrl in resources instead of BasePaths in resource templates#17321
Conversation
Also implemented handling of REP urls with the BaseUrl function
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
VCR tests failed because the output was too long; excerpt: That's most of the tests. That shouldn't be the case. I'll need to take a closer look tomorrow. |
|
Ran TestAccApiGatewayApiConfig_apigatewayApiConfigFullExample VCR replaying locally and got the error: So for some reason, the ReplaceVars isn't working as expected. |
|
So, I had used We could do replacement on the two URL sections separately, then join them, or we could join them, unescape them, and then do the replacement - but for now, I think it's simpler to just continue the practice of joining them as strings. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
|
TGC integration failure looks unrelated. |
Tests analyticsTotal tests: 6364 Click here to see the affected service packages
Action takenFound 24 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
|
🟢 Tests passed during RECORDING mode: 🔴 Tests failed when rerunning REPLAYING mode: Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made. Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer. 🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
|
The VCR test failures look unrelated to me; problems with this code change would surface as 404s (due to the base URL being empty or incorrect). Most of the failures are failures on all PRs (that impact the service) - compare for example #17325. The new failures here are TestAccDataSourceGoogleCloudRunService_basic and TestAccDataSourceGoogleCloudRunService_optionalProject. The URLs look correct, and I can get them to pass locally with this PR (though they're a bit flakey). So that's all to say: @slevenick this is ready for review! |
|
@slevenick This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
| url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{"{{"}}{{$.Res.ProductMetadata.Name}}{{"BasePath}}"}}{{$.Res.SelfLinkUri}}") | ||
| if err != nil { | ||
| return err | ||
| {{- if $.Res.ProductMetadata.Version.RepEnabled }} |
There was a problem hiding this comment.
It could make sense to unguard this as having {{location}} in any url is probably a failure mode
There was a problem hiding this comment.
TBH we might want to flag it as a failure mode if any {} characters are present in a URL... or maybe that should be an error returned by ReplaceVars if there's any replacement that didn't happen?
In either case - I'd be happy to make that change, but it'll probably be as a separate PR for clarity / to avoid blocking this one.
There was a problem hiding this comment.
Sounds good to me. Putting it in ReplaceVars would make sense, but I have a suspicion it would trigger errors on places we've handled replacement afterwards.
83aab4c
Also implemented handling of REP urls with the BaseUrl function.
This should end up choosing/creating the same URLs in all cases, when combined with ReplaceVars location replacement. (The only place that wasn't available was in operation code.)
One side effect of this change is that the BasePaths would end up with different values for REP-enabled products & configs (but I believe that's what we would want anyway, and BasePath usage will be phased out in following PRs in favor of the BaseUrl function.)
cc @SirGitsalot FYI
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.