diff --git a/sdk/core/azure-core/test/libcurl-stress-test/.helmignore b/sdk/core/azure-core/test/libcurl-stress-test/.helmignore new file mode 100644 index 000000000..09902ce23 --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/.helmignore @@ -0,0 +1,9 @@ +Dockerfile +*.go +*.bat +*.txt +*.ps1 +*.cpp +*.md +azure-core-libcurl-stress-test +[Bb]in/ diff --git a/sdk/core/azure-core/test/libcurl-stress-test/CMakeLists.txt b/sdk/core/azure-core/test/libcurl-stress-test/CMakeLists.txt index e802aaa38..67b6fd6a8 100644 --- a/sdk/core/azure-core/test/libcurl-stress-test/CMakeLists.txt +++ b/sdk/core/azure-core/test/libcurl-stress-test/CMakeLists.txt @@ -15,5 +15,5 @@ add_executable( 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}/) +file(COPY ${CMAKE_CURRENT_BINARY_DIR} + DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin) diff --git a/sdk/core/azure-core/test/libcurl-stress-test/Chart.yaml b/sdk/core/azure-core/test/libcurl-stress-test/Chart.yaml index 8b3a5f87b..8b1f26a00 100644 --- a/sdk/core/azure-core/test/libcurl-stress-test/Chart.yaml +++ b/sdk/core/azure-core/test/libcurl-stress-test/Chart.yaml @@ -4,7 +4,7 @@ apiVersion: v2 name: libcurl-stress-test description: An example of c++ stress test -version: 0.0.1 +version: 0.0.2 appVersion: v0.1 annotations: stressTest: 'true' # enable auto-discovery of this test via `find-all-stress-packages.ps1` @@ -12,5 +12,5 @@ annotations: dependencies: - name: stress-test-addons - version: 0.1.19 + version: ~0.2.0 repository: https://stresstestcharts.blob.core.windows.net/helm/ diff --git a/sdk/core/azure-core/test/libcurl-stress-test/Dockerfile b/sdk/core/azure-core/test/libcurl-stress-test/Dockerfile index 1cdc7c7f4..43dc3889d 100644 --- a/sdk/core/azure-core/test/libcurl-stress-test/Dockerfile +++ b/sdk/core/azure-core/test/libcurl-stress-test/Dockerfile @@ -3,12 +3,9 @@ FROM mcr.microsoft.com/mirror/docker/library/ubuntu:22.04 -ARG targetTest -ARG build - # copy the tagrget binary -ADD $targetTest ./$targetTest -RUN chmod +x ./$targetTest +COPY ./bin/libcurl-stress-test/azure-core-libcurl-stress-test ./azure-core-libcurl-stress-test +RUN chmod +x ./azure-core-libcurl-stress-test # install the mem check tool RUN apt-get update -y diff --git a/sdk/core/azure-core/test/libcurl-stress-test/deploy.ps1 b/sdk/core/azure-core/test/libcurl-stress-test/deploy.ps1 new file mode 100644 index 000000000..cdd1e5a80 --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/deploy.ps1 @@ -0,0 +1,2 @@ +Set-Location $PSScriptRoot +pwsh "../../../../../eng/common/scripts/stress-testing/deploy-stress-tests.ps1" -Login -PushImages diff --git a/sdk/core/azure-core/test/libcurl-stress-test/generatedValues.yaml b/sdk/core/azure-core/test/libcurl-stress-test/generatedValues.yaml new file mode 100644 index 000000000..d76365457 --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/generatedValues.yaml @@ -0,0 +1,8 @@ +scenarios: +- image: Dockerfile + Scenario: cpp-constantDetach + imageBuildDir: ./ + memory: 1.5Gi + testTarget: azure-core-libcurl-stress-test + imageTag: stresspgs7b6dif73rup6.azurecr.io/gearama/libcurl-stress-test/dockerfile:gearama + diff --git a/sdk/core/azure-core/test/libcurl-stress-test/libcurl_stress_test.cpp b/sdk/core/azure-core/test/libcurl-stress-test/libcurl_stress_test.cpp index 698fc6fd8..06a4b4709 100644 --- a/sdk/core/azure-core/test/libcurl-stress-test/libcurl_stress_test.cpp +++ b/sdk/core/azure-core/test/libcurl-stress-test/libcurl_stress_test.cpp @@ -44,11 +44,11 @@ void SendRequest(std::string target) void Operation(int repetitions) { - std::string base = "https://xyz."; + std::string base = "https://bing.com."; for (int i = 0; i < repetitions; i++) { std::cout << i << std::endl; - SendRequest(base + std::to_string(i) + ".abc"); + SendRequest(base); // + std::to_string(i) + ".abc"); } } diff --git a/sdk/core/azure-core/test/libcurl-stress-test/scenarios-matrix.yaml b/sdk/core/azure-core/test/libcurl-stress-test/scenarios-matrix.yaml new file mode 100644 index 000000000..0b344332a --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/scenarios-matrix.yaml @@ -0,0 +1,16 @@ +displayNames: + # this makes it so these don't show up in the scenario names, + # since they're just clutter. + 1.5Gi": "" + 4Gi": "" + image: "" +matrix: + images: + cpp: + image: Dockerfile + imageBuildDir: "./" + scenarios: + constantDetach: + testTarget: azure-core-libcurl-stress-test + memory: "1.5Gi" + \ No newline at end of file diff --git a/sdk/core/azure-core/test/libcurl-stress-test/stress-test-resources.bicep b/sdk/core/azure-core/test/libcurl-stress-test/stress-test-resources.bicep index d008b28bf..636bf0596 100644 --- a/sdk/core/azure-core/test/libcurl-stress-test/stress-test-resources.bicep +++ b/sdk/core/azure-core/test/libcurl-stress-test/stress-test-resources.bicep @@ -1,16 +1,27 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// SPDX-License-Identifier: MIT -// -// Dummy parameter to handle defaults the script passes in -param testApplicationOid string = '' +@description('The base resource name.') +param baseName string = resourceGroup().name -resource config 'Microsoft.AppConfiguration/configurationStores@2020-07-01-preview' = { - name: 'config-${resourceGroup().name}' - location: resourceGroup().location +@description('The client OID to grant access to test resources.') +param testApplicationOid string + +var apiVersion = '2017-04-01' +// Uncomment this if you want to test against the southeastasia nodes. +//var location = 'southeastasia' +var location = resourceGroup().location +var authorizationRuleName_var = '${baseName}/RootManageSharedAccessKey' +var authorizationRuleNameNoManage_var = '${baseName}/NoManage' +var serviceBusDataOwnerRoleId = '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/090c5cfd-751d-490a-894a-3ce6f1109419' + +resource servicebus 'Microsoft.ServiceBus/namespaces@2018-01-01-preview' = { + name: baseName + location: location sku: { name: 'Standard' + tier: 'Standard' + } + properties: { + zoneRedundant: false } } -output RESOURCE_GROUP string = resourceGroup().name -output AZURE_CLIENT_OID string = testApplicationOid +output QUEUE_NAME_WITH_SESSIONS string = 'testQueueWithSessions' diff --git a/sdk/core/azure-core/test/libcurl-stress-test/templates/deploy-job.yaml b/sdk/core/azure-core/test/libcurl-stress-test/templates/deploy-job.yaml index 17c13ebee..39a621b16 100644 --- a/sdk/core/azure-core/test/libcurl-stress-test/templates/deploy-job.yaml +++ b/sdk/core/azure-core/test/libcurl-stress-test/templates/deploy-job.yaml @@ -4,12 +4,11 @@ {{- define "stress.deploy-example" -}} metadata: labels: - testName: "libcurl-stress-test" - name: "libcurl-stress-test" + chaos: "{{ default false .Stress.chaos }}" spec: containers: - - name: libcurl-stress-test - image: stresspgs7b6dif73rup6.azurecr.io/azuresdkforcpp/curlstress:latest + - name: main + image: {{ .Stress.imageTag }} imagePullPolicy: Always command: [ @@ -19,4 +18,8 @@ spec: "./azure-core-libcurl-stress-test", ] {{- include "stress-test-addons.container-env" . | nindent 6 }} + resources: + limits: + memory: {{.Stress.memory }} + cpu: "1" {{- end -}}