-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tables] allows non-default port for Azurite emulator (#32262)
This PR addresses the issue of Azurite emulator endpoint with a non-default port (one that is not 10002) being treated as Cosmos endpoint. ------- ### Packages impacted by this PR `@azure/data-tables` ### Issues associated with this PR #32239
- Loading branch information
1 parent
2b60b8e
commit 36a3ba2
Showing
2 changed files
with
56 additions
and
1 deletion.
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
42 changes: 42 additions & 0 deletions
42
sdk/tables/data-tables/test/internal/isCosmosEndpoint.spec.ts
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,42 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { describe, it, assert } from "vitest"; | ||
import { isCosmosEndpoint } from "../../src/utils/isCosmosEndpoint.js"; | ||
|
||
describe("isCosmosEndpoint", () => { | ||
it("returns true for cosmosdb.* host", () => { | ||
const result = isCosmosEndpoint("https://abc.table.cosmosdb.azure.com"); | ||
assert.isTrue(result); | ||
}); | ||
|
||
it("returns true for cosmos.* host", () => { | ||
const result = isCosmosEndpoint("https://abc.table.cosmos.azure.com"); | ||
assert.isTrue(result); | ||
}); | ||
|
||
it("returns true for localhost", () => { | ||
const result = isCosmosEndpoint("https://localhost:8092"); | ||
assert.isTrue(result); | ||
}); | ||
|
||
it("returns false for azurite default endpoint", () => { | ||
const result = isCosmosEndpoint("https://127.0.0.1:10002/devstoreaccount1"); | ||
assert.isFalse(result); | ||
}); | ||
|
||
it("returns false for azurite default endpoint with non-default port", () => { | ||
const result = isCosmosEndpoint("https://127.0.0.1:20002/devstoreaccount1"); | ||
assert.isFalse(result); | ||
}); | ||
|
||
it("returns false for azurite default localhost endpoint", () => { | ||
const result = isCosmosEndpoint("https://localhost:10002/devstoreaccount1"); | ||
assert.isFalse(result); | ||
}); | ||
|
||
it("returns false for azurite default localhost endpoint with non-default port", () => { | ||
const result = isCosmosEndpoint("https://localhost:20002/devstoreaccount1"); | ||
assert.isFalse(result); | ||
}); | ||
}); |