Skip to content

Commit 2c859c9

Browse files
Fix slow Azure test. (#5133)
[SC-49913](https://app.shortcut.com/tiledb-inc/story/49913/azure-blob-storage-endpoint-uris-test-is-slow) A test that merely checked that Azure Blob Storage endpoints and SAS tokens were properly concatenated was lagging because in a section where no SAS token was specified, it would try to authenticate with Microsoft Entra ID which took ten minutes in CI because of retries. For the cases when the SAS token is empty, we set a dummy shared key, which will prevent Microsoft Entra ID from being attempted. I also removed a duplicate section and made it more clear that the endpoints are illustrative. Validated locally. --- TYPE: NO_HISTORY
1 parent 68a1472 commit 2c859c9

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

test/src/unit-vfs.cc

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -709,37 +709,42 @@ TEST_CASE(
709709

710710
#ifdef HAVE_AZURE
711711
TEST_CASE("VFS: Construct Azure Blob Storage endpoint URIs", "[azure][uri]") {
712+
// Test the construction of Azure Blob Storage URIs from account name and SAS
713+
// token. We are not actually connecting to Azure Blob Storage in this test.
712714
std::string sas_token, custom_endpoint, expected_endpoint;
713715
SECTION("No SAS token") {
714716
sas_token = "";
715-
expected_endpoint = "https://devstoreaccount1.blob.core.windows.net";
717+
expected_endpoint = "https://exampleaccount.blob.core.windows.net";
716718
}
717719
SECTION("SAS token without leading question mark") {
718720
sas_token = "baz=qux&foo=bar";
719721
expected_endpoint =
720-
"https://devstoreaccount1.blob.core.windows.net?baz=qux&foo=bar";
722+
"https://exampleaccount.blob.core.windows.net?baz=qux&foo=bar";
721723
}
722724
SECTION("SAS token with leading question mark") {
723725
sas_token = "?baz=qux&foo=bar";
724726
expected_endpoint =
725-
"https://devstoreaccount1.blob.core.windows.net?baz=qux&foo=bar";
727+
"https://exampleaccount.blob.core.windows.net?baz=qux&foo=bar";
726728
}
727729
SECTION("SAS token in both endpoint and config option") {
728730
sas_token = "baz=qux&foo=bar";
729731
custom_endpoint =
730-
"https://devstoreaccount1.blob.core.windows.net?baz=qux&foo=bar";
732+
"https://exampleaccount.blob.core.windows.net?baz=qux&foo=bar";
731733
expected_endpoint =
732-
"https://devstoreaccount1.blob.core.windows.net?baz=qux&foo=bar";
733-
}
734-
SECTION("No SAS token") {
735-
sas_token = "";
736-
expected_endpoint = "https://devstoreaccount1.blob.core.windows.net";
734+
"https://exampleaccount.blob.core.windows.net?baz=qux&foo=bar";
737735
}
738736
Config config;
739737
require_tiledb_ok(
740-
config.set("vfs.azure.storage_account_name", "devstoreaccount1"));
738+
config.set("vfs.azure.storage_account_name", "exampleaccount"));
741739
require_tiledb_ok(config.set("vfs.azure.blob_endpoint", custom_endpoint));
742740
require_tiledb_ok(config.set("vfs.azure.storage_sas_token", sas_token));
741+
if (sas_token.empty()) {
742+
// If the SAS token is empty, the VFS will try to connect to Microsoft Entra
743+
// ID to obtain credentials, which can take a long time because of retries.
744+
// Set a dummy access key (which won't be used because we are not going to
745+
// perform any requests) to prevent Entra ID from being chosen.
746+
require_tiledb_ok(config.set("vfs.azure.storage_account_key", "foobar"));
747+
}
743748
tiledb::sm::Azure azure;
744749
ThreadPool thread_pool(1);
745750
require_tiledb_ok(azure.init(config, &thread_pool));

0 commit comments

Comments
 (0)