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

FAH uses ids using the same naming policy as rolloutPolicy #6743

Merged
merged 9 commits into from Feb 6, 2024

Conversation

inlined
Copy link
Member

@inlined inlined commented Feb 5, 2024

Additionally added listRollouts and fixed listBuilds so that it paginates over multiple requests and preserves the list of unavailable regions (and handles them)

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (1473c04) 0.00% compared to head (acabd18) 54.26%.

Files Patch % Lines
src/gcp/apphosting.ts 87.23% 3 Missing and 3 partials ⚠️
src/init/features/apphosting/index.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6743       +/-   ##
===========================================
+ Coverage        0   54.26%   +54.26%     
===========================================
  Files           0      347      +347     
  Lines           0    24197    +24197     
  Branches        0     5005     +5005     
===========================================
+ Hits            0    13131    +13131     
- Misses          0     9864     +9864     
- Partials        0     1202     +1202     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@bkendall bkendall left a comment

Choose a reason for hiding this comment

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

style/cleanup comments, but looks fine to me

Comment on lines 368 to 369
res.builds.splice(res.builds.length, 0, ...(int.body.builds || []));
res.unreachable?.splice(res.unreachable.length, 0, ...(int.body.unreachable || []));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it cleaner to use .push?

Suggested change
res.builds.splice(res.builds.length, 0, ...(int.body.builds || []));
res.unreachable?.splice(res.unreachable.length, 0, ...(int.body.unreachable || []));
res.builds.push(...(int.body.builds || []));
res.unreachable?.push(...(int.body.unreachable || []));

Comment on lines 443 to 444
res.rollouts.splice(res.rollouts.length, 0, ...(int.body.rollouts || []));
res.unreachable?.splice(res.unreachable.length, 0, ...(int.body.unreachable || []));
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to above... is push more clear?

backendId: string,
): Promise<ListBuildsResponse> {
const name = `projects/${projectId}/locations/${location}/backends/${backendId}/builds`;
let pageToken: string | undefined = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically I don't think you need to specify = undefined - that can be dropped.

Suggested change
let pageToken: string | undefined = undefined;
let pageToken: string | undefined;

/**
* Generates the next build ID to fit with the naming scheme of the backend API.
* @param counter Overrides the counter to use, avoiding an API call.
* @return
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can drop an empty @return line - though I'm not certain

Comment on lines 533 to 534
// Note: month is 0 based in JS
const month = String(date.getUTCMonth()).padStart(2, "0");
Copy link
Contributor

Choose a reason for hiding this comment

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

So should you be adding 1?

Copy link
Member Author

Choose a reason for hiding this comment

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

😱 I modified the code and dropped the +1. Good catch and thank god for comments.

}

// Note: must use exports here so that listRollouts can be stubbed in tests.
const builds = await (exports as { listRollouts: typeof listRollouts }).listRollouts(
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh, but exports.listRollouts gives you type errors or something? That's unfortunate :(

return `build-${year}-${month}-${day}`;
}

it("Should handle explicit counters", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

These generally shouldn't be capitalized (though I'm not sure I have any style guidance to point to). When I see this, I read it as a sentence, and "it Should do this" looks abnormal (compared to "it should do this")

@inlined inlined merged commit 8e388c1 into master Feb 6, 2024
35 checks passed
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.

None yet

4 participants