-
Notifications
You must be signed in to change notification settings - Fork 154
Backup Tests redo PR #5916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backup Tests redo PR #5916
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -572,7 +572,33 @@ TEST_F(KeyVaultCertificateClientTest, BackupRestoreCertificate) | |||||||
| auto result = response.PollUntilDone(m_defaultWait); | ||||||||
| EXPECT_EQ(result.Value.Name(), certificateName); | ||||||||
| client.PurgeDeletedCertificate(certificateName); | ||||||||
| std::this_thread::sleep_for(m_defaultWait); | ||||||||
| TestSleep(m_defaultWait); | ||||||||
| } | ||||||||
| { | ||||||||
| int retries = 15; | ||||||||
| // before we restore we need to ensure the certificate is purged. | ||||||||
| // since we have no visibility into the purge status we will just wait and check for a few | ||||||||
| // seconds | ||||||||
| while (retries > 0) | ||||||||
| { | ||||||||
| try | ||||||||
| { | ||||||||
| client.GetDeletedCertificate(certificateName); | ||||||||
| } | ||||||||
| catch (Azure::Core::RequestFailedException const&) | ||||||||
| { | ||||||||
| std::cout << std::endl << "- Certificate is gone"; | ||||||||
| break; | ||||||||
| } | ||||||||
| TestSleep(m_defaultWait); | ||||||||
| retries--; | ||||||||
| } | ||||||||
|
|
||||||||
| if (retries == 0) | ||||||||
| { | ||||||||
| std::cout << std::endl << "retries reached 0"; | ||||||||
| EXPECT_TRUE(false); | ||||||||
|
Comment on lines
+599
to
+600
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI: Another mechanism to add output messages for tests that fail, instead of
This way, you only output that error message if the test assertion fails. You can also use: In cases like this, where you want to fail a test if it reaches this point, rather than using Here are a couple example usages of that: azure-sdk-for-cpp/sdk/eventhubs/azure-messaging-eventhubs/test/ut/eventhubs_admin_client_test.cpp Lines 68 to 69 in d609c00
azure-sdk-for-cpp/sdk/identity/azure-identity/test/ut/azure_pipelines_credential_test.cpp Line 573 in d609c00
|
||||||||
| } | ||||||||
| } | ||||||||
| { | ||||||||
| auto responseRestore = client.RestoreCertificateBackup(certBackup.Value.Certificate); | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.