diff --git a/sdk/tables/assets.json b/sdk/tables/assets.json index 8fff7edc4..d2c3b4fe9 100644 --- a/sdk/tables/assets.json +++ b/sdk/tables/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/tables", - "Tag": "cpp/tables_4152f4d311" + "Tag": "cpp/tables_7a2150038f" } diff --git a/sdk/tables/azure-data-tables/test/ut/table_client_test.cpp b/sdk/tables/azure-data-tables/test/ut/table_client_test.cpp index 3e3a22095..a91f7e0f5 100644 --- a/sdk/tables/azure-data-tables/test/ut/table_client_test.cpp +++ b/sdk/tables/azure-data-tables/test/ut/table_client_test.cpp @@ -159,7 +159,7 @@ namespace Azure { namespace Data { namespace Test { } } - TEST_P(TablesClientTest, GetAccessPolicy_LIVEONLY_) + TEST_P(TablesClientTest, GetAccessPolicy) { if (GetParam() != AuthType::ConnectionString) { @@ -172,7 +172,7 @@ namespace Azure { namespace Data { namespace Test { EXPECT_EQ(getResponse.Value.SignedIdentifiers.size(), 0); } - TEST_P(TablesClientTest, SetAccessPolicy_LIVEONLY_) + TEST_P(TablesClientTest, SetAccessPolicy) { if (GetParam() != AuthType::ConnectionString) { @@ -210,27 +210,20 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, ListTables) { - if (GetParam() == AuthType::ConnectionString) + auto createResponse = m_tableServiceClient->CreateTable(m_tableName); + + Azure::Data::Tables::Models::QueryTablesOptions listOptions; + + auto listResponse = m_tableServiceClient->QueryTables(listOptions); + + for (auto table : listResponse.Tables) { - EXPECT_TRUE(true); - } - else - { - auto createResponse = m_tableServiceClient->CreateTable(m_tableName); - - Azure::Data::Tables::Models::QueryTablesOptions listOptions; - - auto listResponse = m_tableServiceClient->QueryTables(listOptions); - - for (auto table : listResponse.Tables) + if (table.TableName == m_tableName) { - if (table.TableName == m_tableName) - { - EXPECT_EQ(table.TableName, m_tableName); - EXPECT_EQ(table.EditLink, "Tables('" + m_tableName + "')"); - EXPECT_TRUE(table.Type.find(".Tables") != std::string::npos); - EXPECT_TRUE(table.Id.find(m_tableName) != std::string::npos); - } + EXPECT_EQ(table.TableName, m_tableName); + EXPECT_EQ(table.EditLink, "Tables('" + m_tableName + "')"); + EXPECT_TRUE(table.Type.find(".Tables") != std::string::npos); + EXPECT_TRUE(table.Id.find(m_tableName) != std::string::npos); } } } @@ -262,27 +255,20 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, ServiceClientGetProperties) { - if (GetParam() == AuthType::ConnectionString) - { - EXPECT_TRUE(true); - } - else - { - auto response = m_tableServiceClient->GetServiceProperties(); - EXPECT_EQ(response.Value.Logging.RetentionPolicyDefinition.IsEnabled, false); - EXPECT_EQ(response.Value.Logging.Version, "1.0"); - EXPECT_EQ(response.Value.Logging.Delete, false); - EXPECT_EQ(response.Value.HourMetrics.RetentionPolicyDefinition.IsEnabled, true); - EXPECT_EQ(response.Value.HourMetrics.Version, "1.0"); - EXPECT_EQ(response.Value.HourMetrics.IsEnabled, true); - EXPECT_EQ(response.Value.HourMetrics.IncludeApis.Value(), true); - EXPECT_EQ(response.Value.MinuteMetrics.RetentionPolicyDefinition.IsEnabled, false); - EXPECT_EQ(response.Value.MinuteMetrics.Version, "1.0"); - EXPECT_EQ(response.Value.MinuteMetrics.IsEnabled, false); - } + auto response = m_tableServiceClient->GetServiceProperties(); + EXPECT_EQ(response.Value.Logging.RetentionPolicyDefinition.IsEnabled, false); + EXPECT_EQ(response.Value.Logging.Version, "1.0"); + EXPECT_EQ(response.Value.Logging.Delete, false); + EXPECT_EQ(response.Value.HourMetrics.RetentionPolicyDefinition.IsEnabled, true); + EXPECT_EQ(response.Value.HourMetrics.Version, "1.0"); + EXPECT_EQ(response.Value.HourMetrics.IsEnabled, true); + EXPECT_EQ(response.Value.HourMetrics.IncludeApis.Value(), true); + EXPECT_EQ(response.Value.MinuteMetrics.RetentionPolicyDefinition.IsEnabled, false); + EXPECT_EQ(response.Value.MinuteMetrics.Version, "1.0"); + EXPECT_EQ(response.Value.MinuteMetrics.IsEnabled, false); } - TEST_P(TablesClientTest, ServiceClientSet_LIVEONLY_) + TEST_P(TablesClientTest, ServiceClientSet) { auto response = m_tableServiceClient->GetServiceProperties(); @@ -292,7 +278,7 @@ namespace Azure { namespace Data { namespace Test { EXPECT_EQ(response2.RawResponse->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Accepted); } - TEST_P(TablesClientTest, ServiceClientStatistics_LIVEONLY_) + TEST_P(TablesClientTest, ServiceClientStatistics) { auto response = m_tableServiceClient->GetStatistics(); @@ -302,11 +288,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityCreate) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -322,11 +303,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityCreateFail) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -355,11 +331,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityUpdate) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -389,11 +360,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityMerge) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -423,11 +389,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityDelete) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -458,11 +419,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityDeleteFail) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -482,11 +438,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityUpsert) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -521,11 +472,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityQuery) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -562,11 +508,6 @@ namespace Azure { namespace Data { namespace Test { TEST_P(TablesClientTest, EntityGet) { - if (GetParam() == AuthType::Key) - { - EXPECT_TRUE(true); - return; - } Azure::Data::Tables::Models::TableEntity entity; entity.SetPartitionKey("P1"); @@ -613,9 +554,9 @@ namespace Azure { namespace Data { namespace Test { } } - TEST_P(TablesClientTest, TransactionCreateFail_LIVEONLY_) + TEST_P(TablesClientTest, TransactionCreateFail) { - if (GetParam() == AuthType::SAS) + if (GetParam() != AuthType::ConnectionString) { SkipTest(); return; @@ -643,13 +584,14 @@ namespace Azure { namespace Data { namespace Test { EXPECT_TRUE(response.Value.Error.HasValue()); } - TEST_P(TablesClientTest, TransactionCreateOK_LIVEONLY_) + TEST_P(TablesClientTest, TransactionCreateOK) { if (GetParam() != AuthType::ConnectionString) { SkipTest(); return; } + Azure::Data::Tables::Models::TableEntity entity; Azure::Data::Tables::Models::TableEntity entity2; entity.SetPartitionKey("P1"); @@ -673,13 +615,14 @@ namespace Azure { namespace Data { namespace Test { EXPECT_FALSE(response.Value.Error.HasValue()); } - TEST_P(TablesClientTest, TransactionDelete_LIVEONLY_) + TEST_P(TablesClientTest, TransactionDelete) { if (GetParam() != AuthType::ConnectionString) { SkipTest(); return; } + Azure::Data::Tables::Models::TableEntity entity; Azure::Data::Tables::Models::TableEntity entity2; entity.SetPartitionKey("P1"); @@ -710,13 +653,14 @@ namespace Azure { namespace Data { namespace Test { EXPECT_FALSE(response.Value.Error.HasValue()); } - TEST_P(TablesClientTest, TransactionMerge_LIVEONLY_) + TEST_P(TablesClientTest, TransactionMerge) { if (GetParam() != AuthType::ConnectionString) { SkipTest(); return; } + Azure::Data::Tables::Models::TableEntity entity; Azure::Data::Tables::Models::TableEntity entity2; entity.SetPartitionKey("P1"); @@ -745,13 +689,14 @@ namespace Azure { namespace Data { namespace Test { EXPECT_FALSE(response.Value.Error.HasValue()); } - TEST_P(TablesClientTest, TransactionUpdate_LIVEONLY_) + TEST_P(TablesClientTest, TransactionUpdate) { if (GetParam() != AuthType::ConnectionString) { SkipTest(); return; } + Azure::Data::Tables::Models::TableEntity entity; Azure::Data::Tables::Models::TableEntity entity2; entity.SetPartitionKey("P1"); @@ -785,13 +730,13 @@ namespace Azure { namespace Data { namespace Test { switch (info.param) { case AuthType::ConnectionString: - stringValue = "connectionstring"; + stringValue = "connectionstring_LIVEONLY_"; break; case AuthType::Key: stringValue = "key"; break; case AuthType::SAS: - stringValue = "sas"; + stringValue = "sas_LIVEONLY_"; break; default: stringValue = "key"; diff --git a/sdk/tables/test-resources-post.ps1 b/sdk/tables/test-resources-post.ps1 index fe44bfe6a..98f5a2589 100644 --- a/sdk/tables/test-resources-post.ps1 +++ b/sdk/tables/test-resources-post.ps1 @@ -8,10 +8,6 @@ param( New-AzStorageEncryptionScope -ResourceGroupName $ResourceGroupName -StorageAccountName $DeploymentOutputs['ACCOUNT_NAME'] -EncryptionScopeName "EncryptionScopeForTest" -StorageEncryption -New-AzStorageEncryptionScope -ResourceGroupName $ResourceGroupName -StorageAccountName $DeploymentOutputs['DATALAKE_ACCOUNT_NAME'] -EncryptionScopeName "EncryptionScopeForTest" -StorageEncryption - -Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName $ResourceGroupName -StorageAccountName $DeploymentOutputs['DATALAKE_ACCOUNT_NAME'] -RetentionDays 7 - Enable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName $ResourceGroupName -StorageAccountName $DeploymentOutputs['ACCOUNT_NAME'] -PassThru # This script is used to wait until XCache is refreshed for the service properties (30s), and role assignment takes effect (300s). diff --git a/sdk/tables/test-resources.json b/sdk/tables/test-resources.json index a1aa42f36..abf9292d6 100644 --- a/sdk/tables/test-resources.json +++ b/sdk/tables/test-resources.json @@ -43,10 +43,7 @@ "storageApiVersion": "2022-05-01", "location": "[resourceGroup().location]", "accountName": "[parameters('baseName')]", - "datalakeAccountName": "[concat('d', parameters('baseName'))]", "accountNameTidy": "[toLower(trim(variables('accountName')))]", - "datalakeaccountNameTidy": "[toLower(trim(variables('datalakeAccountName')))]", - "blobEndPoint": "[concat('https://',variables('accountNameTidy'),'.blob.', parameters('storageEndpointSuffix'))]", "accountSasProperties": { "signedServices": "bfqt", "signedPermission": "rwdlacup", @@ -55,30 +52,27 @@ "signedExpiry": "2099-01-01T23:59:00Z" }, "authorizationApiVersion": "2018-01-01-preview", - "blobDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe')]", - "blobDataOwnerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/b7e6dc6d-f1e8-4753-8033-0f276bb0955b')]", - "premiumFileAccountName": "[concat(parameters('baseName'), 'pfile')]" + "tablesDataContributorRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')]", + "tablesDataReaderRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/76199698-9eea-4c19-bc75-cec21354c6b6')]" }, "resources": [ { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[guid(concat('blobDataContributorRoleId', variables('accountName')))]", - "dependsOn": [ - "[variables('accountName')]" - ], + "name": "[guid(concat('tablesDataContributorRoleId', variables('accountName')))]", + "dependsOn": [ "[variables('accountName')]" ], "properties": { - "roleDefinitionId": "[variables('blobDataContributorRoleId')]", + "roleDefinitionId": "[variables('tablesDataContributorRoleId')]", "principalId": "[parameters('testApplicationOid')]" } }, { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "[variables('authorizationApiVersion')]", - "name": "[guid(concat('blobDataOwnerRoleId', variables('accountName')))]", + "name": "[guid(concat('tablesDataReaderRoleId', variables('accountName')))]", "dependsOn": [ "[variables('accountName')]" ], "properties": { - "roleDefinitionId": "[variables('blobDataOwnerRoleId')]", + "roleDefinitionId": "[variables('tablesDataReaderRoleId')]", "principalId": "[parameters('testApplicationOid')]" } }, @@ -122,172 +116,11 @@ }, { "name": "[concat(variables('accountName'), '/default')]", - "type": "microsoft.storage/storageaccounts/blobServices", - "apiVersion": "2019-06-01", - "properties": { - "restorePolicy": { - "enabled": true, - "days": 6 - }, - "deleteRetentionPolicy": { - "enabled": true, - "days": 7 - }, - "containerDeleteRetentionPolicy": { - "enabled": true, - "days": 7 - }, - "changeFeed": { - "enabled": true - }, - "isVersioningEnabled": true, - "cors": { - "corsRules": [ - { - "allowedOrigins": [ "*" ], - "allowedMethods": [ - "DELETE", - "GET", - "HEAD", - "MERGE", - "POST", - "OPTIONS", - "PUT", - "PATCH" - ], - "maxAgeInSeconds": 86400, - "exposedHeaders": [ "*" ], - "allowedHeaders": [ "*" ] - } - ] - } - }, + "type": "microsoft.storage/storageaccounts/tableServices", + "apiVersion": "2023-01-01", "dependsOn": [ "[concat('microsoft.storage/storageaccounts/', variables('accountName'))]" ] - }, - { - "name": "[concat(variables('accountName'), '/default')]", - "type": "microsoft.storage/storageaccounts/fileservices", - "apiVersion": "2019-06-01", - "properties": { - "shareDeleteRetentionPolicy": { - "enabled": true, - "days": 7 - }, - "cors": { - "corsRules": [ - { - "allowedOrigins": [ "*" ], - "allowedMethods": [ "DELETE", "GET", "HEAD", "MERGE", "POST", "OPTIONS", "PUT" ], - "maxAgeInSeconds": 86400, - "exposedHeaders": [ "*" ], - "allowedHeaders": [ "*" ] - } - ] - } - }, - "dependsOn": [ - "[concat('microsoft.storage/storageaccounts/', variables('accountName'))]" - ] - }, - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('datalakeAccountName')]", - "location": "[variables('location')]", - "sku": { - "name": "Standard_RAGRS", - "tier": "Standard" - }, - "kind": "StorageV2", - "properties": { - "isHnsEnabled": true, - "cors": { - "corsRules": [ - { - "allowedOrigins": [ - "*" - ], - "allowedMethods": [ - "DELETE", - "GET", - "HEAD", - "MERGE", - "POST", - "OPTIONS", - "PUT", - "PATCH" - ], - "maxAgeInSeconds": 86400, - "exposedHeaders": [ - "*" - ], - "allowedHeaders": [ - "*" - ] - } - ] - }, - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [ - ], - "ipRules": [ - ], - "defaultAction": "Allow" - }, - "supportsHttpsTrafficOnly": true, - "allowBlobPublicAccess": true, - "encryption": { - "services": { - "file": { - "enabled": true - }, - "blob": { - "enabled": true - } - }, - "keySource": "Microsoft.Storage" - }, - "accessTier": "Hot", - "minimumTlsVersion": "TLS1_2" - } - }, - { - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "[variables('storageApiVersion')]", - "name": "[variables('premiumFileAccountName')]", - "location": "[variables('location')]", - "sku": { - "name": "Premium_LRS", - "tier": "Premium" - }, - "kind": "FileStorage", - "properties": { - "networkAcls": { - "bypass": "AzureServices", - "virtualNetworkRules": [ - ], - "ipRules": [ - ], - "defaultAction": "Allow" - }, - "supportsHttpsTrafficOnly": true, - "encryption": { - "services": { - "file": { - "enabled": true - }, - "blob": { - "enabled": true - } - }, - "keySource": "Microsoft.Storage" - }, - "accessTier": "Hot", - "minimumTlsVersion": "TLS1_2" - } } ], "outputs": { @@ -303,10 +136,6 @@ "type": "string", "value": "[variables('accountName')]" }, - "DATALAKE_ACCOUNT_NAME": { - "type": "string", - "value": "[variables('datalakeAccountName')]" - }, "ACCOUNT_KEY": { "type": "string", "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('accountName')), variables('storageApiVersion')).keys[0].value]" @@ -323,19 +152,7 @@ "type": "string", "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('accountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('accountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" }, - "ADLS_GEN2_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('dataLakeAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('dataLakeAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, - "AZURE_STORAGE_DATALAKE_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('dataLakeAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('dataLakeAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, - "PREMIUM_FILE_CONNECTION_STRING": { - "type": "string", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('premiumFileAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('premiumFileAccountName')), variables('storageApiVersion')).keys[0].value, ';EndpointSuffix=', parameters('storageEndpointSuffix'))]" - }, - "AAD_TENANT_ID": { + "AAD_TENANT_ID": { "type": "string", "value": "[parameters('tenantId')]" },