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

Improve image replication test region; Add LA notice #582

Merged
merged 4 commits into from
Sep 20, 2024

Conversation

yec-akamai
Copy link
Contributor

@yec-akamai yec-akamai commented Sep 18, 2024

📝 Description

Improve the image replication test case and remove the hardcoded regions.

Add LA notice to image gen2 endpoint.

✔️ How to Test

make ARGS="-run TestImage_Replicate" fixtures

@yec-akamai yec-akamai added the testing for updates to the testing suite in the changelog. label Sep 18, 2024
@yec-akamai yec-akamai requested a review from a team as a code owner September 18, 2024 16:35
@yec-akamai yec-akamai requested review from lgarber-akamai and ykim-akamai and removed request for a team September 18, 2024 16:35
Comment on lines 278 to 297
regions, err := client.ListRegions(context.Background(), nil)
if err != nil {
t.Fatal(err)
}

regionHasCaps := func(r linodego.Region) bool {
capsMap := make(map[string]bool)

for _, c := range r.Capabilities {
capsMap[strings.ToUpper(c)] = true
}

for _, c := range capabilities {
if _, ok := capsMap[strings.ToUpper(c)]; !ok {
return false
}
}

return true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: Would it make sense to call getRegionsWithCaps(...) here and filter down the results below?

Copy link
Contributor Author

@yec-akamai yec-akamai Sep 18, 2024

Choose a reason for hiding this comment

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

I did try to call getRegionsWithCaps(...) at first but figured out it might be better to have the logic here. Because getRegionsWithCaps(...) only return a list of region's id string, we will have to make extra API calls to get the Region object for obtaining necessary info. It's probably slow down the test.

I'm wondering if it makes sense to move regionHasCaps(...) as an independent function, so that we can call it here without repeating this part of logic. What's your thoughts?

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 that would be a good idea. Maybe we can move it as a separate helper function in integration_test_suite.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ykim-1 @lgarber-akamai thanks for the comment! Just applied the improvement, could both of you re-approve the PR?

Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Image-related tests are all passing on my end, nice work!

Copy link
Contributor

@ykim-akamai ykim-akamai left a comment

Choose a reason for hiding this comment

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

LGTM, tests passed locally with new fixture

Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Looks great, nice work!

@yec-akamai yec-akamai merged commit 2710f50 into main Sep 20, 2024
6 checks passed
@yec-akamai yec-akamai deleted the image-gen2-small-fix branch September 20, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing for updates to the testing suite in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants