-
Notifications
You must be signed in to change notification settings - Fork 129
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
Recordings for storage #3194
Recordings for storage #3194
Conversation
Recordings for storage blobs
datalake recordings
…cpp into recordings-story
ci fixes
/azp run cpp - storage |
Azure Pipelines successfully started running 1 pipeline(s). |
…cpp into recordings-story
file shares recordings
Queues recordings
…cpp into recordings-story
/azp run cpp - storage |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me confirm one thing first, when running in LIVE mode, are different pipeline (Linux, Windows x64, Windows x86 etc.) running against the same storage account or different storage accounts? Since you've removed randomness, there could be problems if they run against the same account.
auto appendBlobClient = Azure::Storage::Blobs::AppendBlobClient::CreateFromConnectionString( | ||
StandardStorageConnectionString(), m_containerName, RandomString()); | ||
|
||
auto const testName(GetTestName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes it obscure to use auto
keyword here. I cannot figure out what the type is at the first glance. How about
const std::string testName = GetTestName();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const std::string testName(GetTestName());
that's how I did other places.
Yes, each pipeline creates an instance of storage, so, it won't be collision 💥 |
Finally got coverage for cpp - storage - ci: |
The coverage looks real good. |
It's a little bit below the real coverage from cpp - storage ( live test ) because some tests are LIVEONLY like sas and some tests depending on datetimes comparison |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vhvb1989 ,this is a huge PR and it may take quite some time for me to review it. Unfortunately, I have some higher priority task to do recently. So maybe I cannot review it until Feb.
Can you hold on to any making changes to Storage tests? Otherwise there would be lots of conflicts. Also? Since all these changes are for tests only. Can we just notice that the Coverage is still the same for approving? And then you can gradually keep reviewing in the future and I can address any detail you see in there. You know, waiting until Feb will be hard to keep this PR on sync |
/azp run cpp - storage |
Azure Pipelines successfully started running 1 pipeline(s). |
All right, I'll try to spare some time to review this PR before Feb. |
/azp run cpp - storage |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep reviewing the rest of the PR tomorrow
@@ -207,7 +207,7 @@ jobs: | |||
Location: ${{ parameters.Location }} | |||
SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} | |||
|
|||
- script: ctest -C Debug --tests-regex ${{ parameters.CtestRegex }} --no-compress-output -T Test | |||
- script: ctest -V -C Debug --tests-regex ${{ parameters.CtestRegex }} --no-compress-output -T Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR
|
||
- RECORD | ||
|
||
When setting `AZURE_TEST_MODE=RECORD`, test cases will run the as when running `LIVE`. All the AZURE service network responses are recorded in a json file within the /recordings folder from the /test/ut directory. Use this test mode to generate pre-recorded data to be used on `PLAYBACK` mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test cases will run the as when running
LIVE
.
extra the
?
*/ | ||
class WithMemoryBodyStream : public Azure::Core::IO::BodyStream { | ||
private: | ||
std::vector<uint8_t> m_memory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to make a copy here.
} | ||
|
||
public: | ||
CircularBodyStream(size_t size, uint8_t fillWith) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is used in storage tests. But buffer with the same byte or with circular data is far from ideal for storage testing scenario. Consider using runtime-generating random data that only depends on seed and offset. Here is a good example. We always use it for storage tests.
// than 10Kb) and download it later. | ||
// The request for upload will contain the payload to upload. | ||
// Then the request for download will use the symbol to generate a bodyStream. | ||
std::unique_ptr<uint8_t> m_symbol; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since m_symbol
is never null, why do we need std::unique_ptr
here? How about just
uint8_t m_symbol;
|
||
public: | ||
const static Azure::ETag DummyETag; | ||
const static Azure::ETag DummyETag2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move DummyMd5
and DummyCrc64
here.
std::string name(m_testContext.GetTestSuiteName() + m_testContext.GetTestName()); | ||
// Make sure the name is less than 63 characters long | ||
auto const nameSize = name.size(); | ||
size_t const maxContainerNameSize = 63; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, we have a naming rule for const variables. They should start with uppercase letters.
return x * 1024 * 1024 * 1024 * 1024; | ||
} | ||
|
||
class CryptFunctionsTest : public StorageTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use StorageTest
if the definition is empty?
template <class T> T InitClientOptions() | ||
{ | ||
// Run instrumentation before creating the client | ||
T options; | ||
PrepareOptions(options); | ||
return options; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need template here?
How about just
void InitClientOptions(Azure::Core::_internal::ClientOptions& options) {
PrepareOptions(options);
}
Or mayber we should make PrepareOptions
protected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to enable InitClientOptions() to be called without creating the options first. Like:
auto client = BlobClient(url, credential, InitClientOptions());
otherwise, the pattern would be
BlobClientOptions options;
InitClientOptions(options); // The name would change to PreparaClientOptions
auto client = BlobClient(url, credential, options);
Azure::Storage::Blobs::BlobClientOptions options; | ||
|
||
m_client = InitTestClient< | ||
Azure::Storage::Blobs::BlobContainerClient, | ||
Azure::Storage::Blobs::BlobClientOptions>( | ||
Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString( | ||
StandardStorageConnectionString(), m_containerName) | ||
.GetUrl(), | ||
&m_credential, | ||
options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need InitTestClient
at all in the first place. What's the value of this function, with all the complexity of template stuff?
Azure::Storage::Blobs::BlobClientOptions options;
InitClientOptions(options);
m_client = std::make_unique<Azure::Storage::Blobs::BlobContainerClient>(
Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString(
StandardStorageConnectionString(), m_containerName).GetUrl(),
&m_credential,
options);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InitTestClient<ClientClass, OptionsClass>() make it possible to re-use this call from any service. It is useful for any test case that creates a client with a tokenCredential.
The method is not a must-call method, anyway. From the test case, we can call InitClientOptions and InitCredential as well.
At the end, what we need is to let the test-framework to take care of updating the client options and credentials to support playback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quit. This PR is too complicated. Let's just merge it. What's the worst thing that can happen anyway.
/azp run cpp - storage |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run cpp - storage |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run cpp - storage |
Azure Pipelines successfully started running 1 pipeline(s). |
Recordings for storage