forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cosmos] Adding check for setting ParallelizeCrossPartitionQuery head…
…er (Azure#31233) ### Packages impacted by this PR @azure/cosmos ### Issues associated with this PR Azure#31232 ### Describe the problem that is addressed by this PR Currently during a query if maxDegreeOfParallelism is set as 1, ParallelizeCrossPartitionQuery header value is set as true. This is currently resulting error from gateway for simple queries like "Select * FROM c". ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ Yes. ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
- Loading branch information
1 parent
f132f59
commit 75fbc46
Showing
5 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import assert from "assert"; | ||
import { Constants } from "../../../src/common/constants"; | ||
import { getHeaders } from "../../../src/request/request"; | ||
import { CosmosHeaders, FeedOptions } from "../../../src"; | ||
|
||
describe("Test x-ms-documentdb-query-parallelizecrosspartitionquery header value", function () { | ||
const mockedEndpoint = "https://localhost:8081"; | ||
function getHeadersFunc(feedOptions: FeedOptions): Promise<CosmosHeaders> { | ||
return getHeaders({ | ||
clientOptions: { endpoint: mockedEndpoint }, | ||
defaultHeaders: null, | ||
verb: null, | ||
path: null, | ||
resourceId: null, | ||
resourceType: null, | ||
options: feedOptions, | ||
partitionKeyRangeId: null, | ||
useMultipleWriteLocations: null, | ||
partitionKey: null, | ||
}); | ||
} | ||
it("If maxDegreeOfParallelism > 1 then x-ms-documentdb-query-parallelizecrosspartitionquery header should be true", async function () { | ||
const headers = await getHeadersFunc({ maxDegreeOfParallelism: 2 }); | ||
assert.equal( | ||
headers[Constants.HttpHeaders.ParallelizeCrossPartitionQuery], | ||
true, | ||
"incorrect header value", | ||
); | ||
}); | ||
it("If maxDegreeOfParallelism == 0 then x-ms-documentdb-query-parallelizecrosspartitionquery header should be null", async function () { | ||
const headers = await getHeadersFunc({ maxDegreeOfParallelism: 0 }); | ||
assert.equal( | ||
headers[Constants.HttpHeaders.ParallelizeCrossPartitionQuery], | ||
null, | ||
"incorrect header value", | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters