Skip to content

Commit

Permalink
Stress test (Azure#3820)
Browse files Browse the repository at this point in the history
* mem leak fix

* PR comments fix

* PR comments

* seems to work?

* clang

* curl again

* add first stress test

* also update gitignore

* missing line

* only linux

* clang typo format

* typo 2

* PR comments

* cspell

* remove terminator
  • Loading branch information
gearama authored and LarryOsterman committed Jul 29, 2022
1 parent 94055dd commit 97a3f76
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sdk/core/azure-core/test/libcurl-stress-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ target_link_libraries(azure-core-libcurl-stress-test PRIVATE azure-core)
create_map_file(azure-core-libcurl-stress-test azure-core-libcurl-stress-test.map)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Dockerfile
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)

find_program(DOCKER_EXECUTABLE docker)
#if docker is found try to build the docker image in the defined docker_build stage which should be run after build
if(DOCKER_EXECUTABLE)
add_custom_target(docker_build
COMMAND ${DOCKER_EXECUTABLE} build --build-arg targetTest=azure-core-libcurl-stress-test --build-arg build=on --tag=azuresdkforcpp/curlstress -f Dockerfile .)
endif()
2 changes: 2 additions & 0 deletions sdk/core/azure-core/test/libcurl-stress-test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ RUN chmod +x ./$targetTest
RUN apt-get update -y
RUN apt-get install valgrind -y

# execute under memcheck tool
RUN valgrind --tool=memcheck -s ./$targetTest $build
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

#include <azure/core.hpp>
#include <azure/core/http/curl_transport.hpp>
#include <fstream>
#include <ios>
#include <iostream>
#include <memory>
#include <stdlib.h>
#include <string>
#include <vector>

void SendRequest(std::string target)
{
Expand All @@ -26,10 +32,16 @@ void SendRequest(std::string target)
curlOptions.SslVerifyPeer = false;
auto implementationClient = std::make_shared<Azure::Core::Http::CurlTransport>(curlOptions);

#elif (BUILD_TRANSPORT_WINHTTP_ADAPTER)
Azure::Core::Http::WinHttpTransportOptions winHttpOptions;
auto implementationClient = std::make_shared<Azure::Core::Http::WinHttpTransport>(winHttpOptions);
#endif
try
{

Azure::Core::Context context;
// auto duration = std::chrono::milliseconds(1000);
// auto deadline = std::chrono::system_clock::now() + duration;
auto request
= Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, Azure::Core::Url(target));
auto response = implementationClient->Send(request, context);
Expand Down

0 comments on commit 97a3f76

Please sign in to comment.