Skip to content

Conversation

@TetyanaYahodska
Copy link
Contributor

@TetyanaYahodska TetyanaYahodska commented Oct 19, 2024

Description

Sample in NodeJs - GoogleCloudPlatform/nodejs-docs-samples#3826
Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label bot added api: compute Issues related to the Compute Engine API. samples Issues that are directly related to samples. labels Oct 19, 2024
@TetyanaYahodska TetyanaYahodska added the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 19, 2024
@TetyanaYahodska TetyanaYahodska marked this pull request as ready for review October 19, 2024 21:12
Comment on lines 115 to 116
Assert.assertTrue(storagePool.getCapacityProvisioningType().equalsIgnoreCase("advanced"));
Assert.assertTrue(storagePool.getPerformanceProvisioningType().equalsIgnoreCase("advanced"));
Copy link
Contributor

Choose a reason for hiding this comment

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

please use PERFORMANCE_PROVISIONING_TYPE instead of "advanced" literal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Done

@minherz minherz assigned minherz and unassigned Sita04 Oct 25, 2024
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 28, 2024
@TetyanaYahodska TetyanaYahodska added the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 28, 2024
StoragePool storagePool = CreateHyperdiskStoragePool
.createHyperdiskStoragePool(PROJECT_ID, ZONE, STORAGE_POOL_NAME, poolType,
"advanced", 10240, 10000, 10240);
"advanced", 10240, 10000, 10240,
Copy link
Contributor

Choose a reason for hiding this comment

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

should the capacity to be 1024 and not 10240?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not a scope of this task. I've created a new task to fix code and will follow yours recommendations.

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not understand what you mean by "creating a new task"? Do you propose to address code review comments made in this PR by submitting a separate PR?
If you do, I find this proposal very inconvenient and time consuming. Please, explain what do you mean.

Regarding my question about the value 10240, I looked into Cloud Console UI and it limits the range to be from 1 to 1024 TB. I do not know if client library limits the range but I think that making it matching UX in Console is preferred.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


@Disabled
@Test
public void stage1_CreateHyperdiskStoragePoolTest()
Copy link
Contributor

Choose a reason for hiding this comment

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

why the name of the method follows snake notation and not pascal notation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not a scope of this task. I've created a new task to fix code and will follow yours recommendations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines 122 to 123
public void stage2_CreateHyperdiskStoragePoolTest()
throws IOException, ExecutionException, InterruptedException, TimeoutException {
Copy link
Contributor

Choose a reason for hiding this comment

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

what is being testing in this method that was not tested in the previous method? Why changing the arguments to the call to CreateDiskInStoragePool.createDiskInStoragePool() should matter for testing this code sample?
The code sample method does not have any conditions, so testing Google API invocation with different parameters does not test code sample but the backend API which is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not a scope of this task. I've created a new task to fix code and will follow yours recommendations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've fixed naming for these tests. As I understand from code and tests

  1. the first testCreateHyperdiskStoragePool() tests that StoragePoll was created as expected
  2. the second testCreateDiskInStoragePool() takes the StoragePoolLink of the StoragePool created in the first test and tests it's parameters.

Copy link
Contributor

Choose a reason for hiding this comment

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

according to your explanations the second test does not validate the code sample. the code sample shows how to create a storage pool. the test(s) should validate the code.

please, modify the test class to do one of the following, either to remove the second test because it does not add to the validation to code sample or perform all validations / asserts in the first test method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have two classes - CreateDiskInStoragePool and CreateHyperdiskStoragePool. To test this code Svyatoslav created two test methods - testCreateDiskInStoragePool and testCreateHyperdiskStoragePool. As far as I can see, these tests are working properly

@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 30, 2024
@TetyanaYahodska TetyanaYahodska added the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 30, 2024
StoragePool storagePool = CreateHyperdiskStoragePool
.createHyperdiskStoragePool(PROJECT_ID, ZONE, STORAGE_POOL_NAME, poolType,
"advanced", 10240, 10000, 10240);
"advanced", 10240, 10000, 10240,
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not understand what you mean by "creating a new task"? Do you propose to address code review comments made in this PR by submitting a separate PR?
If you do, I find this proposal very inconvenient and time consuming. Please, explain what do you mean.

Regarding my question about the value 10240, I looked into Cloud Console UI and it limits the range to be from 1 to 1024 TB. I do not know if client library limits the range but I think that making it matching UX in Console is preferred.

@minherz
Copy link
Contributor

minherz commented Oct 30, 2024

@TetyanaYahodska I am puzzled by the multiple responses saying "It's not a scope of this task. I've created a new task ...".

The review is done for the code changed in this PR. However, the changes may influence the code that was not touched as well. In majority of situations splitting the work on the code review comments into multiple PRs makes the process to review and track changes harder than necessary.

If you find the feedback unclear or you disagree with the recommendations, please argument your point of view either in the comments or by scheduling a meeting.
If your opinion that some of the requested changes are hard to implement in this PR, please provide a clear explanation why it is hard. Once we agree about it, these changes should be captured as a new issue that is related to this PR. And then they can be handled as a separate task.

@kokoro-team kokoro-team removed kokoro:run Add this label to force Kokoro to re-run the tests. labels Oct 30, 2024
@TetyanaYahodska
Copy link
Contributor Author

TetyanaYahodska commented Nov 1, 2024

@minherz I don't mind making the changes you've asked me to make to code unrelated to this task. But as I know, the goal of each task should correspond to the implemented code and have an explanation for the changes made to the task. But if you want to review the big PRs, I'm open to your suggestions. Thank you for your patience!

Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

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

Thank you for addressing all the comments. Please apply one remaining change to improve the code readability.

@TetyanaYahodska TetyanaYahodska added the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 4, 2024
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 4, 2024
@TetyanaYahodska TetyanaYahodska added the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 4, 2024
Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

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

lgtm. approving to avoid blocking your progress. however, before merging, please look to address the following:

  • apply changes to the test code described in this comment thread
  • i still do not get full understanding why the code uses 10240 instead of 1024 when passing the capacity value. I think it can be confusing to developers. Maybe the value is already 1024 and I am confused by Github UI. If it is still 10240, please have a look into the client library to see whether or not it should be 1024.

Thank you

Comment on lines 122 to 123
public void stage2_CreateHyperdiskStoragePoolTest()
throws IOException, ExecutionException, InterruptedException, TimeoutException {
Copy link
Contributor

Choose a reason for hiding this comment

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

according to your explanations the second test does not validate the code sample. the code sample shows how to create a storage pool. the test(s) should validate the code.

please, modify the test class to do one of the following, either to remove the second test because it does not add to the validation to code sample or perform all validations / asserts in the first test method.

@TetyanaYahodska
Copy link
Contributor Author

@minherz After changing capacity to 1024 I've got error "message": "Provisioned capacity 1024 is smaller than the minimum allowed capacity 10240.",

@kokoro-team kokoro-team removed kokoro:run Add this label to force Kokoro to re-run the tests. labels Nov 7, 2024
@TetyanaYahodska TetyanaYahodska added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Nov 7, 2024
@kokoro-team kokoro-team removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Nov 7, 2024
@TetyanaYahodska TetyanaYahodska added the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 7, 2024
@TetyanaYahodska TetyanaYahodska merged commit 5c97f27 into main Nov 7, 2024
8 checks passed
@TetyanaYahodska TetyanaYahodska deleted the extend-compute_hyperdisk_pool_create branch November 7, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: compute Issues related to the Compute Engine API. kokoro:run Add this label to force Kokoro to re-run the tests. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants