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

feat: add functionality for passing preconditions at the function level #1993

Merged
merged 70 commits into from Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
122dacf
test: updated conformance tests for precondition updates
shaffeeullah Jun 7, 2022
091686f
fixed typo
shaffeeullah Jun 7, 2022
ab0735c
Merge branch 'main' of github.com:googleapis/nodejs-storage into shaf…
shaffeeullah Jun 16, 2022
fa48fec
updated functions to pass preconditions
shaffeeullah Jun 24, 2022
c48f808
Merge branch 'main' of github.com:googleapis/nodejs-storage into shaf…
shaffeeullah Jun 27, 2022
7a7b304
removed IAM and HMAC test changes
shaffeeullah Jun 27, 2022
3e0647d
implemented local preconditions for bucketmakeprivate
shaffeeullah Jun 27, 2022
0b31ad1
added preconditions to enableLogging
shaffeeullah Jun 27, 2022
79d5a05
linted files
shaffeeullah Jun 28, 2022
d4e6fad
Merge branch 'main' of github.com:googleapis/nodejs-storage into shaf…
shaffeeullah Jun 28, 2022
b58b71e
Merge branch 'main' of github.com:googleapis/nodejs-storage into shaf…
shaffeeullah Jul 13, 2022
f17fd95
Merge branch 'main' of github.com:googleapis/nodejs-storage into shaf…
shaffeeullah Jul 21, 2022
daa9eb7
implemented more preconditions
shaffeeullah Jul 21, 2022
bff2862
general cleanup
shaffeeullah Jul 21, 2022
a192cf9
implemented precondition on combine
shaffeeullah Jul 22, 2022
f65883a
added preconditions for copy and move
shaffeeullah Jul 25, 2022
6f98536
rename
shaffeeullah Jul 25, 2022
b71a6f9
removed tests for instance precondition where instance precondition i…
shaffeeullah Jul 25, 2022
d48c6cf
support preconditions for rotateencryptionkey
shaffeeullah Jul 25, 2022
e5afd02
support set storage class
shaffeeullah Jul 25, 2022
d09cddb
linted files
shaffeeullah Jul 25, 2022
fccd871
fixed tests
shaffeeullah Jul 25, 2022
7a95592
deleteLabels and setLabels
shaffeeullah Jul 26, 2022
408b45c
more precondition implementations
shaffeeullah Jul 26, 2022
9879672
minor progress
shaffeeullah Jul 26, 2022
3ac678c
fix(refactor): Simplify logic around disabling autoretry for setmetadata
ddelgrosso1 Jul 27, 2022
ed5e407
setcorsconfiguration
shaffeeullah Jul 27, 2022
27a38b9
Merge branch 'ddelgrosso-refactor-setmetadata' of github.com:googleap…
shaffeeullah Jul 27, 2022
5b26bbc
set retention period
shaffeeullah Jul 27, 2022
0e8ebcd
bucketSetStorageClass
shaffeeullah Jul 27, 2022
ce06b26
fileMakePrivate
shaffeeullah Jul 27, 2022
05ee7ee
file set metadata
shaffeeullah Jul 27, 2022
f3a348b
bucket set metadata
shaffeeullah Jul 27, 2022
44aaba6
file delete
shaffeeullah Jul 27, 2022
982b9f9
more precondition updates
shaffeeullah Jul 27, 2022
e48a467
precondition refactor
shaffeeullah Jul 27, 2022
8455c02
removed log statement
shaffeeullah Jul 27, 2022
a326cd2
change delete labels signature
shaffeeullah Jul 28, 2022
3b89bdd
fix delete labels
shaffeeullah Jul 28, 2022
21df169
fixed save multipart
shaffeeullah Jul 28, 2022
95dcf78
put docker code back
shaffeeullah Jul 28, 2022
bb9c2d8
linted files
shaffeeullah Jul 28, 2022
859b98d
docs and cleanup
shaffeeullah Jul 28, 2022
a03baaa
refactored conformance tests
shaffeeullah Jul 28, 2022
bd7a1f5
remove iam test from being in the conformance tests
shaffeeullah Jul 28, 2022
67a66d1
linted files
shaffeeullah Jul 29, 2022
f991b95
put docker commands back
shaffeeullah Jul 29, 2022
40e0842
fixed combine retries
shaffeeullah Jul 29, 2022
3896201
added comments
shaffeeullah Jul 29, 2022
db80d3b
fix: implement setMetadata in HmacKey and fix associated tests (#2009)
ddelgrosso1 Jul 29, 2022
80909b5
retry based on idempotency strategy
shaffeeullah Jul 29, 2022
2b608ec
Merge branch 'shaffeeullah/preconditionUpdates' of github.com:googlea…
shaffeeullah Jul 29, 2022
0014091
linted file
shaffeeullah Jul 29, 2022
722f975
Revert "retry based on idempotency strategy"
shaffeeullah Jul 29, 2022
b98813e
Merge branch 'main' of github.com:googleapis/nodejs-storage into shaf…
shaffeeullah Aug 1, 2022
65268f0
don't retry acl adds
shaffeeullah Aug 2, 2022
efb82dc
Merge branch 'main' of github.com:googleapis/nodejs-storage into shaf…
shaffeeullah Aug 2, 2022
44c28c6
changed HEAD request to GET request
shaffeeullah Aug 2, 2022
6af60de
fix(refactor): Add a call from file.delete to the parent class delete…
ddelgrosso1 Aug 2, 2022
ccde4f5
fix: fix noResponseRetries so it respects reqOpts.maxRetries (#2015)
ddelgrosso1 Aug 4, 2022
2d56d9a
fix: pass appropriate preconditions from enableLogging to setMetadata…
ddelgrosso1 Aug 5, 2022
5012989
tests: remove callback waterfall from make bucket private system test…
ddelgrosso1 Aug 5, 2022
36d220b
moved done()
shaffeeullah Aug 8, 2022
a015bd7
Merge branch 'shaffeeullah/preconditionUpdates' of github.com:googlea…
shaffeeullah Aug 8, 2022
bbddeda
removed precondition from policyoptions
shaffeeullah Aug 8, 2022
7c38ef6
added retries for setPolicy
shaffeeullah Aug 8, 2022
3a8cf23
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Aug 8, 2022
b537854
removed unused import
shaffeeullah Aug 8, 2022
d6398bf
Merge branch 'shaffeeullah/preconditionUpdates' of github.com:googlea…
shaffeeullah Aug 8, 2022
ff1d2a1
Merge branch 'main' into shaffeeullah/preconditionUpdates
shaffeeullah Aug 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
74 changes: 39 additions & 35 deletions conformance-test/conformanceCommon.ts
Expand Up @@ -92,16 +92,29 @@ export function executeScenario(testCase: RetryTestCase) {
instructionSet.instructions,
jsonMethod?.name.toString()
);
bucket = await createBucketForTest(
storage,
testCase.preconditionProvided,
storageMethodString
);
file = await createFileForTest(
testCase.preconditionProvided,
storageMethodString,
bucket
);
if (storageMethodString.includes('InstancePrecondition')) {
bucket = await createBucketForTest(
storage,
testCase.preconditionProvided,
storageMethodString
);
file = await createFileForTest(
testCase.preconditionProvided,
storageMethodString,
bucket
);
} else {
bucket = await createBucketForTest(
storage,
false,
storageMethodString
);
file = await createFileForTest(
false,
storageMethodString,
bucket
);
}
notification = bucket.notification(`${TESTS_PREFIX}`);
await notification.create();

Expand All @@ -121,29 +134,20 @@ export function executeScenario(testCase: RetryTestCase) {
});

it(`${instructionNumber}`, async () => {
const methodParameters: libraryMethods.ConformanceTestOptions = {
bucket: bucket,
file: file,
notification: notification,
storage: storage,
hmacKey: hmacKey,
};
if (testCase.preconditionProvided) {
methodParameters.preconditionRequired = true;
}
if (testCase.expectSuccess) {
assert.ifError(
await storageMethodObject(
bucket,
file,
notification,
storage,
hmacKey
)
);
assert.ifError(await storageMethodObject(methodParameters));
} else {
try {
await storageMethodObject(
bucket,
file,
notification,
storage,
hmacKey
);
throw Error(`${storageMethodString} was supposed to throw.`);
} catch (e) {
assert.notStrictEqual(e, undefined);
}
await assert.rejects(storageMethodObject(methodParameters));
}
const testBenchResult = await getTestBenchRetryTest(
creationResult.id
Expand All @@ -158,15 +162,15 @@ export function executeScenario(testCase: RetryTestCase) {

async function createBucketForTest(
storage: Storage,
preconditionProvided: boolean,
preconditionShouldBeOnInstance: boolean,
storageMethodString: String
) {
const name = generateName(storageMethodString, 'bucket');
const bucket = storage.bucket(name);
await bucket.create();
await bucket.setRetentionPeriod(DURATION_SECONDS);

if (preconditionProvided) {
if (preconditionShouldBeOnInstance) {
return new Bucket(storage, bucket.name, {
preconditionOpts: {
ifMetagenerationMatch: 2,
Expand All @@ -177,14 +181,14 @@ async function createBucketForTest(
}

async function createFileForTest(
preconditionProvided: boolean,
preconditionShouldBeOnInstance: boolean,
storageMethodString: String,
bucket: Bucket
) {
const name = generateName(storageMethodString, 'file');
const file = bucket.file(name);
await file.save(name);
if (preconditionProvided) {
if (preconditionShouldBeOnInstance) {
return new File(bucket, file.name, {
preconditionOpts: {
ifMetagenerationMatch: file.metadata.metageneration,
Expand Down