Skip to content

fix: implement setMetadata in HmacKey and fix associated tests #2009

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

Conversation

ddelgrosso1
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@ddelgrosso1 ddelgrosso1 requested review from a team as code owners July 29, 2022 15:53
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/nodejs-storage API. labels Jul 29, 2022
@ddelgrosso1 ddelgrosso1 requested a review from shaffeeullah July 29, 2022 15:55
@@ -680,8 +680,8 @@ export async function deleteHMAC(options: ConformanceTestOptions) {
const metadata = {
state: 'INACTIVE',
};
options.hmacKey!.setMetadata(metadata);
await options.hmacKey!.delete();
await hmacKey.setMetadata(metadata);
Copy link
Contributor

Choose a reason for hiding this comment

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

does this not run into the problem where the instructions get used here?

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 does not. I spoke with Cathy and verified in testing that only the delete call will utilize instruction count.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh right because the instructions are on the method specified. this makes sense.

src/hmacKey.ts Outdated
optionsOrCallback: SetMetadataOptions | MetadataCallback,
cb?: MetadataCallback
): Promise<SetMetadataResponse> | void {
// ETag preconditions are not currently supported so retries should be disabled
Copy link
Contributor

Choose a reason for hiding this comment

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

unless the retry strategy is RetryAlways, right? i made this mistake too in IAM, I will fix it now

@ddelgrosso1 ddelgrosso1 force-pushed the refactor-setmetadata branch from 9ab9528 to 7b59aa4 Compare July 29, 2022 16:08
@shaffeeullah shaffeeullah self-requested a review July 29, 2022 16:18
Copy link
Contributor

@shaffeeullah shaffeeullah left a comment

Choose a reason for hiding this comment

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

thanks, denis!

@shaffeeullah shaffeeullah merged commit db80d3b into googleapis:shaffeeullah/preconditionUpdates Jul 29, 2022
shaffeeullah added a commit that referenced this pull request Aug 10, 2022
…el (#1993)

* test: updated conformance tests for precondition updates

* fixed typo

* updated functions to pass preconditions

* removed IAM and HMAC test changes

* implemented local preconditions for bucketmakeprivate

* added preconditions to enableLogging

* linted files

* implemented more preconditions

* general cleanup

* implemented precondition on combine

* added preconditions for copy and move

* rename

* removed tests for instance precondition where instance precondition is not supported

* support preconditions for rotateencryptionkey

* support set storage class

* linted files

* fixed tests

* deleteLabels and setLabels

* more precondition implementations

* minor progress

* fix(refactor): Simplify logic around disabling autoretry for setmetadata

* setcorsconfiguration

* set retention period

* bucketSetStorageClass

* fileMakePrivate

* file set metadata

* bucket set metadata

* file delete

* more precondition updates

* precondition refactor

* removed log statement

* change delete labels signature

* fix delete labels

* fixed save multipart

* put docker code back

* linted files

* docs and cleanup

* refactored conformance tests

* remove iam test from being in the conformance tests

* linted files

* put docker commands back

* fixed combine retries

* added comments

* fix: implement setMetadata in HmacKey and fix associated tests (#2009)

* fix: implement setMetadata in HmacKey and fix associated tests

* fix merge problem, check idempotency strategy

* retry based on idempotency strategy

* linted file

* Revert "retry based on idempotency strategy"

This reverts commit 80909b5.

* don't retry acl adds

* changed HEAD request to GET request

* fix(refactor): Add a call from file.delete to the parent class delete (#2014)

* fix(refactor): Add a call from file.delete to the parent class delete

* add delete to checked methods for conditionally idempotent file ops

* fix: fix noResponseRetries so it respects reqOpts.maxRetries (#2015)

* fix: fix noResponseRetries so it respects reqOpts.maxRetries

* fix situation where err.code is actually a string during connection resets

* log error type

* removed passing functions

* restored retryInvocationMap

* added instance precondition back to insert

* restored scenario 2

* restored all scenarios

* linted files

* Revert "linted files"

This reverts commit d2cb27b.

* removed logs

Co-authored-by: Sameena Shaffeeullah <[email protected]>

* fix: pass appropriate preconditions from enableLogging to setMetadata (#2018)

* tests: remove callback waterfall from make bucket private system test (#2020)

* tests: remove callback waterfall from make bucket private system test

* cleaner implementation

* moved done()

* removed precondition from policyoptions

* added retries for setPolicy

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* removed unused import

Co-authored-by: Denis DelGrosso <[email protected]>
Co-authored-by: Denis DelGrosso <[email protected]>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants