From a0c90d2c75c9273d5d9ab1e02bdc99ac595337cc Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 9 May 2022 12:38:48 -0700 Subject: [PATCH 01/65] tests pass --- .../test/ut/key_client_base_test.hpp | 2 + .../test/ut/key_client_create_test_live.cpp | 13 +++++- .../test/ut/key_rotation_policy_test_live.cpp | 2 +- .../KeyVaultKeyClient.CreateEcHsmKey.json | 45 +++++++++---------- .../KeyVaultKeyClient.CreateRsaHsmKey.json | 45 +++++++++---------- .../KeyVaultKeyClient.GetRandomBytes.json | 8 ++-- 6 files changed, 60 insertions(+), 55 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp index 59998d3668..4ca8ad9f58 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp @@ -54,6 +54,8 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam // Create virtual void SetUp() override { + _putenv_s("AZURE_KEYVAULT_HSM_URL", "https://gearamamhsm.managedhsm.azure.net/"); + _putenv_s("AZURE_TEST_MODE", "PLAYBACK"); Azure::Core::Test::TestBase::SetUpTestBase(AZURE_TEST_RECORDING_DIR); m_keyVaultUrl = GetEnv("AZURE_KEYVAULT_URL"); m_keyVaultHsmUrl = GetEnv("AZURE_KEYVAULT_HSM_URL"); diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp index 06933a3f32..9367a2b94d 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp @@ -188,10 +188,13 @@ TEST_F(KeyVaultKeyClient, CreateEcHsmKey) { auto ecHsmKey = Azure::Security::KeyVault::Keys::CreateEcKeyOptions(keyName, true); + ecHsmKey.Enabled=true; + ecHsmKey.KeyOperations = {KeyOperation::Sign}; auto keyResponse = client.CreateEcKey(ecHsmKey); CheckValidResponse(keyResponse); auto keyVaultKey = keyResponse.Value; EXPECT_EQ(keyVaultKey.Name(), keyName); + EXPECT_TRUE(keyVaultKey.Properties.Enabled.Value()); } { // Now get the key @@ -199,8 +202,10 @@ TEST_F(KeyVaultKeyClient, CreateEcHsmKey) CheckValidResponse(keyResponse); auto keyVaultKey = keyResponse.Value; EXPECT_EQ(keyVaultKey.Name(), keyName); - EXPECT_FALSE(keyResponse.Value.Properties.Exportable.HasValue()); + EXPECT_TRUE(keyResponse.Value.Properties.Exportable.HasValue()); + EXPECT_FALSE(keyResponse.Value.Properties.Exportable.Value()); EXPECT_FALSE(keyResponse.Value.Properties.ReleasePolicy.HasValue()); + EXPECT_TRUE(keyVaultKey.Properties.Enabled.Value()); } } @@ -213,6 +218,8 @@ TEST_F(KeyVaultKeyClient, CreateRsaHsmKey) { auto rsaHsmKey = Azure::Security::KeyVault::Keys::CreateRsaKeyOptions(keyName, true); + rsaHsmKey.Enabled = true; + rsaHsmKey.KeyOperations = {KeyOperation::Sign}; auto keyResponse = client.CreateRsaKey(rsaHsmKey); CheckValidResponse(keyResponse); auto keyVaultKey = keyResponse.Value; @@ -224,8 +231,10 @@ TEST_F(KeyVaultKeyClient, CreateRsaHsmKey) CheckValidResponse(keyResponse); auto keyVaultKey = keyResponse.Value; EXPECT_EQ(keyVaultKey.Name(), keyName); - EXPECT_FALSE(keyResponse.Value.Properties.Exportable.HasValue()); + EXPECT_TRUE(keyResponse.Value.Properties.Exportable.HasValue()); + EXPECT_FALSE(keyResponse.Value.Properties.Exportable.Value()); EXPECT_FALSE(keyResponse.Value.Properties.ReleasePolicy.HasValue()); + EXPECT_TRUE(keyVaultKey.Properties.Enabled.Value()); } } TEST_F(KeyVaultKeyClient, CreateKeyWithReleasePolicyOptions) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp index a7ff1235c4..da5230ddd6 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp @@ -81,7 +81,7 @@ TEST_F(KeyVaultKeyClient, GetKeyRotationPolicy) } } -TEST_F(KeyVaultKeyClient, DISABLED_GetRandomBytes) +TEST_F(KeyVaultKeyClient, GetRandomBytes) { // NEED TO DISABLE TEST FOR THE MOMENT. // DUE TO ISSUE WITH CREATE EC HSM TEST WHICH FAILS WITH ACTUAL HSM BEING SET IN THE ENVIRONMENT // VARIABLE FILED BUG 3563 TO FIX IT diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.CreateEcHsmKey.json b/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.CreateEcHsmKey.json index 6b2187337a..b1e3a09717 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.CreateEcHsmKey.json +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.CreateEcHsmKey.json @@ -4,54 +4,51 @@ "Headers": { "content-type": "application/json", "user-agent": "azsdk-cpp-keyvault-keys/4.3.0-beta.1 (Windows 10 Enterprise 6.3 22000 22000.1.amd64fre.co_release.210604-1628)", - "x-ms-client-request-id": "c2f708f9-421f-4b9f-5e6f-9cb976fdf9aa" + "x-ms-client-request-id": "03277438-b825-4d0e-6bff-0726da4ca1e0" }, "Method": "POST", "Response": { - "BODY": "{\"key\":{\"kid\":\"https://REDACTED.vault.azure.net/keys/CreateEcHsmKey/bf168ef89e874495b30cfbe36ed84b2c\",\"kty\":\"EC-HSM\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256\",\"x\":\"5gxakUninQnV905zeNXrHmlveKKPqG1VTGwfALjxotE\",\"y\":\"G83nn5f2IDBzj9MlIVKq7xrJZ7jVTuGJKnhynl2zAnk\"},\"attributes\":{\"enabled\":true,\"created\":1651169961,\"updated\":1651169961,\"recoveryLevel\":\"Recoverable+Purgeable\",\"recoverableDays\":90}}", + "BODY": "{\"attributes\":{\"created\":1652124867,\"enabled\":true,\"exportable\":false,\"recoverableDays\":7,\"recoveryLevel\":\"CustomizedRecoverable+Purgeable\",\"updated\":1652124867},\"key\":{\"crv\":\"P-256\",\"key_ops\":[\"sign\"],\"kid\":\"https://REDACTED.managedhsm.azure.net/keys/CreateEcHsmKey/35e07b4fbcdd0260137ee5100b599ff8\",\"kty\":\"EC-HSM\",\"x\":\"kPFWxfwG14icL_Xhy0YB_mlVUgbuxQgS_c9xVlNd-vk\",\"y\":\"G1T3lEneG7ZyQi0gxYJU5ezJt9u8DtKyhJYqxyg78X0\"}}", "REASON_PHRASE": "OK", "STATUS_CODE": "200", "cache-control": "no-cache", - "content-length": "395", + "content-length": "420", + "content-security-policy": "default-src 'self'", "content-type": "application/json; charset=utf-8", - "date": "Thu, 28 Apr 2022 18:19:23 GMT", - "expires": "-1", - "pragma": "no-cache", - "strict-transport-security": "max-age=31536000;includeSubDomains", + "strict-transport-security": "max-age=31536000; includeSubDomains", "x-content-type-options": "nosniff", - "x-ms-client-request-id": "c2f708f9-421f-4b9f-5e6f-9cb976fdf9aa", - "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=InterNetwork;", + "x-frame-options": "SAMEORIGIN", + "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=Ipv4;", "x-ms-keyvault-region": "westus3", - "x-ms-keyvault-service-version": "1.9.378.1", - "x-ms-request-id": "ffa2749b-f8de-4826-a0d1-2c60fbb65d09" + "x-ms-request-id": "09f1ca3e-cfcf-11ec-818f-6045bd86d60f", + "x-ms-server-latency": "401" }, - "Url": "https://REDACTED.vault.azure.net/keys/CreateEcHsmKey/create?api-version=7.3" + "Url": "https://REDACTED.managedhsm.azure.net/keys/CreateEcHsmKey/create?api-version=7.3" }, { "Headers": { "user-agent": "azsdk-cpp-keyvault-keys/4.3.0-beta.1 (Windows 10 Enterprise 6.3 22000 22000.1.amd64fre.co_release.210604-1628)", - "x-ms-client-request-id": "5c1329c6-8796-4931-6794-eb905cb865d6" + "x-ms-client-request-id": "dd6d2b02-8254-40f1-48fb-e214b8f7991b" }, "Method": "GET", "Response": { - "BODY": "{\"key\":{\"kid\":\"https://REDACTED.vault.azure.net/keys/CreateEcHsmKey/bf168ef89e874495b30cfbe36ed84b2c\",\"kty\":\"EC-HSM\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256\",\"x\":\"5gxakUninQnV905zeNXrHmlveKKPqG1VTGwfALjxotE\",\"y\":\"G83nn5f2IDBzj9MlIVKq7xrJZ7jVTuGJKnhynl2zAnk\"},\"attributes\":{\"enabled\":true,\"created\":1651169961,\"updated\":1651169961,\"recoveryLevel\":\"Recoverable+Purgeable\",\"recoverableDays\":90}}", + "BODY": "{\"attributes\":{\"created\":1652124867,\"enabled\":true,\"exportable\":false,\"recoverableDays\":7,\"recoveryLevel\":\"CustomizedRecoverable+Purgeable\",\"updated\":1652124867},\"key\":{\"crv\":\"P-256\",\"key_ops\":[\"sign\"],\"kid\":\"https://REDACTED.managedhsm.azure.net/keys/CreateEcHsmKey/35e07b4fbcdd0260137ee5100b599ff8\",\"kty\":\"EC-HSM\",\"x\":\"kPFWxfwG14icL_Xhy0YB_mlVUgbuxQgS_c9xVlNd-vk\",\"y\":\"G1T3lEneG7ZyQi0gxYJU5ezJt9u8DtKyhJYqxyg78X0\"}}", "REASON_PHRASE": "OK", "STATUS_CODE": "200", "cache-control": "no-cache", - "content-length": "395", + "content-length": "420", + "content-security-policy": "default-src 'self'", "content-type": "application/json; charset=utf-8", - "date": "Thu, 28 Apr 2022 18:19:23 GMT", - "expires": "-1", - "pragma": "no-cache", - "strict-transport-security": "max-age=31536000;includeSubDomains", + "strict-transport-security": "max-age=31536000; includeSubDomains", "x-content-type-options": "nosniff", - "x-ms-client-request-id": "5c1329c6-8796-4931-6794-eb905cb865d6", - "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=InterNetwork;", + "x-frame-options": "SAMEORIGIN", + "x-ms-build-version": "1.0.20220503-3-e1430fa9-1.0.20220430-1-f02155ab-pre-openssl", + "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=Ipv4;", "x-ms-keyvault-region": "westus3", - "x-ms-keyvault-service-version": "1.9.378.1", - "x-ms-request-id": "237db785-85f7-480b-9015-a48dd29b3363" + "x-ms-request-id": "0a375036-cfcf-11ec-818f-6045bd86d60f", + "x-ms-server-latency": "98" }, - "Url": "https://REDACTED.vault.azure.net/keys/CreateEcHsmKey?api-version=7.3" + "Url": "https://REDACTED.managedhsm.azure.net/keys/CreateEcHsmKey?api-version=7.3" } ] } diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.CreateRsaHsmKey.json b/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.CreateRsaHsmKey.json index bd8fcd43b4..60a6f37ae5 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.CreateRsaHsmKey.json +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.CreateRsaHsmKey.json @@ -4,54 +4,51 @@ "Headers": { "content-type": "application/json", "user-agent": "azsdk-cpp-keyvault-keys/4.3.0-beta.1 (Windows 10 Enterprise 6.3 22000 22000.1.amd64fre.co_release.210604-1628)", - "x-ms-client-request-id": "4253488d-717b-4589-66dc-6d54c160aef9" + "x-ms-client-request-id": "1ea49abe-f092-4bfe-4fc8-81ba88de736c" }, "Method": "POST", "Response": { - "BODY": "{\"key\":{\"kid\":\"https://REDACTED.vault.azure.net/keys/CreateRsaHsmKey/095403ac2710405593272cf4d7f906ec\",\"kty\":\"RSA-HSM\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"sKKm0idUFMK-WJX1NhfQanxlVy07gRLHJNaIDa06jm9iX48Gm1UbIYZItO2Ln888JaZzuNzCf4DD8yKzkgaykiHHLgMIbGVZOieZaMBcTFujXaLKQt1KYsNT2mjhh9rTNH-RiMzjDniZwkwMcOylJqkRFw2f203Y-RRQXKJIb6Bm779dLWmS6lp3j923GEihMBIb1DRaC2go_IP_tCQGoMbLEEEDh4kBj75viTaGKxcwSXfWbHhtRJRyLIgu4cjwnZ1X0iwOYicXv6vu7usCNrBJvyXMXnyvEaiO26kBE1mRaZ3JzugCpiPYj-FuGpJXK4AgiDn2il8KNJFsFBORTw\",\"e\":\"AAEAAQ\"},\"attributes\":{\"enabled\":true,\"created\":1651169926,\"updated\":1651169926,\"recoveryLevel\":\"Recoverable+Purgeable\",\"recoverableDays\":90}}", + "BODY": "{\"attributes\":{\"created\":1652124859,\"enabled\":true,\"exportable\":false,\"recoverableDays\":7,\"recoveryLevel\":\"CustomizedRecoverable+Purgeable\",\"updated\":1652124859},\"key\":{\"e\":\"AQAB\",\"key_ops\":[\"sign\"],\"kid\":\"https://REDACTED.managedhsm.azure.net/keys/CreateRsaHsmKey/0a21749b0bda05ad03d7847f7e99fc3f\",\"kty\":\"RSA-HSM\",\"n\":\"jjyunHjWkDTNGYhYiKtUJCjhEpP6PZFpV4qSiCUoLJILg4D53vScrEmqpKQ7viYO16z-_e6bEeePrwA-pR4S1ZNl-Wyk2m1lCFw-DYKh8oV9RSt024O704cwwjAyKpXAhFwQJ8shtfZGoetIx-B_NnmaDAEG8wwHHJeKbX-OExGF22EBbxLlX5ssfmvlzyZPCxf4fkhEFg617OUP12dtrgssPB1daznXG_OxK5gjrjYOPMC0ev6Z3W91f7sTGUyuI5-QlCctPGr7ylmRQQoYCxqvKRaPrELRPdG8XEVfJBNpJJF2jKeEID_4Jwjwuf3Y8YjX3_H_ZlMUyhZouxZrsQ\"}}", "REASON_PHRASE": "OK", "STATUS_CODE": "200", "cache-control": "no-cache", - "content-length": "687", + "content-length": "668", + "content-security-policy": "default-src 'self'", "content-type": "application/json; charset=utf-8", - "date": "Thu, 28 Apr 2022 18:18:45 GMT", - "expires": "-1", - "pragma": "no-cache", - "strict-transport-security": "max-age=31536000;includeSubDomains", + "strict-transport-security": "max-age=31536000; includeSubDomains", "x-content-type-options": "nosniff", - "x-ms-client-request-id": "4253488d-717b-4589-66dc-6d54c160aef9", - "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=InterNetwork;", + "x-frame-options": "SAMEORIGIN", + "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=Ipv4;", "x-ms-keyvault-region": "westus3", - "x-ms-keyvault-service-version": "1.9.378.1", - "x-ms-request-id": "e9d3787d-eb96-46db-8a53-5cf57cc5cc4a" + "x-ms-request-id": "04fb4e56-cfcf-11ec-8d22-6045bd86d5ca", + "x-ms-server-latency": "361" }, - "Url": "https://REDACTED.vault.azure.net/keys/CreateRsaHsmKey/create?api-version=7.3" + "Url": "https://REDACTED.managedhsm.azure.net/keys/CreateRsaHsmKey/create?api-version=7.3" }, { "Headers": { "user-agent": "azsdk-cpp-keyvault-keys/4.3.0-beta.1 (Windows 10 Enterprise 6.3 22000 22000.1.amd64fre.co_release.210604-1628)", - "x-ms-client-request-id": "315f7a30-4f35-485b-59db-9383f85ad08c" + "x-ms-client-request-id": "666f33b2-35fe-49ca-40ad-a2fc0dc9de38" }, "Method": "GET", "Response": { - "BODY": "{\"key\":{\"kid\":\"https://REDACTED.vault.azure.net/keys/CreateRsaHsmKey/095403ac2710405593272cf4d7f906ec\",\"kty\":\"RSA-HSM\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"sKKm0idUFMK-WJX1NhfQanxlVy07gRLHJNaIDa06jm9iX48Gm1UbIYZItO2Ln888JaZzuNzCf4DD8yKzkgaykiHHLgMIbGVZOieZaMBcTFujXaLKQt1KYsNT2mjhh9rTNH-RiMzjDniZwkwMcOylJqkRFw2f203Y-RRQXKJIb6Bm779dLWmS6lp3j923GEihMBIb1DRaC2go_IP_tCQGoMbLEEEDh4kBj75viTaGKxcwSXfWbHhtRJRyLIgu4cjwnZ1X0iwOYicXv6vu7usCNrBJvyXMXnyvEaiO26kBE1mRaZ3JzugCpiPYj-FuGpJXK4AgiDn2il8KNJFsFBORTw\",\"e\":\"AAEAAQ\"},\"attributes\":{\"enabled\":true,\"created\":1651169926,\"updated\":1651169926,\"recoveryLevel\":\"Recoverable+Purgeable\",\"recoverableDays\":90}}", + "BODY": "{\"attributes\":{\"created\":1652124859,\"enabled\":true,\"exportable\":false,\"recoverableDays\":7,\"recoveryLevel\":\"CustomizedRecoverable+Purgeable\",\"updated\":1652124859},\"key\":{\"e\":\"AQAB\",\"key_ops\":[\"sign\"],\"kid\":\"https://REDACTED.managedhsm.azure.net/keys/CreateRsaHsmKey/0a21749b0bda05ad03d7847f7e99fc3f\",\"kty\":\"RSA-HSM\",\"n\":\"jjyunHjWkDTNGYhYiKtUJCjhEpP6PZFpV4qSiCUoLJILg4D53vScrEmqpKQ7viYO16z-_e6bEeePrwA-pR4S1ZNl-Wyk2m1lCFw-DYKh8oV9RSt024O704cwwjAyKpXAhFwQJ8shtfZGoetIx-B_NnmaDAEG8wwHHJeKbX-OExGF22EBbxLlX5ssfmvlzyZPCxf4fkhEFg617OUP12dtrgssPB1daznXG_OxK5gjrjYOPMC0ev6Z3W91f7sTGUyuI5-QlCctPGr7ylmRQQoYCxqvKRaPrELRPdG8XEVfJBNpJJF2jKeEID_4Jwjwuf3Y8YjX3_H_ZlMUyhZouxZrsQ\"}}", "REASON_PHRASE": "OK", "STATUS_CODE": "200", "cache-control": "no-cache", - "content-length": "687", + "content-length": "668", + "content-security-policy": "default-src 'self'", "content-type": "application/json; charset=utf-8", - "date": "Thu, 28 Apr 2022 18:18:45 GMT", - "expires": "-1", - "pragma": "no-cache", - "strict-transport-security": "max-age=31536000;includeSubDomains", + "strict-transport-security": "max-age=31536000; includeSubDomains", "x-content-type-options": "nosniff", - "x-ms-client-request-id": "315f7a30-4f35-485b-59db-9383f85ad08c", - "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=InterNetwork;", + "x-frame-options": "SAMEORIGIN", + "x-ms-build-version": "1.0.20220503-3-e1430fa9-1.0.20220430-1-f02155ab-pre-openssl", + "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=Ipv4;", "x-ms-keyvault-region": "westus3", - "x-ms-keyvault-service-version": "1.9.378.1", - "x-ms-request-id": "3ea74b94-d97c-4800-83ba-3c7f66afd6d9" + "x-ms-request-id": "0539f7c8-cfcf-11ec-8d22-6045bd86d5ca", + "x-ms-server-latency": "96" }, - "Url": "https://REDACTED.vault.azure.net/keys/CreateRsaHsmKey?api-version=7.3" + "Url": "https://REDACTED.managedhsm.azure.net/keys/CreateRsaHsmKey?api-version=7.3" } ] } diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.GetRandomBytes.json b/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.GetRandomBytes.json index 2537ff3de9..db7be52063 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.GetRandomBytes.json +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/KeyVaultKeyClient.GetRandomBytes.json @@ -4,11 +4,11 @@ "Headers": { "content-type": "application/json", "user-agent": "azsdk-cpp-keyvault-keys/4.3.0-beta.1 (Windows 10 Enterprise 6.3 22000 22000.1.amd64fre.co_release.210604-1628)", - "x-ms-client-request-id": "62efb9c3-6fe1-4ac9-58b7-6ceb5877ef46" + "x-ms-client-request-id": "23e6a7fd-96c0-4642-7b13-4fe10963a7d1" }, "Method": "POST", "Response": { - "BODY": "{\"value\":\"QkaFtQ\"}", + "BODY": "{\"value\":\"W4Ed2Q\"}", "REASON_PHRASE": "OK", "STATUS_CODE": "200", "cache-control": "no-cache", @@ -20,8 +20,8 @@ "x-frame-options": "SAMEORIGIN", "x-ms-keyvault-network-info": "conn_type=Ipv4;addr=24.22.157.72;act_addr_fam=Ipv4;", "x-ms-keyvault-region": "westus3", - "x-ms-request-id": "e0ed8ab4-bcec-11ec-b7b1-6045bd86d68a", - "x-ms-server-latency": "559" + "x-ms-request-id": "008b910a-cfcf-11ec-bf3e-6045bd7778ea", + "x-ms-server-latency": "3" }, "Url": "https://REDACTED.managedhsm.azure.net//rng?api-version=7.3" } From 3a158e06ce52d090626690bec5ea84927095b35c Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 9 May 2022 12:40:08 -0700 Subject: [PATCH 02/65] oops --- .../test/ut/key_client_base_test.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp index 4ca8ad9f58..59998d3668 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp @@ -54,8 +54,6 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam // Create virtual void SetUp() override { - _putenv_s("AZURE_KEYVAULT_HSM_URL", "https://gearamamhsm.managedhsm.azure.net/"); - _putenv_s("AZURE_TEST_MODE", "PLAYBACK"); Azure::Core::Test::TestBase::SetUpTestBase(AZURE_TEST_RECORDING_DIR); m_keyVaultUrl = GetEnv("AZURE_KEYVAULT_URL"); m_keyVaultHsmUrl = GetEnv("AZURE_KEYVAULT_HSM_URL"); From 6b23e209c6989e5745ec95b4d5180d47188d6aa9 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 9 May 2022 12:59:32 -0700 Subject: [PATCH 03/65] update hsm path --- sdk/keyvault/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index 83598a1e68..78e13304b1 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -56,7 +56,7 @@ stages: - Name: AZURE_KEYVAULT_URL Value: "https://non-real-account.vault.azure.net" - Name: AZURE_KEYVAULT_HSM_URL - Value: "https://non-real-account.vault.azure.net" + Value: "https://non-real-account.managedhsm.azure.net/" # Tenant ID should use the uniqueID format for playback recordings - Name: AZURE_TENANT_ID Value: "33333333-3333-3333-3333-333333333333" From 4670fcc9ad90c58a9f8c91fc212e943019ac9fc2 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 9 May 2022 13:19:53 -0700 Subject: [PATCH 04/65] clang --- .../test/ut/key_client_create_test_live.cpp | 6 +++--- .../test/ut/key_rotation_policy_test_live.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp index 9367a2b94d..15c285e5ab 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp @@ -178,7 +178,7 @@ TEST_F(KeyVaultKeyClient, CreateRsaKey) } // No tests for octKey since the server does not support it. - +// FOR THIS TEST TO WORK MAKE SURE YOU ACTUALLY HAVE A VALID HSM VALUE FOR AZURE_KEYVAULT_HSM_URL TEST_F(KeyVaultKeyClient, CreateEcHsmKey) { auto const keyName = GetTestName(); @@ -188,7 +188,7 @@ TEST_F(KeyVaultKeyClient, CreateEcHsmKey) { auto ecHsmKey = Azure::Security::KeyVault::Keys::CreateEcKeyOptions(keyName, true); - ecHsmKey.Enabled=true; + ecHsmKey.Enabled = true; ecHsmKey.KeyOperations = {KeyOperation::Sign}; auto keyResponse = client.CreateEcKey(ecHsmKey); CheckValidResponse(keyResponse); @@ -208,7 +208,7 @@ TEST_F(KeyVaultKeyClient, CreateEcHsmKey) EXPECT_TRUE(keyVaultKey.Properties.Enabled.Value()); } } - +// FOR THIS TEST TO WORK MAKE SURE YOU ACTUALLY HAVE A VALID HSM VALUE FOR AZURE_KEYVAULT_HSM_URL TEST_F(KeyVaultKeyClient, CreateRsaHsmKey) { auto const keyName = GetTestName(); diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp index da5230ddd6..9aa646b674 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp @@ -80,7 +80,7 @@ TEST_F(KeyVaultKeyClient, GetKeyRotationPolicy) EXPECT_TRUE(found); } } - +// FOR THIS TEST TO WORK MAKE SURE YOU ACTUALLY HAVE A VALID HSM VALUE FOR AZURE_KEYVAULT_HSM_URL TEST_F(KeyVaultKeyClient, GetRandomBytes) { // NEED TO DISABLE TEST FOR THE MOMENT. // DUE TO ISSUE WITH CREATE EC HSM TEST WHICH FAILS WITH ACTUAL HSM BEING SET IN THE ENVIRONMENT From e6862a74568085c1af06445bc7da6e8e27ec047c Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 10 May 2022 11:18:59 -0700 Subject: [PATCH 05/65] update test resources --- .../test-resources-post.ps1 | 112 ++++++++++++++++++ sdk/keyvault/test-resources.json | 66 ++++++++++- 2 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 sdk/keyvault/azure-security-keyvault-keys/test-resources-post.ps1 diff --git a/sdk/keyvault/azure-security-keyvault-keys/test-resources-post.ps1 b/sdk/keyvault/azure-security-keyvault-keys/test-resources-post.ps1 new file mode 100644 index 0000000000..a503cca178 --- /dev/null +++ b/sdk/keyvault/azure-security-keyvault-keys/test-resources-post.ps1 @@ -0,0 +1,112 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# IMPORTANT: Do not invoke this file directly. Please instead run eng/New-TestResources.ps1 from the repository root. + +#Requires -Version 6.0 +#Requires -PSEdition Core + +using namespace System.Security.Cryptography +using namespace System.Security.Cryptography.X509Certificates + +# Use same parameter names as declared in eng/New-TestResources.ps1 (assume validation therein). +[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] +param ( + [Parameter()] + [hashtable] $DeploymentOutputs, + + # Captures any arguments from eng/New-TestResources.ps1 not declared here (no parameter errors). + [Parameter(ValueFromRemainingArguments = $true)] + $RemainingArguments +) + +# By default stop for any error. +if (!$PSBoundParameters.ContainsKey('ErrorAction')) { + $ErrorActionPreference = 'Stop' +} + +function Log($Message) { + Write-Host ('{0} - {1}' -f [DateTime]::Now.ToLongTimeString(), $Message) +} + +function New-X509Certificate2([string] $SubjectName) { + + $rsa = [RSA]::Create(2048) + try { + $req = [CertificateRequest]::new( + [string] $SubjectName, + $rsa, + [HashAlgorithmName]::SHA256, + [RSASignaturePadding]::Pkcs1 + ) + + # TODO: Add any KUs necessary to $req.CertificateExtensions + + $NotBefore = [DateTimeOffset]::Now.AddDays(-1) + $NotAfter = $NotBefore.AddDays(365) + + $req.CreateSelfSigned($NotBefore, $NotAfter) + } + finally { + $rsa.Dispose() + } +} + +function Export-X509Certificate2([string] $Path, [X509Certificate2] $Certificate) { + + $Certificate.Export([X509ContentType]::Pfx) | Set-Content $Path -AsByteStream +} + +function Export-X509Certificate2PEM([string] $Path, [X509Certificate2] $Certificate) { + +@" +-----BEGIN CERTIFICATE----- +$([Convert]::ToBase64String($Certificate.RawData, 'InsertLineBreaks')) +-----END CERTIFICATE----- +"@ > $Path + +} + +# Make sure we deployed a Managed HSM. +if (!$DeploymentOutputs['AZURE_MANAGEDHSM_URL']) { + Log "Managed HSM not deployed; skipping activation" + exit +} + +[Uri] $hsmUrl = $DeploymentOutputs['AZURE_MANAGEDHSM_URL'] +$hsmName = $hsmUrl.Host.Substring(0, $hsmUrl.Host.IndexOf('.')) + +Log 'Creating 3 X509 certificates to activate security domain' +$wrappingFiles = foreach ($i in 0..2) { + $certificate = New-X509Certificate2 "CN=$($hsmUrl.Host)" + + $baseName = "$PSScriptRoot\$hsmName-certificate$i" + Export-X509Certificate2 "$baseName.pfx" $certificate + Export-X509Certificate2PEM "$baseName.cer" $certificate + + Resolve-Path "$baseName.cer" +} + +Log "Downloading security domain from '$hsmUrl'" + +$sdPath = "$PSScriptRoot\$hsmName-security-domain.key" +if (Test-Path $sdpath) { + Log "Deleting old security domain: $sdPath" + Remove-Item $sdPath -Force +} + +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates $wrappingFiles -OutputPath $sdPath + +Log "Security domain downloaded to '$sdPath'; Managed HSM is now active at '$hsmUrl'" + +# Force a sleep to wait for Managed HSM activation to propagate through Cosmos replication. Issue tracked in Azure DevOps. +Log 'Sleeping for 30 seconds to allow activation to propagate...' +Start-Sleep -Seconds 30 + +$testApplicationOid = $DeploymentOutputs['CLIENT_OBJECTID'] + +Log "Creating additional required role assignments for '$testApplicationOid'" +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Officer' -ObjectID $testApplicationOid +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto User' -ObjectID $testApplicationOid + +Log "Role assignments created for '$testApplicationOid'" diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 7727196a6f..26242c4f96 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -104,10 +104,54 @@ "metadata": { "description": "The JsonWebKeyCurveName of the key to be created." } + }, + "provisionerApplicationOid": { + "type": "string", + "metadata": { + "description": "The provisioner OID to grant access to test resources." + } + }, + "enableHsm": { + "type": "bool", + "defaultValue": false, + "metadata": { + "description": "Whether to enable deployment of Managed HSM. The default is false." + } + }, + "hsmLocation": { + "type": "string", + "defaultValue": "eastus2", + "allowedValues": [ + "australiacentral", + "canadacentral", + "centralus", + "eastasia", + "eastus2", + "koreacentral", + "northeurope", + "southafricanorth", + "southcentralus", + "southeastasia", + "switzerlandnorth", + "uksouth", + "westeurope", + "westus" + ], + "metadata": { + "description": "The location of the Managed HSM. By default, this is 'southcentralus'." + } } }, "variables": { - "azureKeyVaultUrl": "[format('https://{0}{1}/', parameters('baseName'), parameters('keyVaultDomainSuffix'))]" + "azureKeyVaultUrl": "[format('https://{0}{1}/', parameters('baseName'), parameters('keyVaultDomainSuffix'))]", + "hsmApiVersion": "2021-04-01-preview", + "hsmName": "[concat(parameters('baseName'), 'hsm')]", + "networkAcls": { + "bypass": "AzureServices", + "virtualNetworkRules": [], + "ipRules": [], + "defaultAction": "Allow" + } }, "resources": [ { @@ -196,6 +240,26 @@ "keySize": "[parameters('keySize')]", "curveName": "[parameters('curveName')]" } + }, + { + "type": "Microsoft.KeyVault/managedHSMs", + "apiVersion": "[variables('hsmApiVersion')]", + "name": "[variables('hsmName')]", + "condition": "[parameters('enableHsm')]", + "location": "[parameters('hsmLocation')]", + "sku": { + "family": "B", + "name": "Standard_B1" + }, + "properties": { + "tenantId": "[parameters('tenantId')]", + "initialAdminObjectIds": "[union(array(parameters('testApplicationOid')), array(parameters('provisionerApplicationOid')))]", + "enablePurgeProtection": false, + "enableSoftDelete": true, + "softDeleteRetentionInDays": 7, + "publicNetworkAccess": "Enabled", + "networkAcls": "[variables('networkAcls')]" + } } ], "outputs": { From b452c75e719a59f6056f3b3da8fadac73bc27ea9 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 10 May 2022 12:22:44 -0700 Subject: [PATCH 06/65] try try again --- .vscode/cspell.json | 1 + .../templates/jobs/archetype-sdk-tests.yml | 1 + .../test-resources-post.ps1 | 4 ++-- sdk/keyvault/test-resources.json | 23 +++++++++++++++---- 4 files changed, 23 insertions(+), 6 deletions(-) rename sdk/keyvault/{azure-security-keyvault-keys => }/test-resources-post.ps1 (97%) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 9074868966..c0fa7d2cfd 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -101,6 +101,7 @@ "sasia", "scus", "SDDL", + "sdpath", "serializers", "Seriot", "southcentralus", diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 4edbe88902..991bd444f0 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -228,6 +228,7 @@ jobs: ServiceDirectory: ${{ parameters.ServiceDirectory }} Location: ${{ parameters.Location }} SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + EnableHsm : true # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest diff --git a/sdk/keyvault/azure-security-keyvault-keys/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 similarity index 97% rename from sdk/keyvault/azure-security-keyvault-keys/test-resources-post.ps1 rename to sdk/keyvault/test-resources-post.ps1 index a503cca178..caa8da390f 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -68,12 +68,12 @@ $([Convert]::ToBase64String($Certificate.RawData, 'InsertLineBreaks')) } # Make sure we deployed a Managed HSM. -if (!$DeploymentOutputs['AZURE_MANAGEDHSM_URL']) { +if (!$DeploymentOutputs['AZURE_ENABLE_HSM']) { Log "Managed HSM not deployed; skipping activation" exit } -[Uri] $hsmUrl = $DeploymentOutputs['AZURE_MANAGEDHSM_URL'] +[Uri] $hsmUrl = $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'] $hsmName = $hsmUrl.Host.Substring(0, $hsmUrl.Host.IndexOf('.')) Log 'Creating 3 X509 certificates to activate security domain' diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 26242c4f96..a6cefc5a2f 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -123,22 +123,33 @@ "defaultValue": "eastus2", "allowedValues": [ "australiacentral", + "australiaeast", "canadacentral", + "canadaeast", + "centralindia", "centralus", "eastasia", + "eastus", "eastus2", + "francecentral", + "japaneast", "koreacentral", + "northcentralus", "northeurope", "southafricanorth", "southcentralus", - "southeastasia", "switzerlandnorth", + "switzerlandwest", + "uaenorth", "uksouth", + "westcentralus", "westeurope", - "westus" + "westus", + "westus2", + "westus3" ], "metadata": { - "description": "The location of the Managed HSM. By default, this is 'southcentralus'." + "description": "The location of the Managed HSM. By default, this is 'eastus2'." } } }, @@ -267,9 +278,13 @@ "type": "string", "value": "[variables('azureKeyVaultUrl')]" }, + "AZURE_ENABLE_HSM": { + "type" "bool", + "value": "[parameters('enableHsm')]" + } "AZURE_KEYVAULT_HSM_URL": { "type": "string", - "value": "[variables('azureKeyVaultUrl')]" + "value": "if([parameters('enableHsm')],[reference(variables('hsmName')).hsmUri],[variables('azureKeyVaultUrl')]" }, "AZURE_TENANT_ID": { "type": "string", From 002bbde7605814ad4423ca213a5337be1a1d413d Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 10 May 2022 13:03:15 -0700 Subject: [PATCH 07/65] try again --- .vscode/cspell.json | 2 ++ sdk/keyvault/test-resources.json | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index c0fa7d2cfd..e1896ac497 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -115,9 +115,11 @@ "unscoped", "unskipped", "UPNs", + "uaenorth", "usgov", "usgoviowa", "usgovvirginia", + "westcentralus", "vcpkg", "Viet", "Viktor", diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index a6cefc5a2f..3e39fca9a3 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -279,9 +279,9 @@ "value": "[variables('azureKeyVaultUrl')]" }, "AZURE_ENABLE_HSM": { - "type" "bool", + "type": "bool", "value": "[parameters('enableHsm')]" - } + }, "AZURE_KEYVAULT_HSM_URL": { "type": "string", "value": "if([parameters('enableHsm')],[reference(variables('hsmName')).hsmUri],[variables('azureKeyVaultUrl')]" From c5b59e20bd40c94be127a451f66dc4d5047947e3 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 10 May 2022 13:05:02 -0700 Subject: [PATCH 08/65] update variable in azure core --- sdk/core/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index bdcdadfa1f..0566b33962 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -52,7 +52,7 @@ stages: - Name: AZURE_KEYVAULT_URL Value: "https://non-real-account.vault.azure.net" - Name: AZURE_KEYVAULT_HSM_URL - Value: "https://non-real-account.vault.azure.net" + Value: "https://non-real-account.managedhsm.azure.net/" # Key Vault & Identity - Name: AZURE_TENANT_ID Value: "33333333-3333-3333-3333-333333333333" From 89f3f9f268f61910b22ff919aece00883c2e4c69 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 11 May 2022 13:06:15 -0700 Subject: [PATCH 09/65] template worx --- .../inc/azure/core/test/test_base.hpp | 25 ++++++++ .../test/ut/certificate_client_base_test.hpp | 8 +++ .../test/ut/key_client_base_test.hpp | 8 +++ .../test/ut/secret_client_base_test.hpp | 8 +++ sdk/keyvault/test-resources.json | 60 +++++++++---------- 5 files changed, 79 insertions(+), 30 deletions(-) diff --git a/sdk/core/azure-core-test/inc/azure/core/test/test_base.hpp b/sdk/core/azure-core-test/inc/azure/core/test/test_base.hpp index 93eb21c4b4..93e4787b68 100644 --- a/sdk/core/azure-core-test/inc/azure/core/test/test_base.hpp +++ b/sdk/core/azure-core-test/inc/azure/core/test/test_base.hpp @@ -175,6 +175,31 @@ namespace Azure { namespace Core { namespace Test { return Azure::Core::_internal::StringExtensions::ToLower(testName); } + /** + * @brief Get test name with suffix if ENV vatiable is set. + * + * @param sanitize Sanize the input and remove special characters. Default true. + * @param suffixEnvName Env variable containing the siffix. Default AZURE_LIVE_TEST_SUFFIX. + * + * @returns Test name. + */ + std::string GetTestNameSuffix( + bool sanitize = true, + std::string suffixEnvName = "AZURE_LIVE_TEST_SUFFIX") + { + std::string baseValue = Azure::Core::Test::TestBase::GetTestName(sanitize); + + std::string suffix + = Azure::Core::_internal::Environment::GetVariable(suffixEnvName.c_str()); + + if (suffix.length() > 0) + { + baseValue = "-" + suffix; + } + + return baseValue; + } + // Creates the sdk client for testing. // The client will be set for record and playback before it is created. Azure::Core::Credentials::TokenCredentialOptions GetTokenCredentialOptions() diff --git a/sdk/keyvault/azure-security-keyvault-certificates/test/ut/certificate_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-certificates/test/ut/certificate_client_base_test.hpp index 599a5270c5..d50a54c627 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/test/ut/certificate_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-certificates/test/ut/certificate_client_base_test.hpp @@ -84,6 +84,14 @@ namespace Azure { } public: + // Reads the current test instance name. + // Name gets also sanitized (special chars are removed) to avoid issues when recording or + // creating. This also return the name with suffix if the "AZURE_LIVE_TEST_SUFFIX" exists. + std::string GetTestName(bool sanitize = true) + { + return Azure::Core::Test::TestBase::GetTestNameSuffix(sanitize); + } + template static inline void CheckValidResponse( Azure::Response& response, diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp index 59998d3668..a69ba09e0c 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp @@ -34,6 +34,14 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam int m_testPollingTimeOutMinutes = 20; std::chrono::milliseconds m_testPollingIntervalMs = std::chrono::minutes(1); + // Reads the current test instance name. + // Name gets also sanitized (special chars are removed) to avoid issues when recording or + // creating. This also return the name with suffix if the "AZURE_LIVE_TEST_SUFFIX" exists. + std::string GetTestName(bool sanitize = true) + { + return Azure::Core::Test::TestBase::GetTestNameSuffix(sanitize); + } + Azure::Security::KeyVault::Keys::KeyClient const& GetClientForTest(std::string const& testName) { // set the interceptor for the current test diff --git a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_client_base_test.hpp index a37bf6ad3b..5a0f30823d 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_client_base_test.hpp @@ -97,6 +97,14 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { std::this_thread::sleep_for(std::chrono::minutes(1)); } } + + // Reads the current test instance name. + // Name gets also sanitized (special chars are removed) to avoid issues when recording or + // creating. This also return the name with suffix if the "AZURE_LIVE_TEST_SUFFIX" exists. + std::string GetTestName(bool sanitize = true) + { + return Azure::Core::Test::TestBase::GetTestNameSuffix(sanitize); + } static inline void RemoveAllSecretsFromVault( SecretClient const& secretClient, diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 3e39fca9a3..71047f3d0e 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -3,123 +3,122 @@ "contentVersion": "1.0.0.0", "parameters": { "baseName": { - "type": "string", "defaultValue": "[resourceGroup().name]", + "type": "String", "metadata": { "description": "The base resource name." } }, "keyName": { - "type": "string", "defaultValue": "testKey", + "type": "String", "metadata": { "description": "The initial key in the keys." } }, "secretName": { - "type": "string", "defaultValue": "testSecret", + "type": "String", "metadata": { "description": "The initial secret in the secrets." } }, "tenantId": { - "type": "string", "defaultValue": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "type": "String", "metadata": { "description": "The tenant ID to which the application and resources belong." } }, "testApplicationId": { - "type": "string", + "type": "String", "metadata": { "description": "The application client ID used to run tests." } }, "testApplicationSecret": { - "type": "string", + "type": "String", "metadata": { "description": "The application client secret used to run tests." } }, "testApplicationOid": { - "type": "string", "defaultValue": "b3653439-8136-4cd5-aac3-2a9460871ca6", + "type": "String", "metadata": { "description": "The client OID to grant access to test resources." } }, "location": { - "type": "string", "defaultValue": "[resourceGroup().location]", + "type": "String", "metadata": { "description": "The location of the resource. By default, this is the same as the resource group." } }, "enableSoftDelete": { - "type": "bool", "defaultValue": true, + "type": "Bool", "metadata": { "description": "Whether to enable soft delete for the Key Vault. The default is true." } }, "keyVaultDomainSuffix": { - "type": "string", "defaultValue": ".vault.azure.net", + "type": "String", "metadata": { "description": "Domain suffix for sovereign clouds, requires the preceeding '.'. The default uses the public Azure Cloud (.vault.azure.net)" } }, "keyVaultSku": { - "type": "string", "defaultValue": "premium", + "type": "String", "metadata": { "description": "Key Vault SKU to deploy. The default is 'premium'" } }, "keyType": { - "type": "string", "defaultValue": "RSA", + "type": "String", "metadata": { "description": "The JsonWebKeyType of the key to be created." } }, "keyOps": { - "type": "array", "defaultValue": [], + "type": "Array", "metadata": { "description": "The permitted JSON web key operations of the key to be created." } }, "keySize": { - "type": "int", "defaultValue": 2048, + "type": "Int", "metadata": { "description": "The size in bits of the key to be created." } }, "curveName": { - "type": "string", "defaultValue": "", + "type": "String", "metadata": { "description": "The JsonWebKeyCurveName of the key to be created." } }, "provisionerApplicationOid": { - "type": "string", + "type": "String", "metadata": { "description": "The provisioner OID to grant access to test resources." } }, "enableHsm": { - "type": "bool", "defaultValue": false, + "type": "Bool", "metadata": { "description": "Whether to enable deployment of Managed HSM. The default is false." } }, "hsmLocation": { - "type": "string", "defaultValue": "eastus2", "allowedValues": [ "australiacentral", @@ -148,6 +147,7 @@ "westus2", "westus3" ], + "type": "String", "metadata": { "description": "The location of the Managed HSM. By default, this is 'eastus2'." } @@ -256,7 +256,6 @@ "type": "Microsoft.KeyVault/managedHSMs", "apiVersion": "[variables('hsmApiVersion')]", "name": "[variables('hsmName')]", - "condition": "[parameters('enableHsm')]", "location": "[parameters('hsmLocation')]", "sku": { "family": "B", @@ -270,41 +269,42 @@ "softDeleteRetentionInDays": 7, "publicNetworkAccess": "Enabled", "networkAcls": "[variables('networkAcls')]" - } + }, + "condition": "[parameters('enableHsm')]" } ], "outputs": { "AZURE_KEYVAULT_URL": { - "type": "string", + "type": "String", "value": "[variables('azureKeyVaultUrl')]" }, "AZURE_ENABLE_HSM": { - "type": "bool", + "type": "Bool", "value": "[parameters('enableHsm')]" }, "AZURE_KEYVAULT_HSM_URL": { - "type": "string", - "value": "if([parameters('enableHsm')],[reference(variables('hsmName')).hsmUri],[variables('azureKeyVaultUrl')]" + "type": "String", + "value": "[if(bool(parameters('enableHsm')),reference(variables('hsmName')).hsmUri,variables('azureKeyVaultUrl'))]" }, "AZURE_TENANT_ID": { - "type": "string", + "type": "String", "value": "[parameters('tenantId')]" }, "AZURE_CLIENT_ID": { - "type": "string", + "type": "String", "value": "[parameters('testApplicationId')]" }, "AZURE_CLIENT_SECRET": { - "type": "string", + "type": "String", "value": "[parameters('testApplicationSecret')]" }, "KEYVAULT_SKU": { - "type": "string", + "type": "String", "value": "[reference(parameters('baseName')).sku.name]" }, "CLIENT_OBJECTID": { - "type": "string", + "type": "String", "value": "[parameters('testApplicationOid')]" } } -} +} \ No newline at end of file From 1f2a90d236976de3b43abf95c73b91bffda39892 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 11 May 2022 16:56:53 -0700 Subject: [PATCH 10/65] clang --- .../inc/azure/core/test/test_base.hpp | 17 ++++++++--------- .../test/ut/secret_client_base_test.hpp | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sdk/core/azure-core-test/inc/azure/core/test/test_base.hpp b/sdk/core/azure-core-test/inc/azure/core/test/test_base.hpp index 93e4787b68..48f910d41b 100644 --- a/sdk/core/azure-core-test/inc/azure/core/test/test_base.hpp +++ b/sdk/core/azure-core-test/inc/azure/core/test/test_base.hpp @@ -176,21 +176,20 @@ namespace Azure { namespace Core { namespace Test { } /** - * @brief Get test name with suffix if ENV vatiable is set. - * - * @param sanitize Sanize the input and remove special characters. Default true. - * @param suffixEnvName Env variable containing the siffix. Default AZURE_LIVE_TEST_SUFFIX. - * - * @returns Test name. - */ + * @brief Get test name with suffix if ENV variable is set. + * + * @param sanitize Sanitize the input and remove special characters. Default true. + * @param suffixEnvName Env variable containing the suffix. Default AZURE_LIVE_TEST_SUFFIX. + * + * @returns Test name. + */ std::string GetTestNameSuffix( bool sanitize = true, std::string suffixEnvName = "AZURE_LIVE_TEST_SUFFIX") { std::string baseValue = Azure::Core::Test::TestBase::GetTestName(sanitize); - std::string suffix - = Azure::Core::_internal::Environment::GetVariable(suffixEnvName.c_str()); + std::string suffix = Azure::Core::_internal::Environment::GetVariable(suffixEnvName.c_str()); if (suffix.length() > 0) { diff --git a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_client_base_test.hpp index 5a0f30823d..b7a6f8361e 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/test/ut/secret_client_base_test.hpp @@ -97,7 +97,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets { std::this_thread::sleep_for(std::chrono::minutes(1)); } } - + // Reads the current test instance name. // Name gets also sanitized (special chars are removed) to avoid issues when recording or // creating. This also return the name with suffix if the "AZURE_LIVE_TEST_SUFFIX" exists. From 6cbb214cf384bc38f28dd5c6f792c99e39f10395 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 10:52:48 -0700 Subject: [PATCH 11/65] try pipeline1 --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 5 ++++- eng/pipelines/templates/stages/archetype-sdk-client.yml | 6 +++++- sdk/keyvault/ci.yml | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 991bd444f0..0712693f24 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -20,6 +20,9 @@ parameters: - name: TimeoutInMinutes type: number default: 60 +- name: EnableHSM + type: boolean + default: false # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per @@ -228,7 +231,7 @@ jobs: ServiceDirectory: ${{ parameters.ServiceDirectory }} Location: ${{ parameters.Location }} SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHsm : true + EnableHSM : ${{ parameters.EnableHSM }} # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index d980b0f90f..44fa0376a0 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -47,7 +47,10 @@ parameters: - name: CMakeSourceTestOptions type: object default: [] - +- name: EnableHSM + type: boolean + default: false + stages: - stage: CMakeGeneration jobs: @@ -89,6 +92,7 @@ stages: Location: ${{ parameters.Location }} SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} CoverageReportPath: ${{ parameters.CoverageReportPath }} + EnableHSM: ${{ parameters.EnableHSM }} - ${{ if and(eq(variables['System.TeamProject'], 'internal'), not(endsWith(variables['Build.DefinitionName'], ' - tests'))) }}: - template: archetype-cpp-release.yml diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index 78e13304b1..31a97995b2 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -32,6 +32,7 @@ stages: SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) LineCoverageTarget: 81 BranchCoverageTarget: 42 + EnableHSM: true Artifacts: - Name: azure-security-keyvault-keys Path: azure-security-keyvault-keys From f2c3cbb9891350230ada8614222792a8e0d5bd34 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 11:03:39 -0700 Subject: [PATCH 12/65] see now --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 8 ++++---- eng/pipelines/templates/stages/archetype-sdk-client.yml | 8 ++++---- sdk/keyvault/ci.yml | 2 +- sdk/keyvault/test-resources.json | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 0712693f24..d8be0fbb66 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -20,9 +20,9 @@ parameters: - name: TimeoutInMinutes type: number default: 60 -- name: EnableHSM - type: boolean - default: false +#- name: EnableHSM +# type: boolean +# default: false # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per @@ -231,7 +231,7 @@ jobs: ServiceDirectory: ${{ parameters.ServiceDirectory }} Location: ${{ parameters.Location }} SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHSM : ${{ parameters.EnableHSM }} + #EnableHSM : ${{ parameters.EnableHSM }} # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 44fa0376a0..4b95dc5c91 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -47,9 +47,9 @@ parameters: - name: CMakeSourceTestOptions type: object default: [] -- name: EnableHSM - type: boolean - default: false +#- name: EnableHSM +# type: boolean +# default: false stages: - stage: CMakeGeneration @@ -92,7 +92,7 @@ stages: Location: ${{ parameters.Location }} SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} CoverageReportPath: ${{ parameters.CoverageReportPath }} - EnableHSM: ${{ parameters.EnableHSM }} + #EnableHSM: ${{ parameters.EnableHSM }} - ${{ if and(eq(variables['System.TeamProject'], 'internal'), not(endsWith(variables['Build.DefinitionName'], ' - tests'))) }}: - template: archetype-cpp-release.yml diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index 31a97995b2..43d9a22196 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -32,7 +32,7 @@ stages: SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) LineCoverageTarget: 81 BranchCoverageTarget: 42 - EnableHSM: true + #EnableHSM: true Artifacts: - Name: azure-security-keyvault-keys Path: azure-security-keyvault-keys diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 71047f3d0e..98836aa04a 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -112,7 +112,7 @@ } }, "enableHsm": { - "defaultValue": false, + "defaultValue": true, "type": "Bool", "metadata": { "description": "Whether to enable deployment of Managed HSM. The default is false." From 31a06a35847d0dab6b837bf88b5b395b3a1fac9a Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 12:40:21 -0700 Subject: [PATCH 13/65] try try again --- sdk/keyvault/test-resources.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 98836aa04a..1ded945bf5 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -255,8 +255,8 @@ { "type": "Microsoft.KeyVault/managedHSMs", "apiVersion": "[variables('hsmApiVersion')]", - "name": "[variables('hsmName')]", - "location": "[parameters('hsmLocation')]", + "name": "keyvaultHSM", + "location": "eastus2", "sku": { "family": "B", "name": "Standard_B1" @@ -265,7 +265,7 @@ "tenantId": "[parameters('tenantId')]", "initialAdminObjectIds": "[union(array(parameters('testApplicationOid')), array(parameters('provisionerApplicationOid')))]", "enablePurgeProtection": false, - "enableSoftDelete": true, + "enableSoftDelete": false, "softDeleteRetentionInDays": 7, "publicNetworkAccess": "Enabled", "networkAcls": "[variables('networkAcls')]" @@ -305,6 +305,10 @@ "CLIENT_OBJECTID": { "type": "String", "value": "[parameters('testApplicationOid')]" + }, + "AZURE_LIVE_TEST_SUFFIX" { + "type": "String", + "value": "[substring(uniqueString(resourceGroup().id, deployment().name),0,6))]" } } } \ No newline at end of file From 3ccb3dededa9b496f341bd97b0180b512cf87450 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 12:58:41 -0700 Subject: [PATCH 14/65] darn json --- sdk/keyvault/test-resources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 1ded945bf5..81a8f21827 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -306,7 +306,7 @@ "type": "String", "value": "[parameters('testApplicationOid')]" }, - "AZURE_LIVE_TEST_SUFFIX" { + "AZURE_LIVE_TEST_SUFFIX": { "type": "String", "value": "[substring(uniqueString(resourceGroup().id, deployment().name),0,6))]" } From 111e0838e276a0e99f0c485165b4322a1c7380b4 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 13:32:47 -0700 Subject: [PATCH 15/65] oh boy --- sdk/keyvault/test-resources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 81a8f21827..1c3b212a3a 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -308,7 +308,7 @@ }, "AZURE_LIVE_TEST_SUFFIX": { "type": "String", - "value": "[substring(uniqueString(resourceGroup().id, deployment().name),0,6))]" + "value": "[concat(resourceGroup().id, substring(uniqueString(resourceGroup().id),0,6))]" } } } \ No newline at end of file From 9ed7b439340533a8b4f96074d69dab603f86bfbc Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 13:56:32 -0700 Subject: [PATCH 16/65] oh boy --- sdk/keyvault/test-resources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 1c3b212a3a..8b5e35b325 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -308,7 +308,7 @@ }, "AZURE_LIVE_TEST_SUFFIX": { "type": "String", - "value": "[concat(resourceGroup().id, substring(uniqueString(resourceGroup().id),0,6))]" + "value": "[resourceGroup().id]" } } } \ No newline at end of file From e63c69b307141d30844f9e2486707cbed5fdab1a Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 14:18:53 -0700 Subject: [PATCH 17/65] rwerwerw --- sdk/keyvault/test-resources.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 8b5e35b325..54c39fe1c5 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -305,10 +305,6 @@ "CLIENT_OBJECTID": { "type": "String", "value": "[parameters('testApplicationOid')]" - }, - "AZURE_LIVE_TEST_SUFFIX": { - "type": "String", - "value": "[resourceGroup().id]" } } } \ No newline at end of file From e827b24946daab246c7c62513a19bb4094120712 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 15:13:55 -0700 Subject: [PATCH 18/65] jioijhjui --- sdk/keyvault/test-resources.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 54c39fe1c5..6a0b5f306d 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -269,8 +269,7 @@ "softDeleteRetentionInDays": 7, "publicNetworkAccess": "Enabled", "networkAcls": "[variables('networkAcls')]" - }, - "condition": "[parameters('enableHsm')]" + } } ], "outputs": { From 88dba6557a2b86c7c9a6d17486296e04d5c56734 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 17:45:49 -0700 Subject: [PATCH 19/65] maybe now ? --- .../TestResources/deploy-test-resources.yml | 4 +++ .../templates/jobs/archetype-sdk-tests.yml | 34 ++++++++++++++++--- .../templates/stages/archetype-sdk-client.yml | 4 --- sdk/keyvault/test-resources.json | 11 +++--- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index 7eeeda847f..e868e24842 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -3,6 +3,8 @@ parameters: ArmTemplateParameters: '@{}' DeleteAfterHours: 8 Location: '' + HsmLocation: '' + EnableHsm: false SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) # SubscriptionConfiguration will be splatted into the parameters of the test @@ -51,6 +53,8 @@ steps: -BaseName 'Generated' ` -ServiceDirectory '${{ parameters.ServiceDirectory }}' ` -Location '${{ parameters.Location }}' ` + -HsmLocation '${{ parameters.HsmLocation }}' ` + -EnableHsm '${{ parameters.EnableHsm }}' ` -DeleteAfterHours '${{ parameters.DeleteAfterHours }}' ` @subscriptionConfiguration ` -AdditionalParameters ${{ parameters.ArmTemplateParameters }} ` diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index d8be0fbb66..d977dc52b7 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -20,9 +20,6 @@ parameters: - name: TimeoutInMinutes type: number default: 60 -#- name: EnableHSM -# type: boolean -# default: false # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per @@ -44,6 +41,8 @@ jobs: CmakeEnvArg: 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake' BuildArgs: '-j 4' CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON' + HsmLocation: 'eastus' + EnableHsm: true Linux_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -55,6 +54,8 @@ jobs: CODE_COVERAGE_COLLECT_ONLY: 1 AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' + HsmLocation: 'eastus' + EnableHsm: true Ubuntu20_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -62,6 +63,8 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' + HsmLocation: 'eastus' + EnableHsm: true Ubuntu20_samples: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -70,12 +73,16 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Release ' BuildArgs: '-j 4' RunSamples: 1 + HsmLocation: 'eastus2' + EnableHsm: true Ubuntu20_x64_no_rtti: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 VCPKG_DEFAULT_TRIPLET: 'x64-linux' CmakeArgs: ' -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release ' BuildArgs: '-j 4' + HsmLocation: 'eastus2' + EnableHsm: true # Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl Win_x86_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general @@ -87,6 +94,8 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" + HsmLocation: 'eastus2' + EnableHsm: true Win_x86_no_rtti_whit_unit_test: Pool: azsdk-pool-mms-win-2019-general OSVmImage: MMS2019 @@ -97,6 +106,8 @@ jobs: CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" + HsmLocation: 'centralus' + EnableHsm: true Win_x64_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -108,6 +119,8 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' AZURE_CORE_ENABLE_JSON_TESTS: 1 WindowsCtestConfig: "-C Release" + HsmLocation: 'centralus' + EnableHsm: true Win_x64_with_unit_samples_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -120,6 +133,8 @@ jobs: AZURE_CORE_ENABLE_JSON_TESTS: 1 RunSamples: 1 WindowsCtestConfig: "-C Release" + HsmLocation: 'centralus' + EnableHsm: true # specify libcurl to be used on Windows Win_x86_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -129,6 +144,8 @@ jobs: CMAKE_GENERATOR_PLATFORM: Win32 CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8' + HsmLocation: 'westus3' + EnableHsm: true #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -139,6 +156,8 @@ jobs: CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release ' WindowsCtestConfig: "-C Release" + HsmLocation: 'westus3' + EnableHsm: true #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_samples_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -151,6 +170,8 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' RunSamples: 1 WindowsCtestConfig: "-C Release" + HsmLocation: 'southcentralus' + EnableHsm: true MacOS_x64_with_unit_test: Pool: Azure Pipelines OSVmImage: 'macOS-10.15' @@ -158,6 +179,8 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' + HsmLocation: 'northcentralus' + EnableHsm: true pool: name: $(Pool) vmImage: $(OSVmImage) @@ -229,9 +252,10 @@ jobs: - template: /eng/common/TestResources/deploy-test-resources.yml parameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} - Location: ${{ parameters.Location }} + Location: "$(HsmLocation)" + HsmLocation: "$(HsmLocation)" SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - #EnableHSM : ${{ parameters.EnableHSM }} + EnableHSM : "$(EnableHsm)" # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 4b95dc5c91..987199ea62 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -47,9 +47,6 @@ parameters: - name: CMakeSourceTestOptions type: object default: [] -#- name: EnableHSM -# type: boolean -# default: false stages: - stage: CMakeGeneration @@ -92,7 +89,6 @@ stages: Location: ${{ parameters.Location }} SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} CoverageReportPath: ${{ parameters.CoverageReportPath }} - #EnableHSM: ${{ parameters.EnableHSM }} - ${{ if and(eq(variables['System.TeamProject'], 'internal'), not(endsWith(variables['Build.DefinitionName'], ' - tests'))) }}: - template: archetype-cpp-release.yml diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 6a0b5f306d..71047f3d0e 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -112,7 +112,7 @@ } }, "enableHsm": { - "defaultValue": true, + "defaultValue": false, "type": "Bool", "metadata": { "description": "Whether to enable deployment of Managed HSM. The default is false." @@ -255,8 +255,8 @@ { "type": "Microsoft.KeyVault/managedHSMs", "apiVersion": "[variables('hsmApiVersion')]", - "name": "keyvaultHSM", - "location": "eastus2", + "name": "[variables('hsmName')]", + "location": "[parameters('hsmLocation')]", "sku": { "family": "B", "name": "Standard_B1" @@ -265,11 +265,12 @@ "tenantId": "[parameters('tenantId')]", "initialAdminObjectIds": "[union(array(parameters('testApplicationOid')), array(parameters('provisionerApplicationOid')))]", "enablePurgeProtection": false, - "enableSoftDelete": false, + "enableSoftDelete": true, "softDeleteRetentionInDays": 7, "publicNetworkAccess": "Enabled", "networkAcls": "[variables('networkAcls')]" - } + }, + "condition": "[parameters('enableHsm')]" } ], "outputs": { From a7e24033c8947652aee7cefb31e2d2e6cdf60aec Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 18:26:09 -0700 Subject: [PATCH 20/65] maybe now ? --- sdk/keyvault/test-resources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 71047f3d0e..f49449dcff 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -112,7 +112,7 @@ } }, "enableHsm": { - "defaultValue": false, + "defaultValue": true, "type": "Bool", "metadata": { "description": "Whether to enable deployment of Managed HSM. The default is false." @@ -256,7 +256,7 @@ "type": "Microsoft.KeyVault/managedHSMs", "apiVersion": "[variables('hsmApiVersion')]", "name": "[variables('hsmName')]", - "location": "[parameters('hsmLocation')]", + "location": "[parameters('location')]", "sku": { "family": "B", "name": "Standard_B1" From 0e6d42d883b851c1e70b5c7fc1987ba04cd69d15 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Thu, 12 May 2022 19:17:02 -0700 Subject: [PATCH 21/65] increase timeout and fix ps script --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 2 +- sdk/keyvault/test-resources-post.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index d977dc52b7..10ca0fafd7 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -19,7 +19,7 @@ parameters: default: sdk/*/*/*cov_xml.xml - name: TimeoutInMinutes type: number - default: 60 + default: 120 # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index caa8da390f..8d40a0fa9f 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -68,7 +68,7 @@ $([Convert]::ToBase64String($Certificate.RawData, 'InsertLineBreaks')) } # Make sure we deployed a Managed HSM. -if (!$DeploymentOutputs['AZURE_ENABLE_HSM']) { +if (!$DeploymentOutputs['AZURE_KEYVAULT_HSM_URL']) { Log "Managed HSM not deployed; skipping activation" exit } From 2e9117ed6ccc08f3098e05244346956dabed5e76 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 13 May 2022 11:02:14 -0700 Subject: [PATCH 22/65] keyvault permissions --- sdk/keyvault/test-resources.json | 77 +++++++++++++++++--------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index f49449dcff..b658d4e7f0 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -167,7 +167,7 @@ "resources": [ { "type": "Microsoft.KeyVault/vaults", - "apiVersion": "2019-09-01", + "apiVersion": "2021-11-01-preview", "name": "[parameters('baseName')]", "location": "[parameters('location')]", "properties": { @@ -182,51 +182,54 @@ "objectId": "[parameters('testApplicationOid')]", "permissions": { "keys": [ - "get", + "wrapKey", + "decrypt", "list", - "update", - "create", - "import", - "delete", + "purge", "recover", - "backup", "restore", - "decrypt", + "getrotationpolicy", + "sign", + "release", "encrypt", - "unwrapKey", - "wrapKey", + "rotate", + "import", + "create", "verify", - "sign", - "purge", - "release" + "setrotationpolicy", + "backup", + "update", + "get", + "unwrapKey", + "delete" ], "secrets": [ - "get", - "list", - "set", - "delete", - "recover", - "backup", - "restore", - "purge" + "Get", + "List", + "Set", + "Delete", + "Recover", + "Backup", + "Restore", + "Purge" ], "certificates": [ - "get", - "list", - "update", - "create", - "import", - "delete", - "recover", - "backup", - "restore", - "managecontacts", - "manageissuers", - "getissuers", - "listissuers", - "setissuers", - "deleteissuers", - "purge" + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "ManageContacts", + "ManageIssuers", + "GetIssuers", + "ListIssuers", + "SetIssuers", + "DeleteIssuers", + "Purge" ] } } From a7fdbd72f91ecce0ce81f70e12e4b09e00b76dd0 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 13 May 2022 11:32:01 -0700 Subject: [PATCH 23/65] rebalance regions --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 10ca0fafd7..769b7bd8dd 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -54,7 +54,7 @@ jobs: CODE_COVERAGE_COLLECT_ONLY: 1 AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: 'eastus' + HsmLocation: 'westcentralus' EnableHsm: true Ubuntu20_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general @@ -63,7 +63,7 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: 'eastus' + HsmLocation: 'westus2' EnableHsm: true Ubuntu20_samples: Pool: azsdk-pool-mms-ubuntu-1804-general @@ -106,7 +106,7 @@ jobs: CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" - HsmLocation: 'centralus' + HsmLocation: 'westus2' EnableHsm: true Win_x64_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general @@ -119,7 +119,7 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' AZURE_CORE_ENABLE_JSON_TESTS: 1 WindowsCtestConfig: "-C Release" - HsmLocation: 'centralus' + HsmLocation: 'westus3' EnableHsm: true Win_x64_with_unit_samples_winHttp: Pool: azsdk-pool-mms-win-2019-general @@ -133,7 +133,7 @@ jobs: AZURE_CORE_ENABLE_JSON_TESTS: 1 RunSamples: 1 WindowsCtestConfig: "-C Release" - HsmLocation: 'centralus' + HsmLocation: 'northcentralus' EnableHsm: true # specify libcurl to be used on Windows Win_x86_with_unit_test_libcurl: @@ -170,7 +170,7 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' RunSamples: 1 WindowsCtestConfig: "-C Release" - HsmLocation: 'southcentralus' + HsmLocation: 'northcentralus' EnableHsm: true MacOS_x64_with_unit_test: Pool: Azure Pipelines From 06382a106b24312f1254c348b631cfadf884f68a Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 13 May 2022 13:21:23 -0700 Subject: [PATCH 24/65] ssssss --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 6 +++--- .../test/ut/key_client_create_test_live.cpp | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 769b7bd8dd..346040df7c 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -54,7 +54,7 @@ jobs: CODE_COVERAGE_COLLECT_ONLY: 1 AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: 'westcentralus' + HsmLocation: 'canadacentral' EnableHsm: true Ubuntu20_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general @@ -63,7 +63,7 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: 'westus2' + HsmLocation: 'canadacentral' EnableHsm: true Ubuntu20_samples: Pool: azsdk-pool-mms-ubuntu-1804-general @@ -106,7 +106,7 @@ jobs: CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" - HsmLocation: 'westus2' + HsmLocation: 'canadacentral' EnableHsm: true Win_x64_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp index 3672ddb73c..985e6a73a2 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp @@ -53,12 +53,7 @@ TEST_F(KeyVaultKeyClient, CreateKeyWithOptions) Azure::Security::KeyVault::Keys::CreateKeyOptions options; options.KeyOperations.push_back(Azure::Security::KeyVault::Keys::KeyOperation::Sign); options.KeyOperations.push_back(Azure::Security::KeyVault::Keys::KeyOperation::Verify); - options.ReleasePolicy = KeyReleasePolicy(); - options.ReleasePolicy.Value().Immutable = true; - std::string dataStr = "release policy data"; - options.ReleasePolicy.Value().Data - = Base64Url::Base64UrlEncode(std::vector(dataStr.begin(), dataStr.end())); - + { auto keyResponse = client.CreateKey(keyName, Azure::Security::KeyVault::Keys::KeyVaultKeyType::Ec, options); @@ -260,7 +255,8 @@ std::string BinaryToHexString(std::vector const& src) return output; } -TEST_F(KeyVaultKeyClient, ReleaseKey) +//temporary while i get the live tests working +TEST_F(KeyVaultKeyClient, DISABLED_ReleaseKey) { auto const keyName = GetTestName() + "2"; auto const& client = GetClientForTest(keyName); From a32cf303736d11dc0533b6159a9e0b55d3b6dc97 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 13 May 2022 14:00:43 -0700 Subject: [PATCH 25/65] [p]ppi --- .../test/ut/key_client_create_test_live.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp index 985e6a73a2..ba60735c59 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp @@ -53,7 +53,7 @@ TEST_F(KeyVaultKeyClient, CreateKeyWithOptions) Azure::Security::KeyVault::Keys::CreateKeyOptions options; options.KeyOperations.push_back(Azure::Security::KeyVault::Keys::KeyOperation::Sign); options.KeyOperations.push_back(Azure::Security::KeyVault::Keys::KeyOperation::Verify); - + { auto keyResponse = client.CreateKey(keyName, Azure::Security::KeyVault::Keys::KeyVaultKeyType::Ec, options); @@ -255,7 +255,7 @@ std::string BinaryToHexString(std::vector const& src) return output; } -//temporary while i get the live tests working +// temporary while i get the live tests working TEST_F(KeyVaultKeyClient, DISABLED_ReleaseKey) { auto const keyName = GetTestName() + "2"; @@ -278,12 +278,13 @@ TEST_F(KeyVaultKeyClient, DISABLED_ReleaseKey) Azure::Security::Attestation::AttestationClient attestationClient( AttestationServiceUrl(), attestationOptions); attestationClient.RetrieveResponseValidationCollateral(); + AttestationData attestData; + attestData.Data = std::vector(keySerializedJWK.begin(), keySerializedJWK.end()); + attestData.DataType = AttestationDataType::Binary; + AttestOptions attestOptions; + attestOptions.RuntimeData = attestData; - auto attestResponse = attestationClient.AttestOpenEnclave( - decodedGeneratedToken, - AttestOptions{AttestationData{ - std::vector(keySerializedJWK.begin(), keySerializedJWK.end()), - AttestationDataType::Binary}}); + auto attestResponse = attestationClient.AttestOpenEnclave(decodedGeneratedToken, attestOptions); Azure::Security::KeyVault::Keys::CreateKeyOptions options; options.KeyOperations.push_back(Azure::Security::KeyVault::Keys::KeyOperation::Sign); From 1be1fa582c1cc73863457c5ce3a594eceb431177 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 13 May 2022 18:46:22 -0700 Subject: [PATCH 26/65] try this --- .../templates/jobs/archetype-sdk-tests.yml | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 346040df7c..59d74798e1 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -27,6 +27,17 @@ parameters: # https://github.com/Azure/azure-sdk-for-cpp/issues/2944 jobs: + +- job: DeployTestResource + steps: + - template: /eng/common/TestResources/deploy-test-resources.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + Location: "westus3" + HsmLocation: "westus3" + SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + EnableHSM : "$(EnableHsm)" + - job: ValidateLive condition: and(succeededOrFailed(), ne(variables['Skip.LiveTest'], 'true')) timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} @@ -249,14 +260,6 @@ jobs: BuildArgs: "$(BuildArgs)" Env: "$(CmakeEnvArg)" - - template: /eng/common/TestResources/deploy-test-resources.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - Location: "$(HsmLocation)" - HsmLocation: "$(HsmLocation)" - SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHSM : "$(EnableHsm)" - # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest # Visual Studio generator used in CI is a multi-config generator. @@ -324,6 +327,8 @@ jobs: displayName: Publish Code Coverage to DevOps condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) +- job: + steps: - template: /eng/common/TestResources/remove-test-resources.yml parameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} From 0195b6f77d00699f811f4283e3795b10fcc4aad0 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 13 May 2022 19:02:02 -0700 Subject: [PATCH 27/65] fsdfsdfsd --- .../templates/jobs/archetype-sdk-tests.yml | 621 +++++++++--------- 1 file changed, 309 insertions(+), 312 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 59d74798e1..13d5102261 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -1,25 +1,25 @@ parameters: -- name: Location - type: string - default: '' -- name: SubscriptionConfiguration - type: string - default: $(sub-config-azure-cloud-test-resources) -- name: ServiceDirectory - type: string - default: not-specified -- name: CtestRegex - type: string - default: .* -- name: Coverage - type: string - default: 'enabled' -- name: CoverageReportPath - type: string - default: sdk/*/*/*cov_xml.xml -- name: TimeoutInMinutes - type: number - default: 120 + - name: Location + type: string + default: "" + - name: SubscriptionConfiguration + type: string + default: $(sub-config-azure-cloud-test-resources) + - name: ServiceDirectory + type: string + default: not-specified + - name: CtestRegex + type: string + default: .* + - name: Coverage + type: string + default: "enabled" + - name: CoverageReportPath + type: string + default: sdk/*/*/*cov_xml.xml + - name: TimeoutInMinutes + type: number + default: 120 # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per @@ -27,309 +27,306 @@ parameters: # https://github.com/Azure/azure-sdk-for-cpp/issues/2944 jobs: + - job: DeployTestResource + steps: + - template: /eng/common/TestResources/deploy-test-resources.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + Location: "westus3" + HsmLocation: "westus3" + SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + EnableHSM: "$(EnableHsm)" -- job: DeployTestResource - steps: - - template: /eng/common/TestResources/deploy-test-resources.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - Location: "westus3" - HsmLocation: "westus3" - SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHSM : "$(EnableHsm)" + - step: ValidateLive + condition: and(succeededOrFailed(), ne(variables['Skip.LiveTest'], 'true')) + timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} + strategy: + matrix: + Linux_x64_gcc5_with_unit_test: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: "x64-linux" + # Can't set CC and CXX to env because it would affect VCPKG building which requires g++ > 7 + # So, this conf will set the CXX for cmake inline. + CmakeEnvArg: "CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake" + BuildArgs: "-j 4" + CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON" + HsmLocation: "eastus" + EnableHsm: true + Linux_x64_with_unit_test: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: "x64-linux" + CmakeArgs: " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_CODE_COVERAGE=ON" + AptDependencies: "gcovr lcov" + CODE_COVERAGE: "${{ parameters.Coverage }}" + # Avoid re-running tests again for code coverage since the tests were previously ran + CODE_COVERAGE_COLLECT_ONLY: 1 + AZURE_CORE_ENABLE_JSON_TESTS: 1 + BuildArgs: "-j 4" + HsmLocation: "canadacentral" + EnableHsm: true + Ubuntu20_x64_with_unit_test: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: "x64-linux" + CmakeArgs: " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON" + AZURE_CORE_ENABLE_JSON_TESTS: 1 + BuildArgs: "-j 4" + HsmLocation: "canadacentral" + EnableHsm: true + Ubuntu20_samples: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: "x64-linux" + # Builds samples and run them against the deployed resources. Samples requires Azure Account, so only works on live tests. + CmakeArgs: " -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Release " + BuildArgs: "-j 4" + RunSamples: 1 + HsmLocation: "eastus2" + EnableHsm: true + Ubuntu20_x64_no_rtti: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: "x64-linux" + CmakeArgs: " -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release " + BuildArgs: "-j 4" + HsmLocation: "eastus2" + EnableHsm: true + # Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl + Win_x86_with_unit_test_winHttp: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: "x86-windows-static" + VcpkgInstall: "openssl" + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_GENERATOR_PLATFORM: Win32 + CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON " + BuildArgs: "-v --parallel 8 --config Release" + WindowsCtestConfig: "-C Release" + HsmLocation: "eastus2" + EnableHsm: true + Win_x86_no_rtti_whit_unit_test: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VcpkgInstall: "libxml2 openssl" + VCPKG_DEFAULT_TRIPLET: "x86-windows-static" + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_GENERATOR_PLATFORM: Win32 + CmakeArgs: " -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON" + BuildArgs: "-v --parallel 8 --config Release" + WindowsCtestConfig: "-C Release" + HsmLocation: "canadacentral" + EnableHsm: true + Win_x64_with_unit_test_winHttp: + Pool: azsdk-pool-mms-win-2019-general + VcpkgInstall: "openssl" + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: "x64-windows-static" + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_GENERATOR_PLATFORM: x64 + CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON " + BuildArgs: "-v --parallel 8 --config Release " + AZURE_CORE_ENABLE_JSON_TESTS: 1 + WindowsCtestConfig: "-C Release" + HsmLocation: "westus3" + EnableHsm: true + Win_x64_with_unit_samples_winHttp: + Pool: azsdk-pool-mms-win-2019-general + VcpkgInstall: "openssl" + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: "x64-windows-static" + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_GENERATOR_PLATFORM: x64 + CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON " + BuildArgs: "-v --parallel 8 --config Release " + AZURE_CORE_ENABLE_JSON_TESTS: 1 + RunSamples: 1 + WindowsCtestConfig: "-C Release" + HsmLocation: "northcentralus" + EnableHsm: true + # specify libcurl to be used on Windows + Win_x86_with_unit_test_libcurl: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: "x86-windows-static" + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_GENERATOR_PLATFORM: Win32 + CmakeArgs: " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON " + BuildArgs: "-v --parallel 8" + HsmLocation: "westus3" + EnableHsm: true + #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. + Win_x64_with_unit_test_libcurl: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: "x64-windows-static" + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_GENERATOR_PLATFORM: x64 + CmakeArgs: " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON " + BuildArgs: "-v --parallel 8 --config Release " + WindowsCtestConfig: "-C Release" + HsmLocation: "westus3" + EnableHsm: true + #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. + Win_x64_with_unit_samples_libcurl: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VcpkgInstall: "curl[winssl] openssl" + VCPKG_DEFAULT_TRIPLET: "x64-windows-static" + CMAKE_GENERATOR: "Visual Studio 16 2019" + CMAKE_GENERATOR_PLATFORM: x64 + CmakeArgs: " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON " + BuildArgs: "-v --parallel 8 --config Release " + RunSamples: 1 + WindowsCtestConfig: "-C Release" + HsmLocation: "northcentralus" + EnableHsm: true + MacOS_x64_with_unit_test: + Pool: Azure Pipelines + OSVmImage: "macOS-10.15" + VCPKG_DEFAULT_TRIPLET: "x64-osx" + CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON" + AZURE_CORE_ENABLE_JSON_TESTS: 1 + BuildArgs: "-j 4" + HsmLocation: "northcentralus" + EnableHsm: true + pool: + name: $(Pool) + vmImage: $(OSVmImage) + variables: + CMOCKA_XML_FILE: "%g-test-results.xml" + CMOCKA_MESSAGE_OUTPUT: "xml" + AZURE_ENABLE_STATIC_ANALYSIS: 1 + BuildArgs: "" + WindowsCtestConfig: "" + CmakeEnvArg: "" + CmakeArgs: "" + AZURE_TEST_MODE: "LIVE" + AZURE_LOG_LEVEL: "verbose" + # Surface the ServiceDirectory parameter as an environment variable so tests can take advantage of it. + AZURE_SERVICE_DIRECTORY: ${{ parameters.ServiceDirectory }} + job: + steps: + - checkout: self + submodules: recursive -- job: ValidateLive - condition: and(succeededOrFailed(), ne(variables['Skip.LiveTest'], 'true')) - timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} - strategy: - matrix: - Linux_x64_gcc5_with_unit_test: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: 'x64-linux' - # Can't set CC and CXX to env because it would affect VCPKG building which requires g++ > 7 - # So, this conf will set the CXX for cmake inline. - CmakeEnvArg: 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake' - BuildArgs: '-j 4' - CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON' - HsmLocation: 'eastus' - EnableHsm: true - Linux_x64_with_unit_test: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: 'x64-linux' - CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_CODE_COVERAGE=ON' - AptDependencies: 'gcovr lcov' - CODE_COVERAGE: '${{ parameters.Coverage }}' - # Avoid re-running tests again for code coverage since the tests were previously ran - CODE_COVERAGE_COLLECT_ONLY: 1 - AZURE_CORE_ENABLE_JSON_TESTS: 1 - BuildArgs: '-j 4' - HsmLocation: 'canadacentral' - EnableHsm: true - Ubuntu20_x64_with_unit_test: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: 'x64-linux' - CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON' - AZURE_CORE_ENABLE_JSON_TESTS: 1 - BuildArgs: '-j 4' - HsmLocation: 'canadacentral' - EnableHsm: true - Ubuntu20_samples: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: 'x64-linux' - # Builds samples and run them against the deployed resources. Samples requires Azure Account, so only works on live tests. - CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Release ' - BuildArgs: '-j 4' - RunSamples: 1 - HsmLocation: 'eastus2' - EnableHsm: true - Ubuntu20_x64_no_rtti: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: 'x64-linux' - CmakeArgs: ' -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release ' - BuildArgs: '-j 4' - HsmLocation: 'eastus2' - EnableHsm: true - # Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl - Win_x86_with_unit_test_winHttp: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: 'x86-windows-static' - VcpkgInstall: 'openssl' - CMAKE_GENERATOR: 'Visual Studio 16 2019' - CMAKE_GENERATOR_PLATFORM: Win32 - CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' - BuildArgs: '-v --parallel 8 --config Release' - WindowsCtestConfig: "-C Release" - HsmLocation: 'eastus2' - EnableHsm: true - Win_x86_no_rtti_whit_unit_test: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VcpkgInstall: 'libxml2 openssl' - VCPKG_DEFAULT_TRIPLET: 'x86-windows-static' - CMAKE_GENERATOR: 'Visual Studio 16 2019' - CMAKE_GENERATOR_PLATFORM: Win32 - CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' - BuildArgs: '-v --parallel 8 --config Release' - WindowsCtestConfig: "-C Release" - HsmLocation: 'canadacentral' - EnableHsm: true - Win_x64_with_unit_test_winHttp: - Pool: azsdk-pool-mms-win-2019-general - VcpkgInstall: 'openssl' - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' - CMAKE_GENERATOR: 'Visual Studio 16 2019' - CMAKE_GENERATOR_PLATFORM: x64 - CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' - BuildArgs: '-v --parallel 8 --config Release ' - AZURE_CORE_ENABLE_JSON_TESTS: 1 - WindowsCtestConfig: "-C Release" - HsmLocation: 'westus3' - EnableHsm: true - Win_x64_with_unit_samples_winHttp: - Pool: azsdk-pool-mms-win-2019-general - VcpkgInstall: 'openssl' - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' - CMAKE_GENERATOR: 'Visual Studio 16 2019' - CMAKE_GENERATOR_PLATFORM: x64 - CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON ' - BuildArgs: '-v --parallel 8 --config Release ' - AZURE_CORE_ENABLE_JSON_TESTS: 1 - RunSamples: 1 - WindowsCtestConfig: "-C Release" - HsmLocation: 'northcentralus' - EnableHsm: true - # specify libcurl to be used on Windows - Win_x86_with_unit_test_libcurl: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: 'x86-windows-static' - CMAKE_GENERATOR: 'Visual Studio 16 2019' - CMAKE_GENERATOR_PLATFORM: Win32 - CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' - BuildArgs: '-v --parallel 8' - HsmLocation: 'westus3' - EnableHsm: true - #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. - Win_x64_with_unit_test_libcurl: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' - CMAKE_GENERATOR: 'Visual Studio 16 2019' - CMAKE_GENERATOR_PLATFORM: x64 - CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' - BuildArgs: '-v --parallel 8 --config Release ' - WindowsCtestConfig: "-C Release" - HsmLocation: 'westus3' - EnableHsm: true - #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. - Win_x64_with_unit_samples_libcurl: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VcpkgInstall: 'curl[winssl] openssl' - VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' - CMAKE_GENERATOR: 'Visual Studio 16 2019' - CMAKE_GENERATOR_PLATFORM: x64 - CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON ' - BuildArgs: '-v --parallel 8 --config Release ' - RunSamples: 1 - WindowsCtestConfig: "-C Release" - HsmLocation: 'northcentralus' - EnableHsm: true - MacOS_x64_with_unit_test: - Pool: Azure Pipelines - OSVmImage: 'macOS-10.15' - VCPKG_DEFAULT_TRIPLET: 'x64-osx' - CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON' - AZURE_CORE_ENABLE_JSON_TESTS: 1 - BuildArgs: '-j 4' - HsmLocation: 'northcentralus' - EnableHsm: true - pool: - name: $(Pool) - vmImage: $(OSVmImage) - variables: - CMOCKA_XML_FILE: "%g-test-results.xml" - CMOCKA_MESSAGE_OUTPUT: "xml" - AZURE_ENABLE_STATIC_ANALYSIS: 1 - BuildArgs: "" - WindowsCtestConfig: "" - CmakeEnvArg: "" - CmakeArgs: "" - AZURE_TEST_MODE: "LIVE" - AZURE_LOG_LEVEL: "verbose" - # Surface the ServiceDirectory parameter as an environment variable so tests can take advantage of it. - AZURE_SERVICE_DIRECTORY: ${{ parameters.ServiceDirectory }} + - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml + parameters: + AgentImage: $(OSVmImage) - steps: - - checkout: self - submodules: recursive + - template: /eng/common/pipelines/templates/steps/bypass-local-dns.yml - - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml - parameters: - AgentImage: $(OSVmImage) + # Add g++5 repo to ubuntu + - bash: sudo sh -c "echo 'deb http://ftp.debian.org/debian/ stretch main' >> /etc/apt/sources.list" + displayName: Add g++ 5 + condition: >- + and( + succeeded(), + contains(variables['OSVmImage'], 'Ubuntu'), + contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake') + ) - - template: /eng/common/pipelines/templates/steps/bypass-local-dns.yml + # Install g++5 + - bash: sudo apt-get update & sudo apt-get install g++-5 + displayName: Install g++ 5 + condition: >- + and( + succeeded(), + contains(variables['OSVmImage'], 'Ubuntu'), + contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake') + ) - # Add g++5 repo to ubuntu - - bash: sudo sh -c "echo 'deb http://ftp.debian.org/debian/ stretch main' >> /etc/apt/sources.list" - displayName: Add g++ 5 - condition: >- - and( - succeeded(), - contains(variables['OSVmImage'], 'Ubuntu'), - contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake') - ) + # Install apt dependencies (if appropriate) + - bash: sudo apt install -y $(AptDependencies) + condition: and(succeededOrFailed(), ne(variables['AptDependencies'], '')) + displayName: Install dependencies from apt - # Install g++5 - - bash: sudo apt-get update & sudo apt-get install g++-5 - displayName: Install g++ 5 - condition: >- - and( - succeeded(), - contains(variables['OSVmImage'], 'Ubuntu'), - contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake') - ) + - template: /eng/pipelines/templates/steps/vcpkg.yml - # Install apt dependencies (if appropriate) - - bash: sudo apt install -y $(AptDependencies) - condition: and(succeededOrFailed(), ne(variables['AptDependencies'], '')) - displayName: Install dependencies from apt + - script: | + dotnet tool install -g dotnet-reportgenerator-globaltool + dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools + displayName: Install coverage tools + # CODE_COVERAGE variable is '' (do-not-generate) in all matrix but linux-gcc + # It is 'enabled' by default on linux-gcc but it can be opt-out by each pipeline (disabled) + condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) - - template: /eng/pipelines/templates/steps/vcpkg.yml + - template: /eng/pipelines/templates/steps/cmake-build.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + GenerateArgs: $(CmakeArgs) + BuildArgs: "$(BuildArgs)" + Env: "$(CmakeEnvArg)" - - script: | - dotnet tool install -g dotnet-reportgenerator-globaltool - dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools - displayName: Install coverage tools - # CODE_COVERAGE variable is '' (do-not-generate) in all matrix but linux-gcc - # It is 'enabled' by default on linux-gcc but it can be opt-out by each pipeline (disabled) - condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) + # For non multi-config generator use the same build configuration to run tests + # We don't need to set it to invoke ctest + # Visual Studio generator used in CI is a multi-config generator. + # As such, it requires the configuration argument for building and invoking ctest + - script: ctest $(WindowsCtestConfig) -V --tests-regex ${{ parameters.CtestRegex }} --no-compress-output -T Test + workingDirectory: build + displayName: ctest + # Runs only if test-resources are happly deployed. + # unit-tests runs for those configs where samples are not ran. + # This enables to run tests and samples at the same time as different matrix configuration. + # Then unit-tests runs, samples should not run. + condition: and( + succeeded(), + ne(variables['RunSamples'], '1')) - - template: /eng/pipelines/templates/steps/cmake-build.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - GenerateArgs: $(CmakeArgs) - BuildArgs: "$(BuildArgs)" - Env: "$(CmakeEnvArg)" + - task: PublishTestResults@2 + inputs: + testResultsFormat: cTest + testResultsFiles: Testing/*/Test.xml + testRunTitle: $(Agent.JobName) + searchFolder: build + mergeTestResults: true + publishRunAttachments: true + displayName: Publish test results + # this step only makes sense when ctest has run + condition: and(succeededOrFailed(), ne(variables['RunSamples'], '1')) - # For non multi-config generator use the same build configuration to run tests - # We don't need to set it to invoke ctest - # Visual Studio generator used in CI is a multi-config generator. - # As such, it requires the configuration argument for building and invoking ctest - - script: ctest $(WindowsCtestConfig) -V --tests-regex ${{ parameters.CtestRegex }} --no-compress-output -T Test - workingDirectory: build - displayName: ctest - # Runs only if test-resources are happly deployed. - # unit-tests runs for those configs where samples are not ran. - # This enables to run tests and samples at the same time as different matrix configuration. - # Then unit-tests runs, samples should not run. - condition: and( - succeeded(), - ne(variables['RunSamples'], '1')) + # Running Samples step. + # Will run samples described on a file name [service]-samples.txt within the build directory. + # For example keyvault-samples.txt. + # The file is written by CMake during configuration when building samples. + - bash: | + IFS=$'\n' + if [[ -f "./${{ parameters.ServiceDirectory }}-samples.txt" ]]; then + for sample in `cat ./${{ parameters.ServiceDirectory }}-samples.txt` + do + echo "**********Running sample: ${sample}" + bash -c "$sample" + status=$? + if [[ $status -eq 0 ]]; then + echo "*********Sample completed*********" + else + echo "*Sample returned a failed code: $status" + exit 1 + fi + done + fi + workingDirectory: build + displayName: "Run Samples for : ${{ parameters.ServiceDirectory }}" + condition: and(succeeded(), eq(variables['RunSamples'], '1')) - - task: PublishTestResults@2 - inputs: - testResultsFormat: cTest - testResultsFiles: Testing/*/Test.xml - testRunTitle: $(Agent.JobName) - searchFolder: build - mergeTestResults: true - publishRunAttachments: true - displayName: Publish test results - # this step only makes sense when ctest has run - condition: and(succeededOrFailed(), ne(variables['RunSamples'], '1')) + # Make coverage targets (specified in coverage_targets.txt) and assemble + # coverage report + - bash: | + make `cat ${{ parameters.ServiceDirectory }}-targets-coverage.txt` + ../tools/reportgenerator "-reports:${{ parameters.CoverageReportPath }}" "-targetdir:." "-reporttypes:Cobertura" + workingDirectory: build + displayName: Generate Code Coverage Data + condition: and(succeeded(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) - # Running Samples step. - # Will run samples described on a file name [service]-samples.txt within the build directory. - # For example keyvault-samples.txt. - # The file is written by CMake during configuration when building samples. - - bash: | - IFS=$'\n' - if [[ -f "./${{ parameters.ServiceDirectory }}-samples.txt" ]]; then - for sample in `cat ./${{ parameters.ServiceDirectory }}-samples.txt` - do - echo "**********Running sample: ${sample}" - bash -c "$sample" - status=$? - if [[ $status -eq 0 ]]; then - echo "*********Sample completed*********" - else - echo "*Sample returned a failed code: $status" - exit 1 - fi - done - fi - workingDirectory: build - displayName: "Run Samples for : ${{ parameters.ServiceDirectory }}" - condition: and(succeeded(), eq(variables['RunSamples'], '1')) + - task: PublishCodeCoverageResults@1 + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: "$(Build.SourcesDirectory)/**/Cobertura.xml" + displayName: Publish Code Coverage to DevOps + condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) - # Make coverage targets (specified in coverage_targets.txt) and assemble - # coverage report - - bash: | - make `cat ${{ parameters.ServiceDirectory }}-targets-coverage.txt` - ../tools/reportgenerator "-reports:${{ parameters.CoverageReportPath }}" "-targetdir:." "-reporttypes:Cobertura" - workingDirectory: build - displayName: Generate Code Coverage Data - condition: and(succeeded(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) - - - task: PublishCodeCoverageResults@1 - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: '$(Build.SourcesDirectory)/**/Cobertura.xml' - displayName: Publish Code Coverage to DevOps - condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) - -- job: - steps: - - template: /eng/common/TestResources/remove-test-resources.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + - template: /eng/common/TestResources/remove-test-resources.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} From f3c111893a14cb2f04b365925f94047927512561 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 13 May 2022 19:12:45 -0700 Subject: [PATCH 28/65] maybe now --- .../templates/jobs/archetype-sdk-tests.yml | 625 +++++++++--------- 1 file changed, 316 insertions(+), 309 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 13d5102261..426c503488 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -1,25 +1,25 @@ parameters: - - name: Location - type: string - default: "" - - name: SubscriptionConfiguration - type: string - default: $(sub-config-azure-cloud-test-resources) - - name: ServiceDirectory - type: string - default: not-specified - - name: CtestRegex - type: string - default: .* - - name: Coverage - type: string - default: "enabled" - - name: CoverageReportPath - type: string - default: sdk/*/*/*cov_xml.xml - - name: TimeoutInMinutes - type: number - default: 120 +- name: Location + type: string + default: '' +- name: SubscriptionConfiguration + type: string + default: $(sub-config-azure-cloud-test-resources) +- name: ServiceDirectory + type: string + default: not-specified +- name: CtestRegex + type: string + default: .* +- name: Coverage + type: string + default: 'enabled' +- name: CoverageReportPath + type: string + default: sdk/*/*/*cov_xml.xml +- name: TimeoutInMinutes + type: number + default: 120 # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per @@ -27,306 +27,313 @@ parameters: # https://github.com/Azure/azure-sdk-for-cpp/issues/2944 jobs: - - job: DeployTestResource - steps: - - template: /eng/common/TestResources/deploy-test-resources.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - Location: "westus3" - HsmLocation: "westus3" - SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHSM: "$(EnableHsm)" - - step: ValidateLive - condition: and(succeededOrFailed(), ne(variables['Skip.LiveTest'], 'true')) - timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} - strategy: - matrix: - Linux_x64_gcc5_with_unit_test: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: "x64-linux" - # Can't set CC and CXX to env because it would affect VCPKG building which requires g++ > 7 - # So, this conf will set the CXX for cmake inline. - CmakeEnvArg: "CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake" - BuildArgs: "-j 4" - CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON" - HsmLocation: "eastus" - EnableHsm: true - Linux_x64_with_unit_test: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: "x64-linux" - CmakeArgs: " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_CODE_COVERAGE=ON" - AptDependencies: "gcovr lcov" - CODE_COVERAGE: "${{ parameters.Coverage }}" - # Avoid re-running tests again for code coverage since the tests were previously ran - CODE_COVERAGE_COLLECT_ONLY: 1 - AZURE_CORE_ENABLE_JSON_TESTS: 1 - BuildArgs: "-j 4" - HsmLocation: "canadacentral" - EnableHsm: true - Ubuntu20_x64_with_unit_test: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: "x64-linux" - CmakeArgs: " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON" - AZURE_CORE_ENABLE_JSON_TESTS: 1 - BuildArgs: "-j 4" - HsmLocation: "canadacentral" - EnableHsm: true - Ubuntu20_samples: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: "x64-linux" - # Builds samples and run them against the deployed resources. Samples requires Azure Account, so only works on live tests. - CmakeArgs: " -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Release " - BuildArgs: "-j 4" - RunSamples: 1 - HsmLocation: "eastus2" - EnableHsm: true - Ubuntu20_x64_no_rtti: - Pool: azsdk-pool-mms-ubuntu-1804-general - OSVmImage: MMSUbuntu18.04 - VCPKG_DEFAULT_TRIPLET: "x64-linux" - CmakeArgs: " -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release " - BuildArgs: "-j 4" - HsmLocation: "eastus2" - EnableHsm: true - # Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl - Win_x86_with_unit_test_winHttp: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: "x86-windows-static" - VcpkgInstall: "openssl" - CMAKE_GENERATOR: "Visual Studio 16 2019" - CMAKE_GENERATOR_PLATFORM: Win32 - CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON " - BuildArgs: "-v --parallel 8 --config Release" - WindowsCtestConfig: "-C Release" - HsmLocation: "eastus2" - EnableHsm: true - Win_x86_no_rtti_whit_unit_test: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VcpkgInstall: "libxml2 openssl" - VCPKG_DEFAULT_TRIPLET: "x86-windows-static" - CMAKE_GENERATOR: "Visual Studio 16 2019" - CMAKE_GENERATOR_PLATFORM: Win32 - CmakeArgs: " -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON" - BuildArgs: "-v --parallel 8 --config Release" - WindowsCtestConfig: "-C Release" - HsmLocation: "canadacentral" - EnableHsm: true - Win_x64_with_unit_test_winHttp: - Pool: azsdk-pool-mms-win-2019-general - VcpkgInstall: "openssl" - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: "x64-windows-static" - CMAKE_GENERATOR: "Visual Studio 16 2019" - CMAKE_GENERATOR_PLATFORM: x64 - CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON " - BuildArgs: "-v --parallel 8 --config Release " - AZURE_CORE_ENABLE_JSON_TESTS: 1 - WindowsCtestConfig: "-C Release" - HsmLocation: "westus3" - EnableHsm: true - Win_x64_with_unit_samples_winHttp: - Pool: azsdk-pool-mms-win-2019-general - VcpkgInstall: "openssl" - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: "x64-windows-static" - CMAKE_GENERATOR: "Visual Studio 16 2019" - CMAKE_GENERATOR_PLATFORM: x64 - CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON " - BuildArgs: "-v --parallel 8 --config Release " - AZURE_CORE_ENABLE_JSON_TESTS: 1 - RunSamples: 1 - WindowsCtestConfig: "-C Release" - HsmLocation: "northcentralus" - EnableHsm: true - # specify libcurl to be used on Windows - Win_x86_with_unit_test_libcurl: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: "x86-windows-static" - CMAKE_GENERATOR: "Visual Studio 16 2019" - CMAKE_GENERATOR_PLATFORM: Win32 - CmakeArgs: " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON " - BuildArgs: "-v --parallel 8" - HsmLocation: "westus3" - EnableHsm: true - #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. - Win_x64_with_unit_test_libcurl: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VCPKG_DEFAULT_TRIPLET: "x64-windows-static" - CMAKE_GENERATOR: "Visual Studio 16 2019" - CMAKE_GENERATOR_PLATFORM: x64 - CmakeArgs: " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON " - BuildArgs: "-v --parallel 8 --config Release " - WindowsCtestConfig: "-C Release" - HsmLocation: "westus3" - EnableHsm: true - #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. - Win_x64_with_unit_samples_libcurl: - Pool: azsdk-pool-mms-win-2019-general - OSVmImage: MMS2019 - VcpkgInstall: "curl[winssl] openssl" - VCPKG_DEFAULT_TRIPLET: "x64-windows-static" - CMAKE_GENERATOR: "Visual Studio 16 2019" - CMAKE_GENERATOR_PLATFORM: x64 - CmakeArgs: " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON " - BuildArgs: "-v --parallel 8 --config Release " - RunSamples: 1 - WindowsCtestConfig: "-C Release" - HsmLocation: "northcentralus" - EnableHsm: true - MacOS_x64_with_unit_test: - Pool: Azure Pipelines - OSVmImage: "macOS-10.15" - VCPKG_DEFAULT_TRIPLET: "x64-osx" - CmakeArgs: " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON" - AZURE_CORE_ENABLE_JSON_TESTS: 1 - BuildArgs: "-j 4" - HsmLocation: "northcentralus" - EnableHsm: true - pool: - name: $(Pool) - vmImage: $(OSVmImage) - variables: - CMOCKA_XML_FILE: "%g-test-results.xml" - CMOCKA_MESSAGE_OUTPUT: "xml" - AZURE_ENABLE_STATIC_ANALYSIS: 1 - BuildArgs: "" - WindowsCtestConfig: "" - CmakeEnvArg: "" - CmakeArgs: "" - AZURE_TEST_MODE: "LIVE" - AZURE_LOG_LEVEL: "verbose" - # Surface the ServiceDirectory parameter as an environment variable so tests can take advantage of it. - AZURE_SERVICE_DIRECTORY: ${{ parameters.ServiceDirectory }} - job: - steps: - - checkout: self - submodules: recursive +- job: DeployTestResource + steps: + - template: /eng/common/TestResources/deploy-test-resources.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + Location: "westus3" + HsmLocation: "westus3" + SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + EnableHSM : "$(EnableHsm)" - - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml - parameters: - AgentImage: $(OSVmImage) +- job: ValidateLive + dependsOn: DeployTestResource + condition: and(succeededOrFailed(), ne(variables['Skip.LiveTest'], 'true')) + timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} + strategy: + matrix: + Linux_x64_gcc5_with_unit_test: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: 'x64-linux' + # Can't set CC and CXX to env because it would affect VCPKG building which requires g++ > 7 + # So, this conf will set the CXX for cmake inline. + CmakeEnvArg: 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake' + BuildArgs: '-j 4' + CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON' + HsmLocation: 'eastus' + EnableHsm: true + Linux_x64_with_unit_test: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: 'x64-linux' + CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_CODE_COVERAGE=ON' + AptDependencies: 'gcovr lcov' + CODE_COVERAGE: '${{ parameters.Coverage }}' + # Avoid re-running tests again for code coverage since the tests were previously ran + CODE_COVERAGE_COLLECT_ONLY: 1 + AZURE_CORE_ENABLE_JSON_TESTS: 1 + BuildArgs: '-j 4' + HsmLocation: 'canadacentral' + EnableHsm: true + Ubuntu20_x64_with_unit_test: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: 'x64-linux' + CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON' + AZURE_CORE_ENABLE_JSON_TESTS: 1 + BuildArgs: '-j 4' + HsmLocation: 'canadacentral' + EnableHsm: true + Ubuntu20_samples: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: 'x64-linux' + # Builds samples and run them against the deployed resources. Samples requires Azure Account, so only works on live tests. + CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Release ' + BuildArgs: '-j 4' + RunSamples: 1 + HsmLocation: 'eastus2' + EnableHsm: true + Ubuntu20_x64_no_rtti: + Pool: azsdk-pool-mms-ubuntu-1804-general + OSVmImage: MMSUbuntu18.04 + VCPKG_DEFAULT_TRIPLET: 'x64-linux' + CmakeArgs: ' -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release ' + BuildArgs: '-j 4' + HsmLocation: 'eastus2' + EnableHsm: true + # Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl + Win_x86_with_unit_test_winHttp: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: 'x86-windows-static' + VcpkgInstall: 'openssl' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + CMAKE_GENERATOR_PLATFORM: Win32 + CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' + BuildArgs: '-v --parallel 8 --config Release' + WindowsCtestConfig: "-C Release" + HsmLocation: 'eastus2' + EnableHsm: true + Win_x86_no_rtti_whit_unit_test: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VcpkgInstall: 'libxml2 openssl' + VCPKG_DEFAULT_TRIPLET: 'x86-windows-static' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + CMAKE_GENERATOR_PLATFORM: Win32 + CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' + BuildArgs: '-v --parallel 8 --config Release' + WindowsCtestConfig: "-C Release" + HsmLocation: 'canadacentral' + EnableHsm: true + Win_x64_with_unit_test_winHttp: + Pool: azsdk-pool-mms-win-2019-general + VcpkgInstall: 'openssl' + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + CMAKE_GENERATOR_PLATFORM: x64 + CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' + BuildArgs: '-v --parallel 8 --config Release ' + AZURE_CORE_ENABLE_JSON_TESTS: 1 + WindowsCtestConfig: "-C Release" + HsmLocation: 'westus3' + EnableHsm: true + Win_x64_with_unit_samples_winHttp: + Pool: azsdk-pool-mms-win-2019-general + VcpkgInstall: 'openssl' + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + CMAKE_GENERATOR_PLATFORM: x64 + CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON ' + BuildArgs: '-v --parallel 8 --config Release ' + AZURE_CORE_ENABLE_JSON_TESTS: 1 + RunSamples: 1 + WindowsCtestConfig: "-C Release" + HsmLocation: 'northcentralus' + EnableHsm: true + # specify libcurl to be used on Windows + Win_x86_with_unit_test_libcurl: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: 'x86-windows-static' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + CMAKE_GENERATOR_PLATFORM: Win32 + CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' + BuildArgs: '-v --parallel 8' + HsmLocation: 'westus3' + EnableHsm: true + #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. + Win_x64_with_unit_test_libcurl: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + CMAKE_GENERATOR_PLATFORM: x64 + CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' + BuildArgs: '-v --parallel 8 --config Release ' + WindowsCtestConfig: "-C Release" + HsmLocation: 'westus3' + EnableHsm: true + #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. + Win_x64_with_unit_samples_libcurl: + Pool: azsdk-pool-mms-win-2019-general + OSVmImage: MMS2019 + VcpkgInstall: 'curl[winssl] openssl' + VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + CMAKE_GENERATOR_PLATFORM: x64 + CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON ' + BuildArgs: '-v --parallel 8 --config Release ' + RunSamples: 1 + WindowsCtestConfig: "-C Release" + HsmLocation: 'northcentralus' + EnableHsm: true + MacOS_x64_with_unit_test: + Pool: Azure Pipelines + OSVmImage: 'macOS-10.15' + VCPKG_DEFAULT_TRIPLET: 'x64-osx' + CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON' + AZURE_CORE_ENABLE_JSON_TESTS: 1 + BuildArgs: '-j 4' + HsmLocation: 'northcentralus' + EnableHsm: true + pool: + name: $(Pool) + vmImage: $(OSVmImage) + variables: + CMOCKA_XML_FILE: "%g-test-results.xml" + CMOCKA_MESSAGE_OUTPUT: "xml" + AZURE_ENABLE_STATIC_ANALYSIS: 1 + BuildArgs: "" + WindowsCtestConfig: "" + CmakeEnvArg: "" + CmakeArgs: "" + AZURE_TEST_MODE: "LIVE" + AZURE_LOG_LEVEL: "verbose" + # Surface the ServiceDirectory parameter as an environment variable so tests can take advantage of it. + AZURE_SERVICE_DIRECTORY: ${{ parameters.ServiceDirectory }} - - template: /eng/common/pipelines/templates/steps/bypass-local-dns.yml + steps: + - checkout: self + submodules: recursive - # Add g++5 repo to ubuntu - - bash: sudo sh -c "echo 'deb http://ftp.debian.org/debian/ stretch main' >> /etc/apt/sources.list" - displayName: Add g++ 5 - condition: >- - and( - succeeded(), - contains(variables['OSVmImage'], 'Ubuntu'), - contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake') - ) + - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml + parameters: + AgentImage: $(OSVmImage) - # Install g++5 - - bash: sudo apt-get update & sudo apt-get install g++-5 - displayName: Install g++ 5 - condition: >- - and( - succeeded(), - contains(variables['OSVmImage'], 'Ubuntu'), - contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake') - ) + - template: /eng/common/pipelines/templates/steps/bypass-local-dns.yml - # Install apt dependencies (if appropriate) - - bash: sudo apt install -y $(AptDependencies) - condition: and(succeededOrFailed(), ne(variables['AptDependencies'], '')) - displayName: Install dependencies from apt + # Add g++5 repo to ubuntu + - bash: sudo sh -c "echo 'deb http://ftp.debian.org/debian/ stretch main' >> /etc/apt/sources.list" + displayName: Add g++ 5 + condition: >- + and( + succeeded(), + contains(variables['OSVmImage'], 'Ubuntu'), + contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake') + ) - - template: /eng/pipelines/templates/steps/vcpkg.yml + # Install g++5 + - bash: sudo apt-get update & sudo apt-get install g++-5 + displayName: Install g++ 5 + condition: >- + and( + succeeded(), + contains(variables['OSVmImage'], 'Ubuntu'), + contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake') + ) - - script: | - dotnet tool install -g dotnet-reportgenerator-globaltool - dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools - displayName: Install coverage tools - # CODE_COVERAGE variable is '' (do-not-generate) in all matrix but linux-gcc - # It is 'enabled' by default on linux-gcc but it can be opt-out by each pipeline (disabled) - condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) + # Install apt dependencies (if appropriate) + - bash: sudo apt install -y $(AptDependencies) + condition: and(succeededOrFailed(), ne(variables['AptDependencies'], '')) + displayName: Install dependencies from apt - - template: /eng/pipelines/templates/steps/cmake-build.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - GenerateArgs: $(CmakeArgs) - BuildArgs: "$(BuildArgs)" - Env: "$(CmakeEnvArg)" + - template: /eng/pipelines/templates/steps/vcpkg.yml - # For non multi-config generator use the same build configuration to run tests - # We don't need to set it to invoke ctest - # Visual Studio generator used in CI is a multi-config generator. - # As such, it requires the configuration argument for building and invoking ctest - - script: ctest $(WindowsCtestConfig) -V --tests-regex ${{ parameters.CtestRegex }} --no-compress-output -T Test - workingDirectory: build - displayName: ctest - # Runs only if test-resources are happly deployed. - # unit-tests runs for those configs where samples are not ran. - # This enables to run tests and samples at the same time as different matrix configuration. - # Then unit-tests runs, samples should not run. - condition: and( - succeeded(), - ne(variables['RunSamples'], '1')) + - script: | + dotnet tool install -g dotnet-reportgenerator-globaltool + dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools + displayName: Install coverage tools + # CODE_COVERAGE variable is '' (do-not-generate) in all matrix but linux-gcc + # It is 'enabled' by default on linux-gcc but it can be opt-out by each pipeline (disabled) + condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) - - task: PublishTestResults@2 - inputs: - testResultsFormat: cTest - testResultsFiles: Testing/*/Test.xml - testRunTitle: $(Agent.JobName) - searchFolder: build - mergeTestResults: true - publishRunAttachments: true - displayName: Publish test results - # this step only makes sense when ctest has run - condition: and(succeededOrFailed(), ne(variables['RunSamples'], '1')) + - template: /eng/pipelines/templates/steps/cmake-build.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + GenerateArgs: $(CmakeArgs) + BuildArgs: "$(BuildArgs)" + Env: "$(CmakeEnvArg)" - # Running Samples step. - # Will run samples described on a file name [service]-samples.txt within the build directory. - # For example keyvault-samples.txt. - # The file is written by CMake during configuration when building samples. - - bash: | - IFS=$'\n' - if [[ -f "./${{ parameters.ServiceDirectory }}-samples.txt" ]]; then - for sample in `cat ./${{ parameters.ServiceDirectory }}-samples.txt` - do - echo "**********Running sample: ${sample}" - bash -c "$sample" - status=$? - if [[ $status -eq 0 ]]; then - echo "*********Sample completed*********" - else - echo "*Sample returned a failed code: $status" - exit 1 - fi - done - fi - workingDirectory: build - displayName: "Run Samples for : ${{ parameters.ServiceDirectory }}" - condition: and(succeeded(), eq(variables['RunSamples'], '1')) + # For non multi-config generator use the same build configuration to run tests + # We don't need to set it to invoke ctest + # Visual Studio generator used in CI is a multi-config generator. + # As such, it requires the configuration argument for building and invoking ctest + - script: ctest $(WindowsCtestConfig) -V --tests-regex ${{ parameters.CtestRegex }} --no-compress-output -T Test + workingDirectory: build + displayName: ctest + # Runs only if test-resources are happly deployed. + # unit-tests runs for those configs where samples are not ran. + # This enables to run tests and samples at the same time as different matrix configuration. + # Then unit-tests runs, samples should not run. + condition: and( + succeeded(), + ne(variables['RunSamples'], '1')) - # Make coverage targets (specified in coverage_targets.txt) and assemble - # coverage report - - bash: | - make `cat ${{ parameters.ServiceDirectory }}-targets-coverage.txt` - ../tools/reportgenerator "-reports:${{ parameters.CoverageReportPath }}" "-targetdir:." "-reporttypes:Cobertura" - workingDirectory: build - displayName: Generate Code Coverage Data - condition: and(succeeded(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) + - task: PublishTestResults@2 + inputs: + testResultsFormat: cTest + testResultsFiles: Testing/*/Test.xml + testRunTitle: $(Agent.JobName) + searchFolder: build + mergeTestResults: true + publishRunAttachments: true + displayName: Publish test results + # this step only makes sense when ctest has run + condition: and(succeededOrFailed(), ne(variables['RunSamples'], '1')) - - task: PublishCodeCoverageResults@1 - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: "$(Build.SourcesDirectory)/**/Cobertura.xml" - displayName: Publish Code Coverage to DevOps - condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) + # Running Samples step. + # Will run samples described on a file name [service]-samples.txt within the build directory. + # For example keyvault-samples.txt. + # The file is written by CMake during configuration when building samples. + - bash: | + IFS=$'\n' + if [[ -f "./${{ parameters.ServiceDirectory }}-samples.txt" ]]; then + for sample in `cat ./${{ parameters.ServiceDirectory }}-samples.txt` + do + echo "**********Running sample: ${sample}" + bash -c "$sample" + status=$? + if [[ $status -eq 0 ]]; then + echo "*********Sample completed*********" + else + echo "*Sample returned a failed code: $status" + exit 1 + fi + done + fi + workingDirectory: build + displayName: "Run Samples for : ${{ parameters.ServiceDirectory }}" + condition: and(succeeded(), eq(variables['RunSamples'], '1')) - - template: /eng/common/TestResources/remove-test-resources.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + # Make coverage targets (specified in coverage_targets.txt) and assemble + # coverage report + - bash: | + make `cat ${{ parameters.ServiceDirectory }}-targets-coverage.txt` + ../tools/reportgenerator "-reports:${{ parameters.CoverageReportPath }}" "-targetdir:." "-reporttypes:Cobertura" + workingDirectory: build + displayName: Generate Code Coverage Data + condition: and(succeeded(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) + + - task: PublishCodeCoverageResults@1 + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: '$(Build.SourcesDirectory)/**/Cobertura.xml' + displayName: Publish Code Coverage to DevOps + condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) + +- job: CleanupResources + dependsOn: + - DeployTestResource + - ValidateLive + steps: + - template: /eng/common/TestResources/remove-test-resources.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} From b4e806c2443b1257ba90dd7b74a4b2c9a6ecde75 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 12:20:20 -0700 Subject: [PATCH 29/65] test again --- .../TestResources/deploy-test-resources.yml | 2 +- .../templates/jobs/archetype-sdk-tests.yml | 53 ++++--------------- sdk/keyvault/test-resources.json | 2 +- 3 files changed, 12 insertions(+), 45 deletions(-) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index e868e24842..f6fbab8799 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -54,7 +54,7 @@ steps: -ServiceDirectory '${{ parameters.ServiceDirectory }}' ` -Location '${{ parameters.Location }}' ` -HsmLocation '${{ parameters.HsmLocation }}' ` - -EnableHsm '${{ parameters.EnableHsm }}' ` + -EnableHsm ${{ parameters.EnableHsm }} ` -DeleteAfterHours '${{ parameters.DeleteAfterHours }}' ` @subscriptionConfiguration ` -AdditionalParameters ${{ parameters.ArmTemplateParameters }} ` diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 426c503488..1135b45ce9 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -27,19 +27,7 @@ parameters: # https://github.com/Azure/azure-sdk-for-cpp/issues/2944 jobs: - -- job: DeployTestResource - steps: - - template: /eng/common/TestResources/deploy-test-resources.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - Location: "westus3" - HsmLocation: "westus3" - SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHSM : "$(EnableHsm)" - - job: ValidateLive - dependsOn: DeployTestResource condition: and(succeededOrFailed(), ne(variables['Skip.LiveTest'], 'true')) timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} strategy: @@ -53,8 +41,6 @@ jobs: CmakeEnvArg: 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake' BuildArgs: '-j 4' CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON' - HsmLocation: 'eastus' - EnableHsm: true Linux_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -66,16 +52,14 @@ jobs: CODE_COVERAGE_COLLECT_ONLY: 1 AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: 'canadacentral' - EnableHsm: true - Ubuntu20_x64_with_unit_test: + Ubuntu20_HSM_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 VCPKG_DEFAULT_TRIPLET: 'x64-linux' CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: 'canadacentral' + HsmLocation: 'eastus2' EnableHsm: true Ubuntu20_samples: Pool: azsdk-pool-mms-ubuntu-1804-general @@ -85,16 +69,12 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Release ' BuildArgs: '-j 4' RunSamples: 1 - HsmLocation: 'eastus2' - EnableHsm: true Ubuntu20_x64_no_rtti: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 VCPKG_DEFAULT_TRIPLET: 'x64-linux' CmakeArgs: ' -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release ' BuildArgs: '-j 4' - HsmLocation: 'eastus2' - EnableHsm: true # Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl Win_x86_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general @@ -106,8 +86,6 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" - HsmLocation: 'eastus2' - EnableHsm: true Win_x86_no_rtti_whit_unit_test: Pool: azsdk-pool-mms-win-2019-general OSVmImage: MMS2019 @@ -118,8 +96,6 @@ jobs: CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" - HsmLocation: 'canadacentral' - EnableHsm: true Win_x64_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -131,8 +107,6 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' AZURE_CORE_ENABLE_JSON_TESTS: 1 WindowsCtestConfig: "-C Release" - HsmLocation: 'westus3' - EnableHsm: true Win_x64_with_unit_samples_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -145,8 +119,6 @@ jobs: AZURE_CORE_ENABLE_JSON_TESTS: 1 RunSamples: 1 WindowsCtestConfig: "-C Release" - HsmLocation: 'northcentralus' - EnableHsm: true # specify libcurl to be used on Windows Win_x86_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -156,8 +128,6 @@ jobs: CMAKE_GENERATOR_PLATFORM: Win32 CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8' - HsmLocation: 'westus3' - EnableHsm: true #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -168,8 +138,6 @@ jobs: CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release ' WindowsCtestConfig: "-C Release" - HsmLocation: 'westus3' - EnableHsm: true #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_samples_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -182,8 +150,6 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' RunSamples: 1 WindowsCtestConfig: "-C Release" - HsmLocation: 'northcentralus' - EnableHsm: true MacOS_x64_with_unit_test: Pool: Azure Pipelines OSVmImage: 'macOS-10.15' @@ -191,8 +157,6 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: 'northcentralus' - EnableHsm: true pool: name: $(Pool) vmImage: $(OSVmImage) @@ -261,6 +225,14 @@ jobs: BuildArgs: "$(BuildArgs)" Env: "$(CmakeEnvArg)" + - template: /eng/common/TestResources/deploy-test-resources.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + Location: ${{ parameters.Location }} + HsmLocation: "$(HsmLocation)" + SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + EnableHSM : $(EnableHsm) + # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest # Visual Studio generator used in CI is a multi-config generator. @@ -328,11 +300,6 @@ jobs: displayName: Publish Code Coverage to DevOps condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) -- job: CleanupResources - dependsOn: - - DeployTestResource - - ValidateLive - steps: - template: /eng/common/TestResources/remove-test-resources.yml parameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index b658d4e7f0..1ea67add8a 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -112,7 +112,7 @@ } }, "enableHsm": { - "defaultValue": true, + "defaultValue": false, "type": "Bool", "metadata": { "description": "Whether to enable deployment of Managed HSM. The default is false." From 97dd54ca624f90e9ecc412ee13cd5ca09ca36b31 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 12:38:24 -0700 Subject: [PATCH 30/65] maybe --- eng/common/TestResources/deploy-test-resources.yml | 4 ++-- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 4 ++-- sdk/keyvault/test-resources.json | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index f6fbab8799..01b97d244a 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -4,7 +4,7 @@ parameters: DeleteAfterHours: 8 Location: '' HsmLocation: '' - EnableHsm: false + EnableHSM: false SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) # SubscriptionConfiguration will be splatted into the parameters of the test @@ -54,7 +54,7 @@ steps: -ServiceDirectory '${{ parameters.ServiceDirectory }}' ` -Location '${{ parameters.Location }}' ` -HsmLocation '${{ parameters.HsmLocation }}' ` - -EnableHsm ${{ parameters.EnableHsm }} ` + -EnableHSM ${{ parameters.EnableHSM }} ` -DeleteAfterHours '${{ parameters.DeleteAfterHours }}' ` @subscriptionConfiguration ` -AdditionalParameters ${{ parameters.ArmTemplateParameters }} ` diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 1135b45ce9..173515858d 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -60,7 +60,7 @@ jobs: AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' HsmLocation: 'eastus2' - EnableHsm: true + EnableHSM: true Ubuntu20_samples: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -231,7 +231,7 @@ jobs: Location: ${{ parameters.Location }} HsmLocation: "$(HsmLocation)" SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHSM : $(EnableHsm) + EnableHSM : $(EnableHSM) # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 1ea67add8a..608c58d371 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -111,7 +111,7 @@ "description": "The provisioner OID to grant access to test resources." } }, - "enableHsm": { + "EnableHSM": { "defaultValue": false, "type": "Bool", "metadata": { @@ -273,7 +273,7 @@ "publicNetworkAccess": "Enabled", "networkAcls": "[variables('networkAcls')]" }, - "condition": "[parameters('enableHsm')]" + "condition": "[parameters('EnableHSM')]" } ], "outputs": { @@ -283,11 +283,11 @@ }, "AZURE_ENABLE_HSM": { "type": "Bool", - "value": "[parameters('enableHsm')]" + "value": "[parameters('EnableHSM')]" }, "AZURE_KEYVAULT_HSM_URL": { "type": "String", - "value": "[if(bool(parameters('enableHsm')),reference(variables('hsmName')).hsmUri,variables('azureKeyVaultUrl'))]" + "value": "[if(bool(parameters('EnableHSM')),reference(variables('hsmName')).hsmUri,variables('azureKeyVaultUrl'))]" }, "AZURE_TENANT_ID": { "type": "String", From 175927a8d11dbababfd6f57f846b2df642309610 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 12:50:03 -0700 Subject: [PATCH 31/65] maybe --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 173515858d..c18479f4b4 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -231,7 +231,7 @@ jobs: Location: ${{ parameters.Location }} HsmLocation: "$(HsmLocation)" SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHSM : $(EnableHSM) + EnableHSM : "$(EnableHSM)" # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest From f13b949c3573f128f2b0a08f337a6e38c0eba892 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 13:03:05 -0700 Subject: [PATCH 32/65] maybe 2 --- .../templates/jobs/archetype-sdk-tests.yml | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index c18479f4b4..c23c9b12a5 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -20,7 +20,7 @@ parameters: - name: TimeoutInMinutes type: number default: 120 - + # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per # job) may be possible here: @@ -41,6 +41,8 @@ jobs: CmakeEnvArg: 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake' BuildArgs: '-j 4' CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON' + HsmLocation: '' + EnableHSM: false Linux_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -52,6 +54,8 @@ jobs: CODE_COVERAGE_COLLECT_ONLY: 1 AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' + HsmLocation: '' + EnableHSM: false Ubuntu20_HSM_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -75,6 +79,8 @@ jobs: VCPKG_DEFAULT_TRIPLET: 'x64-linux' CmakeArgs: ' -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release ' BuildArgs: '-j 4' + HsmLocation: '' + EnableHSM: false # Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl Win_x86_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general @@ -86,6 +92,8 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" + HsmLocation: '' + EnableHSM: false Win_x86_no_rtti_whit_unit_test: Pool: azsdk-pool-mms-win-2019-general OSVmImage: MMS2019 @@ -96,6 +104,8 @@ jobs: CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" + HsmLocation: '' + EnableHSM: false Win_x64_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -107,6 +117,8 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' AZURE_CORE_ENABLE_JSON_TESTS: 1 WindowsCtestConfig: "-C Release" + HsmLocation: '' + EnableHSM: false Win_x64_with_unit_samples_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -119,6 +131,8 @@ jobs: AZURE_CORE_ENABLE_JSON_TESTS: 1 RunSamples: 1 WindowsCtestConfig: "-C Release" + HsmLocation: '' + EnableHSM: false # specify libcurl to be used on Windows Win_x86_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -128,6 +142,8 @@ jobs: CMAKE_GENERATOR_PLATFORM: Win32 CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8' + HsmLocation: '' + EnableHSM: false #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -138,6 +154,8 @@ jobs: CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release ' WindowsCtestConfig: "-C Release" + HsmLocation: '' + EnableHSM: false #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_samples_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -150,6 +168,8 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' RunSamples: 1 WindowsCtestConfig: "-C Release" + HsmLocation: '' + EnableHSM: false MacOS_x64_with_unit_test: Pool: Azure Pipelines OSVmImage: 'macOS-10.15' @@ -157,6 +177,8 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' + HsmLocation: '' + EnableHSM: false pool: name: $(Pool) vmImage: $(OSVmImage) @@ -228,10 +250,10 @@ jobs: - template: /eng/common/TestResources/deploy-test-resources.yml parameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} - Location: ${{ parameters.Location }} + Location: "$(HsmLocation)" HsmLocation: "$(HsmLocation)" SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} - EnableHSM : "$(EnableHSM)" + EnableHSM : $(EnableHSM) # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest From b1a9c21cf4a2cb38bb7b76bbad0ff03368ce1a4b Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 13:39:57 -0700 Subject: [PATCH 33/65] try again --- sdk/keyvault/test-resources-post.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 8d40a0fa9f..caa8da390f 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -68,7 +68,7 @@ $([Convert]::ToBase64String($Certificate.RawData, 'InsertLineBreaks')) } # Make sure we deployed a Managed HSM. -if (!$DeploymentOutputs['AZURE_KEYVAULT_HSM_URL']) { +if (!$DeploymentOutputs['AZURE_ENABLE_HSM']) { Log "Managed HSM not deployed; skipping activation" exit } From ed0c9dce3b114d28b884ade1a12ee1252035b803 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 16:15:14 -0700 Subject: [PATCH 34/65] ssssss --- .../TestResources/deploy-test-resources.yml | 2 +- .../templates/jobs/archetype-sdk-tests.yml | 35 +++++-------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index 01b97d244a..95c98e578c 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -41,7 +41,7 @@ steps: - pwsh: | eng/common/scripts/Import-AzModules.ps1 - + $subscriptionConfiguration = @' ${{ parameters.SubscriptionConfiguration }} '@ | ConvertFrom-Json -AsHashtable; diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index c23c9b12a5..52bebf8f8c 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -20,7 +20,11 @@ parameters: - name: TimeoutInMinutes type: number default: 120 - + +variables: + EnableHSM: false + HSMLocation: '' + KVLocation: ${{ parameters.Location }} # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per # job) may be possible here: @@ -41,8 +45,6 @@ jobs: CmakeEnvArg: 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake' BuildArgs: '-j 4' CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON' - HsmLocation: '' - EnableHSM: false Linux_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -54,8 +56,6 @@ jobs: CODE_COVERAGE_COLLECT_ONLY: 1 AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: '' - EnableHSM: false Ubuntu20_HSM_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -63,6 +63,7 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' + KVLocation: 'eastus2' HsmLocation: 'eastus2' EnableHSM: true Ubuntu20_samples: @@ -79,8 +80,6 @@ jobs: VCPKG_DEFAULT_TRIPLET: 'x64-linux' CmakeArgs: ' -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release ' BuildArgs: '-j 4' - HsmLocation: '' - EnableHSM: false # Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl Win_x86_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general @@ -92,8 +91,6 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" - HsmLocation: '' - EnableHSM: false Win_x86_no_rtti_whit_unit_test: Pool: azsdk-pool-mms-win-2019-general OSVmImage: MMS2019 @@ -104,8 +101,6 @@ jobs: CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" - HsmLocation: '' - EnableHSM: false Win_x64_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -117,8 +112,6 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' AZURE_CORE_ENABLE_JSON_TESTS: 1 WindowsCtestConfig: "-C Release" - HsmLocation: '' - EnableHSM: false Win_x64_with_unit_samples_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -131,8 +124,6 @@ jobs: AZURE_CORE_ENABLE_JSON_TESTS: 1 RunSamples: 1 WindowsCtestConfig: "-C Release" - HsmLocation: '' - EnableHSM: false # specify libcurl to be used on Windows Win_x86_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -142,8 +133,6 @@ jobs: CMAKE_GENERATOR_PLATFORM: Win32 CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8' - HsmLocation: '' - EnableHSM: false #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -154,8 +143,6 @@ jobs: CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release ' WindowsCtestConfig: "-C Release" - HsmLocation: '' - EnableHSM: false #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_samples_libcurl: Pool: azsdk-pool-mms-win-2019-general @@ -168,8 +155,6 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' RunSamples: 1 WindowsCtestConfig: "-C Release" - HsmLocation: '' - EnableHSM: false MacOS_x64_with_unit_test: Pool: Azure Pipelines OSVmImage: 'macOS-10.15' @@ -177,8 +162,6 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - HsmLocation: '' - EnableHSM: false pool: name: $(Pool) vmImage: $(OSVmImage) @@ -250,10 +233,10 @@ jobs: - template: /eng/common/TestResources/deploy-test-resources.yml parameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} - Location: "$(HsmLocation)" - HsmLocation: "$(HsmLocation)" - SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + Location: "$(KVLocation)" + HsmLocation: "$(HSMLocation)" EnableHSM : $(EnableHSM) + SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} # For non multi-config generator use the same build configuration to run tests # We don't need to set it to invoke ctest From 8fbc74ab2c4de5fa385ade1ac92ee00964e7af00 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 16:23:33 -0700 Subject: [PATCH 35/65] uyufyut --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 52bebf8f8c..8197f8c4dd 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -21,10 +21,6 @@ parameters: type: number default: 120 -variables: - EnableHSM: false - HSMLocation: '' - KVLocation: ${{ parameters.Location }} # This job uses the legacy matrix format (matrix property of the job, one # build/test scenario per job). A new format (multiple build/test scenarios per # job) may be possible here: @@ -177,6 +173,9 @@ jobs: AZURE_LOG_LEVEL: "verbose" # Surface the ServiceDirectory parameter as an environment variable so tests can take advantage of it. AZURE_SERVICE_DIRECTORY: ${{ parameters.ServiceDirectory }} + EnableHSM: false + HSMLocation: '' + KVLocation: ${{ parameters.Location }} steps: - checkout: self From 1c71e51854842428148148dec44f75338809e5e0 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 17:01:38 -0700 Subject: [PATCH 36/65] maybe now ? --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 8197f8c4dd..3785875828 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -235,6 +235,7 @@ jobs: Location: "$(KVLocation)" HsmLocation: "$(HSMLocation)" EnableHSM : $(EnableHSM) + ArmTemplateParameters: '{"EnableHSM": $(EnableHSM) }' SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} # For non multi-config generator use the same build configuration to run tests From ec0c1817d78b6780f56557aeae6f357958b0ae98 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 17:19:20 -0700 Subject: [PATCH 37/65] try again --- eng/common/TestResources/New-TestResources.ps1 | 6 ++++++ eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 1 - sdk/keyvault/test-resources.json | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index b0ab66ea95..4c7e100209 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -59,6 +59,9 @@ param ( [Parameter()] [string] $Location = '', + [Parameter()] + [bool] $EnableHSM = $false, + [Parameter()] [ValidateSet('AzureCloud', 'AzureUSGovernment', 'AzureChinaCloud', 'Dogfood')] [string] $Environment = 'AzureCloud', @@ -668,6 +671,9 @@ try { if ($TestApplicationSecret) { $templateParameters.Add('testApplicationSecret', $TestApplicationSecret) } + if ($EnableHSM){ + $templateParameters.Add('enableHSM', $EnableHSM) + } $defaultCloudParameters = LoadCloudConfig $Environment MergeHashes $defaultCloudParameters $(Get-Variable templateParameters) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 3785875828..8197f8c4dd 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -235,7 +235,6 @@ jobs: Location: "$(KVLocation)" HsmLocation: "$(HSMLocation)" EnableHSM : $(EnableHSM) - ArmTemplateParameters: '{"EnableHSM": $(EnableHSM) }' SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} # For non multi-config generator use the same build configuration to run tests diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 608c58d371..cae9930d95 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -111,7 +111,7 @@ "description": "The provisioner OID to grant access to test resources." } }, - "EnableHSM": { + "enableHSM": { "defaultValue": false, "type": "Bool", "metadata": { @@ -273,7 +273,7 @@ "publicNetworkAccess": "Enabled", "networkAcls": "[variables('networkAcls')]" }, - "condition": "[parameters('EnableHSM')]" + "condition": "[parameters('enableHSM')]" } ], "outputs": { @@ -283,11 +283,11 @@ }, "AZURE_ENABLE_HSM": { "type": "Bool", - "value": "[parameters('EnableHSM')]" + "value": "[parameters('enableHSM')]" }, "AZURE_KEYVAULT_HSM_URL": { "type": "String", - "value": "[if(bool(parameters('EnableHSM')),reference(variables('hsmName')).hsmUri,variables('azureKeyVaultUrl'))]" + "value": "[if(bool(parameters('enableHSM')),reference(variables('hsmName')).hsmUri,variables('azureKeyVaultUrl'))]" }, "AZURE_TENANT_ID": { "type": "String", From fd23cdacbe20ed288ff4c72851eb12f5939bb22a Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 17:28:48 -0700 Subject: [PATCH 38/65] t/f/1/0 --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 8197f8c4dd..a13e1ad907 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -61,7 +61,7 @@ jobs: BuildArgs: '-j 4' KVLocation: 'eastus2' HsmLocation: 'eastus2' - EnableHSM: true + EnableHSM: 1 Ubuntu20_samples: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -173,7 +173,7 @@ jobs: AZURE_LOG_LEVEL: "verbose" # Surface the ServiceDirectory parameter as an environment variable so tests can take advantage of it. AZURE_SERVICE_DIRECTORY: ${{ parameters.ServiceDirectory }} - EnableHSM: false + EnableHSM: 0 HSMLocation: '' KVLocation: ${{ parameters.Location }} From a86b0249868f210fa8e2f25b8afc2c462fdcafd8 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 17:49:45 -0700 Subject: [PATCH 39/65] cleanup --- .../TestResources/New-TestResources.ps1 | 6 ---- .../TestResources/deploy-test-resources.yml | 4 --- .../templates/jobs/archetype-sdk-tests.yml | 4 +-- sdk/keyvault/test-resources.json | 34 ------------------- 4 files changed, 1 insertion(+), 47 deletions(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index 4c7e100209..b0ab66ea95 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -59,9 +59,6 @@ param ( [Parameter()] [string] $Location = '', - [Parameter()] - [bool] $EnableHSM = $false, - [Parameter()] [ValidateSet('AzureCloud', 'AzureUSGovernment', 'AzureChinaCloud', 'Dogfood')] [string] $Environment = 'AzureCloud', @@ -671,9 +668,6 @@ try { if ($TestApplicationSecret) { $templateParameters.Add('testApplicationSecret', $TestApplicationSecret) } - if ($EnableHSM){ - $templateParameters.Add('enableHSM', $EnableHSM) - } $defaultCloudParameters = LoadCloudConfig $Environment MergeHashes $defaultCloudParameters $(Get-Variable templateParameters) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index 95c98e578c..cbaa1b1934 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -3,8 +3,6 @@ parameters: ArmTemplateParameters: '@{}' DeleteAfterHours: 8 Location: '' - HsmLocation: '' - EnableHSM: false SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources) # SubscriptionConfiguration will be splatted into the parameters of the test @@ -53,8 +51,6 @@ steps: -BaseName 'Generated' ` -ServiceDirectory '${{ parameters.ServiceDirectory }}' ` -Location '${{ parameters.Location }}' ` - -HsmLocation '${{ parameters.HsmLocation }}' ` - -EnableHSM ${{ parameters.EnableHSM }} ` -DeleteAfterHours '${{ parameters.DeleteAfterHours }}' ` @subscriptionConfiguration ` -AdditionalParameters ${{ parameters.ArmTemplateParameters }} ` diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index a13e1ad907..6bb6c03b80 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -174,7 +174,6 @@ jobs: # Surface the ServiceDirectory parameter as an environment variable so tests can take advantage of it. AZURE_SERVICE_DIRECTORY: ${{ parameters.ServiceDirectory }} EnableHSM: 0 - HSMLocation: '' KVLocation: ${{ parameters.Location }} steps: @@ -233,8 +232,7 @@ jobs: parameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} Location: "$(KVLocation)" - HsmLocation: "$(HSMLocation)" - EnableHSM : $(EnableHSM) + ArmTemplateParameters: "@{ enableHsm = $(EnableHSM) }" SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} # For non multi-config generator use the same build configuration to run tests diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index cae9930d95..5b38b22c52 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -117,40 +117,6 @@ "metadata": { "description": "Whether to enable deployment of Managed HSM. The default is false." } - }, - "hsmLocation": { - "defaultValue": "eastus2", - "allowedValues": [ - "australiacentral", - "australiaeast", - "canadacentral", - "canadaeast", - "centralindia", - "centralus", - "eastasia", - "eastus", - "eastus2", - "francecentral", - "japaneast", - "koreacentral", - "northcentralus", - "northeurope", - "southafricanorth", - "southcentralus", - "switzerlandnorth", - "switzerlandwest", - "uaenorth", - "uksouth", - "westcentralus", - "westeurope", - "westus", - "westus2", - "westus3" - ], - "type": "String", - "metadata": { - "description": "The location of the Managed HSM. By default, this is 'eastus2'." - } } }, "variables": { From 1be719f1bcb25d52e6c51075d9bf96bf11831e4b Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 18:08:25 -0700 Subject: [PATCH 40/65] maybe now --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 6bb6c03b80..401a3624e7 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -232,7 +232,7 @@ jobs: parameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} Location: "$(KVLocation)" - ArmTemplateParameters: "@{ enableHsm = $(EnableHSM) }" + ArmTemplateParameters: "@{ enableHsm = [System.Convert]::ToBoolean($(EnableHSM)) }" SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} # For non multi-config generator use the same build configuration to run tests From 58ce990f05237341ab02e9d9534d7123daa3f026 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 18:30:16 -0700 Subject: [PATCH 41/65] edeployment output --- sdk/keyvault/test-resources.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 5b38b22c52..523b4dc9cf 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -248,8 +248,8 @@ "value": "[variables('azureKeyVaultUrl')]" }, "AZURE_ENABLE_HSM": { - "type": "Bool", - "value": "[parameters('enableHSM')]" + "type": "String", + "value": "[if(bool(parameters('enableHSM')),'true','false')]" }, "AZURE_KEYVAULT_HSM_URL": { "type": "String", From aa1a1fd970e974e05d7fb04f5b523f2dcac3afe9 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 18:56:37 -0700 Subject: [PATCH 42/65] oook --- sdk/keyvault/test-resources.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 523b4dc9cf..52c6306d99 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -248,6 +248,10 @@ "value": "[variables('azureKeyVaultUrl')]" }, "AZURE_ENABLE_HSM": { + "type": "Bool", + "value": "[parameters('enableHSM')]" + }, + "AZURE_ENABLE_HSM_STR": { "type": "String", "value": "[if(bool(parameters('enableHSM')),'true','false')]" }, From 8bb2df95c088f4e5593adfffa0d4d82cb0310619 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Mon, 16 May 2022 20:09:45 -0700 Subject: [PATCH 43/65] let's see the envs --- .../test/ut/key_client_base_test.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp index 03caccd47e..fd70f412f7 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp @@ -37,6 +37,12 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam // creating. This also return the name with suffix if the "AZURE_LIVE_TEST_SUFFIX" exists. std::string GetTestName(bool sanitize = true) { + std::cout << "\n Keyvault " << m_keyVaultUrl; + std::cout << "\n HSM " << m_keyVaultHsmUrl; + std::cout << "\n enableHSM" + << Azure::Core::_internal::Environment::GetVariable("AZURE_ENABLE_HSM"); + std::cout << "\n enableHSMSTR" + << Azure::Core::_internal::Environment::GetVariable("AZURE_ENABLE_HSM_STR"); return Azure::Core::Test::TestBase::GetTestNameSuffix(sanitize); } From 1cdeea56696154908743b31c400c4d1f21d35c4a Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 12:14:32 -0700 Subject: [PATCH 44/65] fix 2 tests --- .../test/ut/key_client_base_test.hpp | 8 ++------ .../test/ut/key_client_create_test_live.cpp | 5 ----- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp index fd70f412f7..d5b2b653b1 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp @@ -37,12 +37,8 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam // creating. This also return the name with suffix if the "AZURE_LIVE_TEST_SUFFIX" exists. std::string GetTestName(bool sanitize = true) { - std::cout << "\n Keyvault " << m_keyVaultUrl; - std::cout << "\n HSM " << m_keyVaultHsmUrl; - std::cout << "\n enableHSM" - << Azure::Core::_internal::Environment::GetVariable("AZURE_ENABLE_HSM"); - std::cout << "\n enableHSMSTR" - << Azure::Core::_internal::Environment::GetVariable("AZURE_ENABLE_HSM_STR"); + auto output = m_keyVaultUrl.compare(m_keyVaultHsmUrl) == 0 ? "Same" : "NotSame"; + std::cout << "\n Keyvault and HSM are" << output; return Azure::Core::Test::TestBase::GetTestNameSuffix(sanitize); } diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp index ba60735c59..00c49c9b26 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp @@ -203,9 +203,6 @@ TEST_F(KeyVaultKeyClient, CreateEcHsmKey) auto keyResponse = client.GetKey(keyName); CheckValidResponse(keyResponse); auto keyVaultKey = keyResponse.Value; - EXPECT_EQ(keyVaultKey.Name(), keyName); - EXPECT_TRUE(keyResponse.Value.Properties.Exportable.HasValue()); - EXPECT_FALSE(keyResponse.Value.Properties.Exportable.Value()); EXPECT_FALSE(keyResponse.Value.Properties.ReleasePolicy.HasValue()); EXPECT_TRUE(keyVaultKey.Properties.Enabled.Value()); } @@ -233,8 +230,6 @@ TEST_F(KeyVaultKeyClient, CreateRsaHsmKey) CheckValidResponse(keyResponse); auto keyVaultKey = keyResponse.Value; EXPECT_EQ(keyVaultKey.Name(), keyName); - EXPECT_TRUE(keyResponse.Value.Properties.Exportable.HasValue()); - EXPECT_FALSE(keyResponse.Value.Properties.Exportable.Value()); EXPECT_FALSE(keyResponse.Value.Properties.ReleasePolicy.HasValue()); EXPECT_TRUE(keyVaultKey.Properties.Enabled.Value()); } From 68d7658a687d03b33db9fc84acf07722ae31d0c2 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 13:20:31 -0700 Subject: [PATCH 45/65] another one --- .../test/ut/key_rotation_policy_test_live.cpp | 19 +++++---- sdk/keyvault/test-resources-post.ps1 | 39 +++++++++++++++++++ 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp index 9aa646b674..bde76e5cbf 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_rotation_policy_test_live.cpp @@ -85,13 +85,18 @@ TEST_F(KeyVaultKeyClient, GetRandomBytes) { // NEED TO DISABLE TEST FOR THE MOMENT. // DUE TO ISSUE WITH CREATE EC HSM TEST WHICH FAILS WITH ACTUAL HSM BEING SET IN THE ENVIRONMENT // VARIABLE FILED BUG 3563 TO FIX IT - auto const keyName = GetTestName(); - CreateHsmClient(); - auto const& client = GetClientForTest(keyName); - GetRandomBytesOptions options; - options.Count = 4; - auto result = client.GetRandomBytes(options); - EXPECT_EQ(result.Value.RandomBytes.size(), size_t(options.Count)); + // we actually need to have have an HSM defined + if (m_keyVaultUrl.compare(m_keyVaultHsmUrl) != 0) + { + auto const keyName = GetTestName(); + CreateHsmClient(); + auto const& client = GetClientForTest(keyName); + GetRandomBytesOptions options; + options.Count = 4; + auto result = client.GetRandomBytes(options); + EXPECT_EQ(result.Value.RandomBytes.size(), size_t(options.Count)); + } + EXPECT_TRUE(true); } TEST(GetRandomBytesOptions, Serialize) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index caa8da390f..73b6c3b41d 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -106,7 +106,46 @@ Start-Sleep -Seconds 30 $testApplicationOid = $DeploymentOutputs['CLIENT_OBJECTID'] Log "Creating additional required role assignments for '$testApplicationOid'" +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Administrator' -ObjectID $testApplicationOid $null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Officer' -ObjectID $testApplicationOid $null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto User' -ObjectID $testApplicationOid +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Policy Administrator' -ObjectID $testApplicationOid +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Auditor' -ObjectID $testApplicationOid +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Service Encryption User' -ObjectID $testApplicationOid +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Backup' -ObjectID $testApplicationOid Log "Role assignments created for '$testApplicationOid'" + +$testApplicationId = $DeploymentOutputs['AZURE_CLIENT_ID'] + +Log "Creating additional required role assignments for '$testApplicationOid'" +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Administrator' -ObjectID $testApplicationId +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Officer' -ObjectID $testApplicationId +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto User' -ObjectID $testApplicationId +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Policy Administrator' -ObjectID $testApplicationId +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Auditor' -ObjectID $testApplicationId +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Service Encryption User' -ObjectID $testApplicationId +$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Backup' -ObjectID $testApplicationId + +Log "Role assignments created for '$testApplicationId'" + + +Log "Setting up user environment variables" + +$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_URL", $DeploymentOutputs['AZURE_KEYVAULT_URL'], [System.EnvironmentVariableTarget]::User) +$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_HSM_URL", $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'], [System.EnvironmentVariableTarget]::User) +$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM", $DeploymentOutputs['AZURE_ENABLE_HSM'], [System.EnvironmentVariableTarget]::User) +$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM_STR", $DeploymentOutputs['AZURE_ENABLE_HSM_STR'], [System.EnvironmentVariableTarget]::User) + +Log "Setting up machine environment variables" + +$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_URL", $DeploymentOutputs['AZURE_KEYVAULT_URL'], [System.EnvironmentVariableTarget]::Machine) +$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_HSM_URL", $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'], [System.EnvironmentVariableTarget]::Machine) +$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM", $DeploymentOutputs['AZURE_ENABLE_HSM'], [System.EnvironmentVariableTarget]::Machine) +$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM_STR", $DeploymentOutputs['AZURE_ENABLE_HSM_STR'], [System.EnvironmentVariableTarget]::Machine) + +Log "Done setting up user/machine environment variables" +Log "KV URL " + $DeploymentOutputs['AZURE_KEYVAULT_URL'] +Log "HSM URL " + $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'] +Log "ENABLE HSM" + $DeploymentOutputs['AZURE_ENABLE_HSM'] +Log "ENABLE HSM STR" + $DeploymentOutputs['AZURE_ENABLE_HSM_STR'] From 548dad7e437c9817341ba8947a4490c67e80cc42 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 14:22:48 -0700 Subject: [PATCH 46/65] try try again --- .../test/ut/key_client_base_test.hpp | 4 ++++ sdk/keyvault/test-resources-post.ps1 | 22 +++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp index d5b2b653b1..65bd14a2c9 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp @@ -62,6 +62,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam // Create virtual void SetUp() override { + _putenv_s("AZURE_TEST_MODE", "LIVE"); + _putenv_s("AZURE_KEYVAULT_HSM_URL", "https://gearamamhsm.managedhsm.azure.net/"); + _putenv_s("AZURE_KEYVAULT_URL", "https://gearamakv1.vault.azure.net/"); + Azure::Core::Test::TestBase::SetUpTestBase(AZURE_TEST_RECORDING_DIR); m_keyVaultUrl = GetEnv("AZURE_KEYVAULT_URL"); m_keyVaultHsmUrl = GetEnv("AZURE_KEYVAULT_HSM_URL"); diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 73b6c3b41d..0d28505377 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -68,7 +68,7 @@ $([Convert]::ToBase64String($Certificate.RawData, 'InsertLineBreaks')) } # Make sure we deployed a Managed HSM. -if (!$DeploymentOutputs['AZURE_ENABLE_HSM']) { +if ($DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'] -eq $DeploymentOutputs['AZURE_KEYVAULT_URL']) { Log "Managed HSM not deployed; skipping activation" exit } @@ -130,19 +130,19 @@ $null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Mana Log "Role assignments created for '$testApplicationId'" -Log "Setting up user environment variables" +#Log "Setting up user environment variables" -$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_URL", $DeploymentOutputs['AZURE_KEYVAULT_URL'], [System.EnvironmentVariableTarget]::User) -$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_HSM_URL", $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'], [System.EnvironmentVariableTarget]::User) -$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM", $DeploymentOutputs['AZURE_ENABLE_HSM'], [System.EnvironmentVariableTarget]::User) -$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM_STR", $DeploymentOutputs['AZURE_ENABLE_HSM_STR'], [System.EnvironmentVariableTarget]::User) +#$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_URL", $DeploymentOutputs['AZURE_KEYVAULT_URL'], [System.EnvironmentVariableTarget]::User) +##$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_HSM_URL", $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'], [System.EnvironmentVariableTarget]::User) +#$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM", $DeploymentOutputs['AZURE_ENABLE_HSM'], [System.EnvironmentVariableTarget]::User) +#$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM_STR", $DeploymentOutputs['AZURE_ENABLE_HSM_STR'], [System.EnvironmentVariableTarget]::User) -Log "Setting up machine environment variables" +#Log "Setting up machine environment variables" -$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_URL", $DeploymentOutputs['AZURE_KEYVAULT_URL'], [System.EnvironmentVariableTarget]::Machine) -$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_HSM_URL", $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'], [System.EnvironmentVariableTarget]::Machine) -$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM", $DeploymentOutputs['AZURE_ENABLE_HSM'], [System.EnvironmentVariableTarget]::Machine) -$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM_STR", $DeploymentOutputs['AZURE_ENABLE_HSM_STR'], [System.EnvironmentVariableTarget]::Machine) +#$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_URL", $DeploymentOutputs['AZURE_KEYVAULT_URL'], [System.EnvironmentVariableTarget]::Machine) +#$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_HSM_URL", $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'], [System.EnvironmentVariableTarget]::Machine) +#$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM", $DeploymentOutputs['AZURE_ENABLE_HSM'], [System.EnvironmentVariableTarget]::Machine) +#$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM_STR", $DeploymentOutputs['AZURE_ENABLE_HSM_STR'], [System.EnvironmentVariableTarget]::Machine) Log "Done setting up user/machine environment variables" Log "KV URL " + $DeploymentOutputs['AZURE_KEYVAULT_URL'] From daa284b27fde93cbfba6e5a1dadb30c8ea0f0de6 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 14:29:19 -0700 Subject: [PATCH 47/65] oops --- .../test/ut/key_client_base_test.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp index 65bd14a2c9..d5b2b653b1 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_base_test.hpp @@ -62,10 +62,6 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys { nam // Create virtual void SetUp() override { - _putenv_s("AZURE_TEST_MODE", "LIVE"); - _putenv_s("AZURE_KEYVAULT_HSM_URL", "https://gearamamhsm.managedhsm.azure.net/"); - _putenv_s("AZURE_KEYVAULT_URL", "https://gearamakv1.vault.azure.net/"); - Azure::Core::Test::TestBase::SetUpTestBase(AZURE_TEST_RECORDING_DIR); m_keyVaultUrl = GetEnv("AZURE_KEYVAULT_URL"); m_keyVaultHsmUrl = GetEnv("AZURE_KEYVAULT_HSM_URL"); From 6fde9712a550aa1c9a9190d1badfd0784a5457df Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 16:54:15 -0700 Subject: [PATCH 48/65] powershell error --- sdk/keyvault/test-resources-post.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 0d28505377..5f57beb770 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -95,7 +95,14 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates $wrappingFiles -OutputPath $sdPath +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot\$hsmName-certificate0" "$PSScriptRoot\$hsmName-certificate1" "$PSScriptRoot\$hsmName-certificate2" -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose + +if ( !$? ) { + Write-Host $Error[0].Exception + Write-Error $Error[0] + + exit +} Log "Security domain downloaded to '$sdPath'; Managed HSM is now active at '$hsmUrl'" From e65ca9328d6ad168166fca96334322872bdb3345 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 17:17:06 -0700 Subject: [PATCH 49/65] ps again --- sdk/keyvault/test-resources-post.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 5f57beb770..c3105e0dbe 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -80,7 +80,7 @@ Log 'Creating 3 X509 certificates to activate security domain' $wrappingFiles = foreach ($i in 0..2) { $certificate = New-X509Certificate2 "CN=$($hsmUrl.Host)" - $baseName = "$PSScriptRoot\$hsmName-certificate$i" + $baseName = "$hsmName-certificate$i" Export-X509Certificate2 "$baseName.pfx" $certificate Export-X509Certificate2PEM "$baseName.cer" $certificate @@ -95,7 +95,7 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot\$hsmName-certificate0" "$PSScriptRoot\$hsmName-certificate1" "$PSScriptRoot\$hsmName-certificate2" -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$hsmName-certificate0" "$hsmName-certificate1" "$hsmName-certificate2" -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose if ( !$? ) { Write-Host $Error[0].Exception From b9757cef92ba28672c0c59202ea2cb24780eccd3 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 17:55:45 -0700 Subject: [PATCH 50/65] i hate this so much right now --- sdk/keyvault/test-resources-post.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index c3105e0dbe..a54a8eaea0 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -95,7 +95,7 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$hsmName-certificate0" "$hsmName-certificate1" "$hsmName-certificate2" -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$hsmName-certificate0","$hsmName-certificate1","$hsmName-certificate2" -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose if ( !$? ) { Write-Host $Error[0].Exception From 01121e49f87ef2c1d1236c8c1aa772d75589236e Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 18:18:40 -0700 Subject: [PATCH 51/65] try try again --- sdk/keyvault/test-resources-post.ps1 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index a54a8eaea0..4553720e5a 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -59,7 +59,7 @@ function Export-X509Certificate2([string] $Path, [X509Certificate2] $Certificate function Export-X509Certificate2PEM([string] $Path, [X509Certificate2] $Certificate) { -@" + @" -----BEGIN CERTIFICATE----- $([Convert]::ToBase64String($Certificate.RawData, 'InsertLineBreaks')) -----END CERTIFICATE----- @@ -80,7 +80,7 @@ Log 'Creating 3 X509 certificates to activate security domain' $wrappingFiles = foreach ($i in 0..2) { $certificate = New-X509Certificate2 "CN=$($hsmUrl.Host)" - $baseName = "$hsmName-certificate$i" + $baseName = "$PSScriptRoot/$hsmName-certificate$i" Export-X509Certificate2 "$baseName.pfx" $certificate Export-X509Certificate2PEM "$baseName.cer" $certificate @@ -95,12 +95,13 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$hsmName-certificate0","$hsmName-certificate1","$hsmName-certificate2" -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot/$hsmName-certificate0", "$PSScriptRoot/$hsmName-certificate1", "$PSScriptRoot/$hsmName-certificate2" -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose if ( !$? ) { Write-Host $Error[0].Exception Write-Error $Error[0] - + Write-Host ConvertTo-Json -Object $Error + Write-Error ConvertTo-Json -Object $Error exit } From 052ee5436953ef63bb09f14e22c45dca572e3999 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 18:42:14 -0700 Subject: [PATCH 52/65] try again --- sdk/keyvault/test-resources-post.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 4553720e5a..783a973752 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -89,7 +89,7 @@ $wrappingFiles = foreach ($i in 0..2) { Log "Downloading security domain from '$hsmUrl'" -$sdPath = "$PSScriptRoot\$hsmName-security-domain.key" +$sdPath = "$PSScriptRoot/$hsmName-security-domain.key" if (Test-Path $sdpath) { Log "Deleting old security domain: $sdPath" Remove-Item $sdPath -Force From ce922aaf25a4e4ec72140dc8b2e339d97f2d01cf Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 19:07:53 -0700 Subject: [PATCH 53/65] dsaas --- sdk/keyvault/test-resources-post.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 783a973752..6e1faae681 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -95,7 +95,7 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot/$hsmName-certificate0", "$PSScriptRoot/$hsmName-certificate1", "$PSScriptRoot/$hsmName-certificate2" -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot/$hsmName-certificate0", "$PSScriptRoot/$hsmName-certificate1", "$PSScriptRoot/$hsmName-certificate2" -ErrorAction SilentlyContinue -Verbose if ( !$? ) { Write-Host $Error[0].Exception From 089f631356e34b63e3eb6f43b991343ca117edba Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 19:31:22 -0700 Subject: [PATCH 54/65] rewrwr --- sdk/keyvault/test-resources-post.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 6e1faae681..3d6304164b 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -95,7 +95,7 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot/$hsmName-certificate0", "$PSScriptRoot/$hsmName-certificate1", "$PSScriptRoot/$hsmName-certificate2" -ErrorAction SilentlyContinue -Verbose +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot/$hsmName-certificate0", "$PSScriptRoot/$hsmName-certificate1", "$PSScriptRoot/$hsmName-certificate2" -ErrorAction SilentlyContinue -Verbose -OutputPath $null if ( !$? ) { Write-Host $Error[0].Exception From cde75d72ebe1b9a6e8cdc09b780bb86f7a4a503d Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 17 May 2022 19:55:53 -0700 Subject: [PATCH 55/65] erwrw --- sdk/keyvault/test-resources-post.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 3d6304164b..d598f341e6 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -95,7 +95,7 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot/$hsmName-certificate0", "$PSScriptRoot/$hsmName-certificate1", "$PSScriptRoot/$hsmName-certificate2" -ErrorAction SilentlyContinue -Verbose -OutputPath $null +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot/$hsmName-certificate0", "$PSScriptRoot/$hsmName-certificate1", "$PSScriptRoot/$hsmName-certificate2" -ErrorAction SilentlyContinue -Verbose -OutputPath ./xyz.sds if ( !$? ) { Write-Host $Error[0].Exception From 6522ebc843c3b90f61f83b0d76795717ab908f32 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 18 May 2022 08:20:48 -0700 Subject: [PATCH 56/65] windows? --- .../templates/jobs/archetype-sdk-tests.yml | 8 ++-- sdk/keyvault/test-resources-post.ps1 | 48 ++----------------- 2 files changed, 8 insertions(+), 48 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 401a3624e7..52cb163b1d 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -59,9 +59,6 @@ jobs: CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON' AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - KVLocation: 'eastus2' - HsmLocation: 'eastus2' - EnableHSM: 1 Ubuntu20_samples: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 @@ -97,7 +94,7 @@ jobs: CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" - Win_x64_with_unit_test_winHttp: + HSM_Win_x64_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' OSVmImage: MMS2019 @@ -108,6 +105,9 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' AZURE_CORE_ENABLE_JSON_TESTS: 1 WindowsCtestConfig: "-C Release" + KVLocation: 'eastus2' + HsmLocation: 'eastus2' + EnableHSM: 1 Win_x64_with_unit_samples_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index d598f341e6..3bd64081f7 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -59,7 +59,7 @@ function Export-X509Certificate2([string] $Path, [X509Certificate2] $Certificate function Export-X509Certificate2PEM([string] $Path, [X509Certificate2] $Certificate) { - @" +@" -----BEGIN CERTIFICATE----- $([Convert]::ToBase64String($Certificate.RawData, 'InsertLineBreaks')) -----END CERTIFICATE----- @@ -80,7 +80,7 @@ Log 'Creating 3 X509 certificates to activate security domain' $wrappingFiles = foreach ($i in 0..2) { $certificate = New-X509Certificate2 "CN=$($hsmUrl.Host)" - $baseName = "$PSScriptRoot/$hsmName-certificate$i" + $baseName = "$PSScriptRoot\$hsmName-certificate$i" Export-X509Certificate2 "$baseName.pfx" $certificate Export-X509Certificate2PEM "$baseName.cer" $certificate @@ -89,14 +89,13 @@ $wrappingFiles = foreach ($i in 0..2) { Log "Downloading security domain from '$hsmUrl'" -$sdPath = "$PSScriptRoot/$hsmName-security-domain.key" +$sdPath = "$PSScriptRoot\$hsmName-security-domain.key" if (Test-Path $sdpath) { Log "Deleting old security domain: $sdPath" Remove-Item $sdPath -Force } -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates "$PSScriptRoot/$hsmName-certificate0", "$PSScriptRoot/$hsmName-certificate1", "$PSScriptRoot/$hsmName-certificate2" -ErrorAction SilentlyContinue -Verbose -OutputPath ./xyz.sds - +Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates $wrappingFiles -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose if ( !$? ) { Write-Host $Error[0].Exception Write-Error $Error[0] @@ -114,46 +113,7 @@ Start-Sleep -Seconds 30 $testApplicationOid = $DeploymentOutputs['CLIENT_OBJECTID'] Log "Creating additional required role assignments for '$testApplicationOid'" -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Administrator' -ObjectID $testApplicationOid $null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Officer' -ObjectID $testApplicationOid $null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto User' -ObjectID $testApplicationOid -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Policy Administrator' -ObjectID $testApplicationOid -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Auditor' -ObjectID $testApplicationOid -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Service Encryption User' -ObjectID $testApplicationOid -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Backup' -ObjectID $testApplicationOid Log "Role assignments created for '$testApplicationOid'" - -$testApplicationId = $DeploymentOutputs['AZURE_CLIENT_ID'] - -Log "Creating additional required role assignments for '$testApplicationOid'" -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Administrator' -ObjectID $testApplicationId -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Officer' -ObjectID $testApplicationId -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto User' -ObjectID $testApplicationId -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Policy Administrator' -ObjectID $testApplicationId -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Auditor' -ObjectID $testApplicationId -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Crypto Service Encryption User' -ObjectID $testApplicationId -$null = New-AzKeyVaultRoleAssignment -HsmName $hsmName -RoleDefinitionName 'Managed HSM Backup' -ObjectID $testApplicationId - -Log "Role assignments created for '$testApplicationId'" - - -#Log "Setting up user environment variables" - -#$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_URL", $DeploymentOutputs['AZURE_KEYVAULT_URL'], [System.EnvironmentVariableTarget]::User) -##$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_HSM_URL", $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'], [System.EnvironmentVariableTarget]::User) -#$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM", $DeploymentOutputs['AZURE_ENABLE_HSM'], [System.EnvironmentVariableTarget]::User) -#$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM_STR", $DeploymentOutputs['AZURE_ENABLE_HSM_STR'], [System.EnvironmentVariableTarget]::User) - -#Log "Setting up machine environment variables" - -#$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_URL", $DeploymentOutputs['AZURE_KEYVAULT_URL'], [System.EnvironmentVariableTarget]::Machine) -#$null = [Environment]::SetEnvironmentVariable("AZURE_KEYVAULT_HSM_URL", $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'], [System.EnvironmentVariableTarget]::Machine) -#$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM", $DeploymentOutputs['AZURE_ENABLE_HSM'], [System.EnvironmentVariableTarget]::Machine) -#$null = [Environment]::SetEnvironmentVariable("AZURE_ENABLE_HSM_STR", $DeploymentOutputs['AZURE_ENABLE_HSM_STR'], [System.EnvironmentVariableTarget]::Machine) - -Log "Done setting up user/machine environment variables" -Log "KV URL " + $DeploymentOutputs['AZURE_KEYVAULT_URL'] -Log "HSM URL " + $DeploymentOutputs['AZURE_KEYVAULT_HSM_URL'] -Log "ENABLE HSM" + $DeploymentOutputs['AZURE_ENABLE_HSM'] -Log "ENABLE HSM STR" + $DeploymentOutputs['AZURE_ENABLE_HSM_STR'] From 0c7e077d05af6035cc79155e93f33a979bcfc14f Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 18 May 2022 12:17:20 -0700 Subject: [PATCH 57/65] libcurl ? --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 52cb163b1d..d3bb1b6ea2 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -105,9 +105,6 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' AZURE_CORE_ENABLE_JSON_TESTS: 1 WindowsCtestConfig: "-C Release" - KVLocation: 'eastus2' - HsmLocation: 'eastus2' - EnableHSM: 1 Win_x64_with_unit_samples_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' @@ -139,6 +136,9 @@ jobs: CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8 --config Release ' WindowsCtestConfig: "-C Release" + KVLocation: 'eastus2' + HsmLocation: 'eastus2' + EnableHSM: 1 #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_samples_libcurl: Pool: azsdk-pool-mms-win-2019-general From 62eb999e70ef5e398c7e27fccd0d3d2eac812c9f Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 18 May 2022 13:02:54 -0700 Subject: [PATCH 58/65] ??? --- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 4 ++-- sdk/keyvault/test-resources.json | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index d3bb1b6ea2..682889a398 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -94,7 +94,7 @@ jobs: CmakeArgs: ' -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON' BuildArgs: '-v --parallel 8 --config Release' WindowsCtestConfig: "-C Release" - HSM_Win_x64_with_unit_test_winHttp: + Win_x64_with_unit_test_winHttp: Pool: azsdk-pool-mms-win-2019-general VcpkgInstall: 'openssl' OSVmImage: MMS2019 @@ -127,7 +127,7 @@ jobs: CmakeArgs: ' -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON ' BuildArgs: '-v --parallel 8' #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. - Win_x64_with_unit_test_libcurl: + HSM_Win_x64_with_unit_test_libcurl: Pool: azsdk-pool-mms-win-2019-general OSVmImage: MMS2019 VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 52c6306d99..a169e8cc63 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -125,9 +125,14 @@ "hsmName": "[concat(parameters('baseName'), 'hsm')]", "networkAcls": { "bypass": "AzureServices", + "defaultAction": "Allow", "virtualNetworkRules": [], - "ipRules": [], - "defaultAction": "Allow" + "ipRules": [ + { + "value": "0.0.0.0/0" + } + ] + } }, "resources": [ @@ -226,6 +231,7 @@ "apiVersion": "[variables('hsmApiVersion')]", "name": "[variables('hsmName')]", "location": "[parameters('location')]", + "publicNetworkAccess": "Enabled", "sku": { "family": "B", "name": "Standard_B1" From 0c824c23ec52ce1899fbc5b4cd9f662792f6ffef Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 18 May 2022 13:36:42 -0700 Subject: [PATCH 59/65] retry --- sdk/keyvault/test-resources-post.ps1 | 24 ++++++++++++++---------- sdk/keyvault/test-resources.json | 1 - 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 3bd64081f7..370bc4d256 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -22,8 +22,12 @@ param ( # By default stop for any error. if (!$PSBoundParameters.ContainsKey('ErrorAction')) { - $ErrorActionPreference = 'Stop' + $ErrorActionPreference = 'Stop' } +#Retry for errors +$ErrorRetries = 5 +$RetryTimeout = 30; + function Log($Message) { Write-Host ('{0} - {1}' -f [DateTime]::Now.ToLongTimeString(), $Message) @@ -59,7 +63,7 @@ function Export-X509Certificate2([string] $Path, [X509Certificate2] $Certificate function Export-X509Certificate2PEM([string] $Path, [X509Certificate2] $Certificate) { -@" + @" -----BEGIN CERTIFICATE----- $([Convert]::ToBase64String($Certificate.RawData, 'InsertLineBreaks')) -----END CERTIFICATE----- @@ -94,14 +98,14 @@ if (Test-Path $sdpath) { Log "Deleting old security domain: $sdPath" Remove-Item $sdPath -Force } - -Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates $wrappingFiles -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose -if ( !$? ) { - Write-Host $Error[0].Exception - Write-Error $Error[0] - Write-Host ConvertTo-Json -Object $Error - Write-Error ConvertTo-Json -Object $Error - exit +for($i = 0; $i -lt $ErrorRetries; $i++){ + Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates $wrappingFiles -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose + + if ( !$? ) { + Write-Host $Error[0].Exception + continue + } + break } Log "Security domain downloaded to '$sdPath'; Managed HSM is now active at '$hsmUrl'" diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index a169e8cc63..d845f16417 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -231,7 +231,6 @@ "apiVersion": "[variables('hsmApiVersion')]", "name": "[variables('hsmName')]", "location": "[parameters('location')]", - "publicNetworkAccess": "Enabled", "sku": { "family": "B", "name": "Standard_B1" From 72db6109a4ba9b69dec6a66010842f3884a181fc Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 18 May 2022 14:00:40 -0700 Subject: [PATCH 60/65] retyr message , api version --- sdk/keyvault/test-resources-post.ps1 | 2 ++ sdk/keyvault/test-resources.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/keyvault/test-resources-post.ps1 b/sdk/keyvault/test-resources-post.ps1 index 370bc4d256..edbdbad4ac 100644 --- a/sdk/keyvault/test-resources-post.ps1 +++ b/sdk/keyvault/test-resources-post.ps1 @@ -99,6 +99,8 @@ if (Test-Path $sdpath) { Remove-Item $sdPath -Force } for($i = 0; $i -lt $ErrorRetries; $i++){ + Log 'Sleeping for 30 seconds to allow resource to become available' + Start-Sleep -Seconds 30 Export-AzKeyVaultSecurityDomain -Name $hsmName -Quorum 2 -Certificates $wrappingFiles -OutputPath $sdPath -ErrorAction SilentlyContinue -Verbose if ( !$? ) { diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index d845f16417..b197e858a4 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -121,7 +121,7 @@ }, "variables": { "azureKeyVaultUrl": "[format('https://{0}{1}/', parameters('baseName'), parameters('keyVaultDomainSuffix'))]", - "hsmApiVersion": "2021-04-01-preview", + "hsmApiVersion": "2021-11-01-preview", "hsmName": "[concat(parameters('baseName'), 'hsm')]", "networkAcls": { "bypass": "AzureServices", From d57494653dbab2b0d9678db1735a99829eca2833 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Wed, 18 May 2022 14:26:30 -0700 Subject: [PATCH 61/65] again --- sdk/keyvault/test-resources.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index b197e858a4..4e20d4c751 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -127,12 +127,7 @@ "bypass": "AzureServices", "defaultAction": "Allow", "virtualNetworkRules": [], - "ipRules": [ - { - "value": "0.0.0.0/0" - } - ] - + "ipRules": [] } }, "resources": [ From 413f660d43f0cc8152bf24d42fb7032feca3bcbe Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 20 May 2022 11:17:35 -0700 Subject: [PATCH 62/65] ok maybe --- .../test/ut/key_client_create_test_live.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp index 00c49c9b26..3ce79bfbee 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp @@ -203,6 +203,8 @@ TEST_F(KeyVaultKeyClient, CreateEcHsmKey) auto keyResponse = client.GetKey(keyName); CheckValidResponse(keyResponse); auto keyVaultKey = keyResponse.Value; + EXPECT_EQ(keyVaultKey.Name(), keyName); + EXPECT_TRUE(keyResponse.Value.Properties.Exportable.HasValue()); EXPECT_FALSE(keyResponse.Value.Properties.ReleasePolicy.HasValue()); EXPECT_TRUE(keyVaultKey.Properties.Enabled.Value()); } @@ -253,6 +255,9 @@ std::string BinaryToHexString(std::vector const& src) // temporary while i get the live tests working TEST_F(KeyVaultKeyClient, DISABLED_ReleaseKey) { +#if __GNUC__ == 5 + EXPECT_TRUE(true); +#else auto const keyName = GetTestName() + "2"; auto const& client = GetClientForTest(keyName); @@ -310,6 +315,7 @@ TEST_F(KeyVaultKeyClient, DISABLED_ReleaseKey) auto result2 = client.ReleaseKey(keyName, keyResponse.Value.Properties.Version, relOpt); EXPECT_NE(result2.Value.Value.length(), size_t(0)); EXPECT_EQ(result2.RawResponse->GetStatusCode(), HttpStatusCode::Ok); +#endif } TEST_F(KeyVaultKeyClient, CreateKeyWithReleasePolicyOptions) From b152571e3ec2d580e14143309100a5cb6b9aa731 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 20 May 2022 11:17:52 -0700 Subject: [PATCH 63/65] dssds --- .../test/ut/key_client_create_test_live.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp index 3ce79bfbee..4156f40129 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp +++ b/sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_create_test_live.cpp @@ -204,7 +204,6 @@ TEST_F(KeyVaultKeyClient, CreateEcHsmKey) CheckValidResponse(keyResponse); auto keyVaultKey = keyResponse.Value; EXPECT_EQ(keyVaultKey.Name(), keyName); - EXPECT_TRUE(keyResponse.Value.Properties.Exportable.HasValue()); EXPECT_FALSE(keyResponse.Value.Properties.ReleasePolicy.HasValue()); EXPECT_TRUE(keyVaultKey.Properties.Enabled.Value()); } From a455317eb8e6c82ff679792f9f1be81aed929d68 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 20 May 2022 12:34:34 -0700 Subject: [PATCH 64/65] final updates --- eng/common/TestResources/deploy-test-resources.yml | 1 - eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 3 +-- sdk/keyvault/test-resources.json | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index cbaa1b1934..26b0683e4d 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -39,7 +39,6 @@ steps: - pwsh: | eng/common/scripts/Import-AzModules.ps1 - $subscriptionConfiguration = @' ${{ parameters.SubscriptionConfiguration }} '@ | ConvertFrom-Json -AsHashtable; diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index 682889a398..fd4f07bc18 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -52,7 +52,7 @@ jobs: CODE_COVERAGE_COLLECT_ONLY: 1 AZURE_CORE_ENABLE_JSON_TESTS: 1 BuildArgs: '-j 4' - Ubuntu20_HSM_x64_with_unit_test: + Ubuntu20_x64_with_unit_test: Pool: azsdk-pool-mms-ubuntu-1804-general OSVmImage: MMSUbuntu18.04 VCPKG_DEFAULT_TRIPLET: 'x64-linux' @@ -137,7 +137,6 @@ jobs: BuildArgs: '-v --parallel 8 --config Release ' WindowsCtestConfig: "-C Release" KVLocation: 'eastus2' - HsmLocation: 'eastus2' EnableHSM: 1 #AZURE_CORE_ENABLE_JSON_TESTS: 1 # Testing Json lib on Win+WinHttp only, No need to repeat here as it is independent to the http transport adapter. Win_x64_with_unit_samples_libcurl: diff --git a/sdk/keyvault/test-resources.json b/sdk/keyvault/test-resources.json index 4e20d4c751..acb70c5e34 100644 --- a/sdk/keyvault/test-resources.json +++ b/sdk/keyvault/test-resources.json @@ -280,4 +280,4 @@ "value": "[parameters('testApplicationOid')]" } } -} \ No newline at end of file +} From 5a902cdf7d2d32e8eb429ebb037f5b40a0f867f8 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 20 May 2022 12:41:58 -0700 Subject: [PATCH 65/65] missing line --- eng/common/TestResources/deploy-test-resources.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index 26b0683e4d..7eeeda847f 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -39,6 +39,7 @@ steps: - pwsh: | eng/common/scripts/Import-AzModules.ps1 + $subscriptionConfiguration = @' ${{ parameters.SubscriptionConfiguration }} '@ | ConvertFrom-Json -AsHashtable;