-
Notifications
You must be signed in to change notification settings - Fork 333
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
table store batch to reject batches with different partitionkeys #2333
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -604,4 +604,46 @@ describe("table Entity APIs test", () => { | |
|
||
await tableClientrollback.deleteTable(); | ||
}); | ||
|
||
//Skips this test because it requires modifying the Azure Data Tables client so that it does not perform a check for partition key consistency before submitting the batch. | ||
it.skip("10. Batch API should fail when attempting to insert elements with different partitionkeys in same batch, @loki", async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please look at the table.entity.rest.test.ts file, there is an example of a batch request in there, which you can use to simulate this request. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am just updating the tests, which should make this easier for you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is taking a while to convert all the REST tests to the new method and remove dependencies, hope to be done by the end of the week. |
||
const partitionKey = createUniquePartitionKey("1"); | ||
const partitionKey2 = createUniquePartitionKey("2"); | ||
console.log(`PartitionKey: ${partitionKey} partitionKey2: ${partitionKey2}`); | ||
const tableNameBatchError: string = getUniqueName("datatables"); | ||
const testEntities: TableTestEntity[] = [ | ||
entityFactory.createBasicEntityForTest(partitionKey), | ||
entityFactory.createBasicEntityForTest(partitionKey2) | ||
]; | ||
|
||
const tableClientrollback = createAzureDataTablesClient( | ||
testLocalAzuriteInstance, | ||
tableNameBatchError | ||
); | ||
|
||
await tableClientrollback.createTable(); | ||
|
||
const transaction = new TableTransaction(); | ||
for (const testEntity of testEntities) { | ||
transaction.createEntity(testEntity); | ||
} | ||
try { | ||
await tableClientrollback.submitTransaction( | ||
transaction.actions | ||
); | ||
assert.fail("Did not get expected 400 (InvalidInput) error."); | ||
} catch (err: any) { | ||
if (err.code === "ERR_ASSERTION") { | ||
throw err; | ||
} | ||
const restErr = err as RestError; | ||
assert.strictEqual( | ||
restErr.statusCode, | ||
400, | ||
"Did not get expected 400 (InvalidInput) error." | ||
); | ||
} | ||
|
||
await tableClientrollback.deleteTable(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove console.log calls