diff --git a/.gitignore b/.gitignore index 2b3a003e55..f426b11b3d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ [Rr]eleases/ x64/ x86/ -bld/ +bld*/ [Bb]in/ [Oo]bj/ [Ll]og/ diff --git a/.vscode/cspell.json b/.vscode/cspell.json index f4dc3a9d1a..efe3977771 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -11,6 +11,8 @@ "*.exe", "*.a", "*.lib", + "*.yaml", + "**/libcurl-stress-test/README.md", ".github/CODEOWNERS", ".gitignore", ".vscode/cspell.json", diff --git a/eng/common/pipelines/templates/jobs/perf.yml b/eng/common/pipelines/templates/jobs/perf.yml new file mode 100644 index 0000000000..3d3a3f6e31 --- /dev/null +++ b/eng/common/pipelines/templates/jobs/perf.yml @@ -0,0 +1,142 @@ +parameters: +- name: Variables + type: object + default: [] +- name: OperatingSystems + type: string + default: 'Linux' +- name: Language + type: string + default: '' +- name: InstallLanguageSteps + type: stepList + default: [] +- name: ServiceDirectory + type: string + default: '' +- name: Services + type: string + default: '' +- name: PackageVersions + type: string + default: '.*' +- name: Tests + type: string + default: '.*' +- name: Arguments + type: string + default: '.*' +- name: Iterations + type: number + default: '5' +- name: AdditionalArguments + type: string + default: '' +- name: EnvVars + type: object + default: {} + +resources: + repositories: + - repository: azure-sdk-tools + type: github + endpoint: Azure + name: Azure/azure-sdk-tools + ref: main + +variables: +- ${{ parameters.Variables }} + +jobs: +- job: Perf + timeoutInMinutes: 360 + strategy: + matrix: + ${{ if contains(parameters.OperatingSystems, 'Linux') }}: + Linux: + Pool: 'azsdk-pool-mms-ubuntu-2004-perf' + OsVmImage: 'MMSUbuntu20.04' + MatrixName: 'Linux' + ${{ if contains(parameters.OperatingSystems, 'Windows') }}: + Windows: + Pool: 'azsdk-pool-mms-win-2019-perf' + OsVmImage: 'MMS2019' + MatrixName: 'Windows' + pool: + name: $(Pool) + vmImage: $(OSVmImage) + steps: + - checkout: self + path: s + + - checkout: azure-sdk-tools + path: s/azure-sdk-tools + + - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml + parameters: + AgentImage: $(OSVmImage) + + - ${{ parameters.InstallLanguageSteps }} + + - template: /eng/common/TestResources/deploy-test-resources.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + Location: westus + ResourceType: perf + + - pwsh: | + set-content -path config.yml -value "WorkingDirectories:" + add-content -path config.yml -value " ${{ parameters.Language }}: $(Agent.BuildDirectory)/s" + workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation + displayName: Create config.yml + + - script: >- + dotnet run -- run + --no-sync + --languages ${{ parameters.Language }} + --services "${{ parameters.Services }}" + --package-versions "${{ parameters.PackageVersions }}" + --tests "${{ parameters.Tests }}" + --arguments "${{ parameters.Arguments }}" + --iterations ${{ parameters.Iterations }} + ${{ parameters.AdditionalArguments }} + workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation + env: + ${{ each var in parameters.EnvVars }}: + ${{ var.key }}: ${{ var.value }} + displayName: Run perf tests + + - pwsh: | + get-content results.txt + workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results + displayName: Print results.txt + condition: always() + + - pwsh: | + get-content results.csv + workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results + displayName: Print results.csv + condition: always() + + - pwsh: | + get-content results.md + workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results + displayName: Print results.md + condition: always() + + - pwsh: | + get-content results.json + workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results + displayName: Print results.json + condition: always() + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results + artifactName: results-$(MatrixName) + condition: always() + + - template: /eng/common/TestResources/remove-test-resources.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + ResourceType: perf diff --git a/eng/common/scripts/Detect-Api-Changes.ps1 b/eng/common/scripts/Detect-Api-Changes.ps1 index 1c9cdf696b..572ef43e1c 100644 --- a/eng/common/scripts/Detect-Api-Changes.ps1 +++ b/eng/common/scripts/Detect-Api-Changes.ps1 @@ -27,6 +27,7 @@ function Submit-Request($filePath, $packageName) if (!$repoName) { $repoName = "azure/azure-sdk-for-$LanguageShort" } + $reviewFileName = "$($packageName)_$($LanguageShort).json" $query = [System.Web.HttpUtility]::ParseQueryString('') $query.Add('artifactName', $ArtifactName) $query.Add('buildId', $BuildId) @@ -35,6 +36,12 @@ function Submit-Request($filePath, $packageName) $query.Add('repoName', $repoName) $query.Add('pullRequestNumber', $PullRequestNumber) $query.Add('packageName', $packageName) + $query.Add('language', $LanguageShort) + $reviewFileFullName = Join-Path -Path $ArtifactPath $packageName $reviewFileName + if (Test-Path $reviewFileFullName) + { + $query.Add('codeFile', $reviewFileName) + } $uri = [System.UriBuilder]$APIViewUri $uri.query = $query.toString() Write-Host "Request URI: $($uri.Uri.OriginalString)" @@ -65,7 +72,7 @@ function Should-Process-Package($pkgPath, $packageName) # Get package info from json file created before updating version to daily dev $pkgInfo = Get-Content $pkgPropPath | ConvertFrom-Json $packagePath = $pkgInfo.DirectoryPath - $modifiedFiles = Get-ChangedFiles -DiffPath "$packagePath/*" -DiffFilterType '' + $modifiedFiles = @(Get-ChangedFiles -DiffPath "$packagePath/*" -DiffFilterType '') $filteredFileCount = $modifiedFiles.Count Write-Host "Number of modified files for package: $filteredFileCount" return ($filteredFileCount -gt 0 -and $pkgInfo.IsNewSdk) @@ -80,7 +87,6 @@ function Log-Input-Params() Write-Host "Language: $($Language)" Write-Host "Commit SHA: $($CommitSha)" Write-Host "Repo Name: $($RepoFullName)" - Write-Host "Package Name: $($PackageName)" } Log-Input-Params diff --git a/eng/common/scripts/Helpers/Metadata-Helpers.ps1 b/eng/common/scripts/Helpers/Metadata-Helpers.ps1 index d5cd1af642..ba6f32b7d7 100644 --- a/eng/common/scripts/Helpers/Metadata-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Metadata-Helpers.ps1 @@ -141,8 +141,7 @@ function GenerateDocsMsMetadata($originalMetadata, $language, $languageDisplayNa "ms.service"= $msService } $updatedMetadata = compare-and-merge-metadata -original $originalMetadata -updated $metadataTable - return "--- -$updatedMetadata---`r`n" + return "---`r`n$updatedMetadata---`r`n" } function ServiceLevelReadmeNameStyle($serviceName) { diff --git a/eng/common/scripts/Service-Level-Readme-Automation.ps1 b/eng/common/scripts/Service-Level-Readme-Automation.ps1 index 0fc334dd6b..1bef012293 100644 --- a/eng/common/scripts/Service-Level-Readme-Automation.ps1 +++ b/eng/common/scripts/Service-Level-Readme-Automation.ps1 @@ -76,16 +76,12 @@ function update-metadata-table($readmeFolder, $readmeName, $serviceName, $msServ $readmePath = Join-Path $readmeFolder -ChildPath $readmeName $readmeContent = Get-Content -Path $readmePath -Raw $match = $readmeContent -match "^---\n*(?(.*\n?)*?)---\n*(?(.*\n?)*)" - if (!$match) { - # $Language, $LanguageDisplayName are the variables globally defined in Language-Settings.ps1 - $metadataString = GenerateDocsMsMetadata -language $Language -languageDisplayName $LanguageDisplayName -serviceName $serviceName ` - -tenantId $TenantId -clientId $ClientId -clientSecret $ClientSecret ` - -msService $msService - Set-Content -Path $readmePath -Value "$metadataString$readmeContent" -NoNewline - return + $restContent = $readmeContent + $metadata = "" + if ($match) { + $restContent = $Matches["content"].trim() + $metadata = $Matches["metadata"].trim() } - $restContent = $Matches["content"].trim() - $metadata = $Matches["metadata"].trim() # $Language, $LanguageDisplayName are the variables globally defined in Language-Settings.ps1 $metadataString = GenerateDocsMsMetadata -originalMetadata $metadata -language $Language -languageDisplayName $LanguageDisplayName -serviceName $serviceName ` -tenantId $TenantId -clientId $ClientId -clientSecret $ClientSecret ` @@ -98,7 +94,7 @@ function generate-markdown-table($readmeFolder, $readmeName, $packageInfo, $moni $tableContent = "" # Here is the table, the versioned value will foreach ($pkg in $packageInfo) { - $repositoryLink = "$RepositoryUri/$($pkg.Package)" + $repositoryLink = "$PackageRepositoryUri/$($pkg.Package)" if (Test-Path "Function:$GetRepositoryLinkFn") { $repositoryLink = &$GetRepositoryLinkFn -packageInfo $pkg } diff --git a/eng/common/scripts/Test-SampleMetadata.ps1 b/eng/common/scripts/Test-SampleMetadata.ps1 index d5681e85d3..6ce31c2095 100644 --- a/eng/common/scripts/Test-SampleMetadata.ps1 +++ b/eng/common/scripts/Test-SampleMetadata.ps1 @@ -73,7 +73,7 @@ process { Write-Error "File '$($file.FullName)' contains invalid product slug: $product" -TargetObject $file ` -Category InvalidData -CategoryTargetName $product -CategoryTargetType string ` - -RecommendedAction 'Use only product slugs listed at https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=master#product' + -RecommendedAction 'Use only product slugs listed at https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=main#product' } } @@ -95,7 +95,7 @@ end { } begin { - # https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=master#product + # https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=main#product $productSlugs = @( "ai-builder", "aspnet", @@ -358,6 +358,7 @@ begin { "ef-core", "ef6", "expression-studio", + "language-service", "m365-ems", "m365-ems-cloud-app-security", "m365-ems-configuration-manager", @@ -498,7 +499,7 @@ Checks sample markdown files' frontmatter for invalid information. .DESCRIPTION Given a collection of markdown files, their frontmatter - if present - is checked for invalid information, including: -Invalid product slugs, i.e. those not listed in https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=master#product. +Invalid product slugs, i.e. those not listed in https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=main#product. .PARAMETER Path Specifies the path to an item to search. Wildcards are permitted. diff --git a/eng/common/scripts/Update-DocsMsMetadata.ps1 b/eng/common/scripts/Update-DocsMsMetadata.ps1 index c0b7d55563..b6b696758a 100644 --- a/eng/common/scripts/Update-DocsMsMetadata.ps1 +++ b/eng/common/scripts/Update-DocsMsMetadata.ps1 @@ -95,7 +95,7 @@ function GetAdjustedReadmeContent($ReadmeContent, $PackageInfo, $PackageMetadata $foundTitle = "" if ($ReadmeContent -match $TITLE_REGEX) { - $ReadmeContent = $ReadmeContent -replace $TITLE_REGEX, "`${0} - Version $($PackageInfo.Version) `n" + $ReadmeContent = $ReadmeContent -replace $TITLE_REGEX, "`${0} - version $($PackageInfo.Version) `n" $foundTitle = $matches["filetitle"] } diff --git a/eng/common/testproxy/test-proxy-docker.yml b/eng/common/testproxy/test-proxy-docker.yml index df2548ab77..52a7c807a3 100644 --- a/eng/common/testproxy/test-proxy-docker.yml +++ b/eng/common/testproxy/test-proxy-docker.yml @@ -1,10 +1,11 @@ parameters: rootFolder: '$(Build.SourcesDirectory)' targetVersion: '' + templateRoot: '$(Build.SourcesDirectory)' steps: - pwsh: | - $(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1 + ${{ parameters.templateRoot }}/eng/common/scripts/trust-proxy-certificate.ps1 displayName: 'Language Specific Certificate Trust' - pwsh: | @@ -12,7 +13,7 @@ steps: displayName: 'Dump active docker information' - pwsh: | - $(Build.SourcesDirectory)/eng/common/testproxy/docker-start-proxy.ps1 -Mode start -TargetFolder "${{ parameters.rootFolder }}" -VersionOverride="${{ parameters.targetVersion }}" + ${{ parameters.templateRoot }}/eng/common/testproxy/docker-start-proxy.ps1 -Mode start -TargetFolder "${{ parameters.rootFolder }}" -VersionOverride="${{ parameters.targetVersion }}" displayName: 'Run the docker container' - pwsh: | diff --git a/eng/common/testproxy/test-proxy-tool.yml b/eng/common/testproxy/test-proxy-tool.yml index 7b5fedaaeb..679ad2108d 100644 --- a/eng/common/testproxy/test-proxy-tool.yml +++ b/eng/common/testproxy/test-proxy-tool.yml @@ -2,14 +2,15 @@ parameters: rootFolder: '$(Build.SourcesDirectory)' runProxy: true targetVersion: '' + templateRoot: '$(Build.SourcesDirectory)' steps: - pwsh: | - $(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1 + ${{ parameters.templateRoot }}/eng/common/scripts/trust-proxy-certificate.ps1 displayName: 'Language Specific Certificate Trust' - pwsh: | - $version = $(Get-Content "$(Build.SourcesDirectory)/eng/common/testproxy/target_version.txt" -Raw).Trim() + $version = $(Get-Content "${{ parameters.templateRoot }}/eng/common/testproxy/target_version.txt" -Raw).Trim() $overrideVersion = "${{ parameters.targetVersion }}" if($overrideVersion) { @@ -29,7 +30,7 @@ steps: - ${{ if eq(parameters.runProxy, 'true') }}: - pwsh: | - Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Path]$(Build.SourcesDirectory)/eng/common/testproxy/dotnet-devcert.pfx" + Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Path]${{ parameters.templateRoot }}/eng/common/testproxy/dotnet-devcert.pfx" Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Password]password" Write-Host "##vso[task.setvariable variable=PROXY_MANUAL_START]true" displayName: 'Configure Kestrel and PROXY_MANUAL_START Variables' @@ -37,13 +38,13 @@ steps: - pwsh: | Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe ` -ArgumentList "--storage-location ${{ parameters.rootFolder }}" ` - -NoNewWindow -PassThru -RedirectStandardOutput $(Build.SourcesDirectory)/test-proxy.log + -NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.templateRoot }}/test-proxy.log displayName: 'Run the testproxy - windows' condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT')) # nohup does NOT continue beyond the current session if you use it within powershell - bash: | - nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > $(Build.SourcesDirectory)/test-proxy.log & + nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > ${{ parameters.templateRoot }}/test-proxy.log & displayName: "Run the testproxy - linux/mac" condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT')) workingDirectory: "${{ parameters.rootFolder }}" diff --git a/eng/pipelines/templates/stages/archetype-cpp-release.yml b/eng/pipelines/templates/stages/archetype-cpp-release.yml index 21f35c8ad6..e4070400a6 100644 --- a/eng/pipelines/templates/stages/archetype-cpp-release.yml +++ b/eng/pipelines/templates/stages/archetype-cpp-release.yml @@ -108,7 +108,7 @@ stages: - pwsh: | $branchName = "azure-sdk-for-cpp-${{ artifact.Name }}-$(Build.BuildId)" if ('$(VcpkgForkBranchName)') { - Write-Host "Using queue time branch name" + Write-Host "Using queue time branch name" $branchName = '$(VcpkgForkBranchName)' } Write-Host "##vso[task.setvariable variable=PrBranchName]$branchName" @@ -164,14 +164,12 @@ stages: CommitMsg: Update vcpkg-configuration.json BaseRepoBranch: $(DefaultBranch) - # Set $(HasChanges) to $true so that - # create-pull-request.yml completes the push and PR - # submission steps. This is contegnent upon - # `$(PublishToVcpkg)` being `true`. `$(PublishToVcpkg)` is - # set in `vcpkg-publish.yml` - - pwsh: Write-Host "##vso[task.setvariable variable=HasChanges]$true" - condition: and(succeeded(), eq(variables['PublishToVcpkg'], 'true')) - displayName: Set $(HasChanges) to $true for create-pull-request.yml + # Set $(HasChanges) to $(PublishToVcpkg) so that + # create-pull-request.yml creates or does not create a PR + # based on the deicision of the step that determines + # whether to publish to vcpkg. + - pwsh: Write-Host "##vso[task.setvariable variable=HasChanges]$(PublishToVcpkg)" + displayName: Set $(HasChanges) to $(PublishToVcpkg) for create-pull-request.yml - template: /eng/common/pipelines/templates/steps/set-default-branch.yml parameters: diff --git a/sdk/attestation/azure-security-attestation/vcpkg/Config.cmake.in b/sdk/attestation/azure-security-attestation/vcpkg/Config.cmake.in index a5e4700f81..1872375c39 100644 --- a/sdk/attestation/azure-security-attestation/vcpkg/Config.cmake.in +++ b/sdk/attestation/azure-security-attestation/vcpkg/Config.cmake.in @@ -4,7 +4,7 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) -find_dependency(azure-core-cpp "1.5.0") +find_dependency(azure-core-cpp "1.7.0") find_dependency(OpenSSL) include("${CMAKE_CURRENT_LIST_DIR}/azure-security-attestation-cppTargets.cmake") diff --git a/sdk/attestation/azure-security-attestation/vcpkg/vcpkg.json b/sdk/attestation/azure-security-attestation/vcpkg/vcpkg.json index bf420be4ac..a92569c2d8 100644 --- a/sdk/attestation/azure-security-attestation/vcpkg/vcpkg.json +++ b/sdk/attestation/azure-security-attestation/vcpkg/vcpkg.json @@ -14,7 +14,7 @@ { "name": "azure-core-cpp", "default-features": false, - "version>=": "1.7.0-beta.1" + "version>=": "1.7.0" }, { "name": "vcpkg-cmake", diff --git a/sdk/core/azure-core/CMakeLists.txt b/sdk/core/azure-core/CMakeLists.txt index 6d94397403..4cf4415ad1 100644 --- a/sdk/core/azure-core/CMakeLists.txt +++ b/sdk/core/azure-core/CMakeLists.txt @@ -214,6 +214,10 @@ if(BUILD_TESTING) add_subdirectory(test/nlohmann-json-test) endif() add_subdirectory(test/fault-injector) + + if(BUILD_TRANSPORT_CURL) + add_subdirectory(test/libcurl-stress-test) + endif() endif() if (BUILD_PERFORMANCE_TESTS) diff --git a/sdk/core/azure-core/test/libcurl-stress-test/CMakeLists.txt b/sdk/core/azure-core/test/libcurl-stress-test/CMakeLists.txt new file mode 100644 index 0000000000..e802aaa385 --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: MIT + +cmake_minimum_required(VERSION 3.13) + +project(azure-core-libcurl-stress-test LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +add_executable( + azure-core-libcurl-stress-test + libcurl_stress_test.cpp +) + +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}/) diff --git a/sdk/core/azure-core/test/libcurl-stress-test/Chart.yaml b/sdk/core/azure-core/test/libcurl-stress-test/Chart.yaml new file mode 100644 index 0000000000..8b3a5f87bf --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/Chart.yaml @@ -0,0 +1,16 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: MIT + +apiVersion: v2 +name: libcurl-stress-test +description: An example of c++ stress test +version: 0.0.1 +appVersion: v0.1 +annotations: + stressTest: 'true' # enable auto-discovery of this test via `find-all-stress-packages.ps1` + namespace: 'azuresdkforcpp' + +dependencies: +- name: stress-test-addons + version: 0.1.19 + 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 new file mode 100644 index 0000000000..1cdc7c7f49 --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/Dockerfile @@ -0,0 +1,16 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: MIT + +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 + +# install the mem check tool +RUN apt-get update -y +RUN apt-get install valgrind -y + diff --git a/sdk/core/azure-core/test/libcurl-stress-test/README.md b/sdk/core/azure-core/test/libcurl-stress-test/README.md new file mode 100644 index 0000000000..300534d165 --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/README.md @@ -0,0 +1,29 @@ +# Stress test prototype +This is work in progress. It's a prototype of how a stress test would look. This PR is to park the work in progress while being dealing with higher priority issues. +## Components +### Code (https://en.wikipedia.org/wiki/C%2B%2B) +The cpp file represents the code for the test, it will generate a number of invalid URLs and then issue CURL send commands. The requests are expected to fail. The point was that it exposes memory leaks in handling the error cases, which we fixed since. + +### Dockerfile (https://www.docker.com/) +Represents the build file for the container in which the test runs, it is based on ubuntu 22.04 , from mcr. +The main change from default ubuntu is making sure we have the valgrind tool installed. Valgrind is a heap monitoring tool that helps identify potential stack traces that might leak memory. While not 100% effective is is great at reducing the surface are for investigations. + +### Helm chart (https://helm.sh/) +Chart.yaml together with the bicep file(https://docs.microsoft.com/azure/azure-resource-manager/bicep/overview?tabs=bicep) and the deploy job file , represent the helm chart needed to deploy to the docker image built from the dockerfile to the stress cluster and execute the stress test. + +The helm chart creates a pod with a container based on the docker image, and executes the test under valgrind. + +To deploy the chart you will need to run "azure-sdk-for-cpp\eng\common\scripts\stress-testing> .\deploy-stress-tests.ps1 -Namespace azuresdkforcpp -SearchDirectory E:\src\azure-sdk-for-cpp\sdk\core\azure-core\test -PushImage" + +Where namaspace will be created if missing , search directory can be any folder where it will search for charts in it and all it's sub dirs, push image will call it to build the docker image. + +ATM the docker image is build by hand and harcoded in the chart to simplify matters. + +To build the image run "docker build -t stresstesttbiruti6oi24k.acr.io/azuresdkforcpp/curlstress:v8 --build-arg targetTest=azure-core-libcurl-stress-test --build-arg build=on ." + +To push to mcr : "docker push stresstesttbiruti6oi24k.acr.io/azuresdkforcpp/curlstress:v8" +Obviously after logging in to the acr "az acr login -n stresspgs7b6dif73rup6.azurecr.io" + +To use another image you will need to go to line 12 in deploy job and update with your new file. + +Once the deploy succeeds run " kubectl logs -n azuresdkforcpp -f libcurl-stress-test" to grab the logs in real time . \ No newline at end of file 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 new file mode 100644 index 0000000000..698fc6fd8f --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/libcurl_stress_test.cpp @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: MIT + +/** + * @brief Validates the Azure Core transport adapters with fault responses from server. + * + * @note This test requires the Http-fault-injector + * (https://github.com/Azure/azure-sdk-tools/tree/main/tools/http-fault-injector) running. Follow + * the instructions to install and run the server before running this test. + * + */ + +#define REQUESTS 100 +#define WARMUP 100 +#define ROUNDS 100 + +#include +#include +#include + +void SendRequest(std::string target) +{ + std::cout << target << std::endl; + // The transport adapter must allow insecure SSL certs. + Azure::Core::Http::CurlTransportOptions curlOptions; + curlOptions.SslVerifyPeer = false; + auto implementationClient = std::make_shared(curlOptions); + + try + { + + Azure::Core::Context context; + auto request + = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, Azure::Core::Url(target)); + auto response = implementationClient->Send(request, context); + // Make sure to pull all bytes from network. + auto body = response->ExtractBodyStream()->ReadToEnd(); + } + catch (std::exception const&) + { + // don't print exceptions, they are happening at each request, this is the point of the test + } +} + +void Operation(int repetitions) +{ + std::string base = "https://xyz."; + for (int i = 0; i < repetitions; i++) + { + std::cout << i << std::endl; + SendRequest(base + std::to_string(i) + ".abc"); + } +} + +int main(int argc, char**) +{ + // some param was passed to the program, doesn't matter what it is, + // it is meant for the moment to just run a quick iteration to check for sanity of the test. + // since prototype TODO: pass in warmup/rounds/requests as params. + if (argc != 1) + { + std::cout << "--------------\tBUILD TEST\t--------------" << std::endl; + Operation(5); + std::cout << "--------------\tEND BUILD TEST\t--------------" << std::endl; + return 0; + } + + std::cout << "--------------\tSTARTING TEST\t--------------" << std::endl; + std::cout << "--------------\tPRE WARMUP\t--------------" << std::endl; + Operation(WARMUP); + + std::cout << "--------------\tPOST WARMUP\t--------------" << std::endl; + + for (int i = 0; i < ROUNDS; i++) + { + std::cout << "--------------\tTEST ITERATION:" << i << "\t--------------" << std::endl; + Operation(REQUESTS); + + std::cout << "--------------\tDONE ITERATION:" << i << "\t--------------" << std::endl; + } + + return 0; +} 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 new file mode 100644 index 0000000000..d008b28bfd --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/stress-test-resources.bicep @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: MIT +// +// Dummy parameter to handle defaults the script passes in +param testApplicationOid string = '' + +resource config 'Microsoft.AppConfiguration/configurationStores@2020-07-01-preview' = { + name: 'config-${resourceGroup().name}' + location: resourceGroup().location + sku: { + name: 'Standard' + } +} + +output RESOURCE_GROUP string = resourceGroup().name +output AZURE_CLIENT_OID string = testApplicationOid 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 new file mode 100644 index 0000000000..17c13ebee5 --- /dev/null +++ b/sdk/core/azure-core/test/libcurl-stress-test/templates/deploy-job.yaml @@ -0,0 +1,22 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# SPDX-License-Identifier: MIT +{{- include "stress-test-addons.deploy-job-template.from-pod" (list . "stress.deploy-example") -}} +{{- define "stress.deploy-example" -}} +metadata: + labels: + testName: "libcurl-stress-test" + name: "libcurl-stress-test" +spec: + containers: + - name: libcurl-stress-test + image: stresspgs7b6dif73rup6.azurecr.io/azuresdkforcpp/curlstress:latest + imagePullPolicy: Always + command: + [ + "valgrind", + "--tool=memcheck", + "-s", + "./azure-core-libcurl-stress-test", + ] + {{- include "stress-test-addons.container-env" . | nindent 6 }} +{{- end -}} diff --git a/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md index a3ad0491f7..63171c8ca4 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 4.1.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 4.1.0-beta.1 (2022-07-07) ### Features Added diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/private/package_version.hpp b/sdk/keyvault/azure-security-keyvault-certificates/src/private/package_version.hpp index ee2c3e9f99..55e836f964 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/private/package_version.hpp +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/private/package_version.hpp @@ -13,7 +13,7 @@ #define AZURE_SECURITY_KEYVAULT_CERTIFICATES_VERSION_MAJOR 4 #define AZURE_SECURITY_KEYVAULT_CERTIFICATES_VERSION_MINOR 1 #define AZURE_SECURITY_KEYVAULT_CERTIFICATES_VERSION_PATCH 0 -#define AZURE_SECURITY_KEYVAULT_CERTIFICATES_VERSION_PRERELEASE "beta.1" +#define AZURE_SECURITY_KEYVAULT_CERTIFICATES_VERSION_PRERELEASE "beta.2" #define AZURE_SECURITY_KEYVAULT_CERTIFICATES_VERSION_ITOA_HELPER(i) #i #define AZURE_SECURITY_KEYVAULT_CERTIFICATES_VERSION_ITOA(i) \ diff --git a/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md index 0bf3216cbe..5bc04107a4 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 4.3.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 4.3.0-beta.1 (2022-07-07) ### Features Added diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/private/package_version.hpp b/sdk/keyvault/azure-security-keyvault-keys/src/private/package_version.hpp index 53d984b152..a79e5bbb04 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/private/package_version.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/src/private/package_version.hpp @@ -13,7 +13,7 @@ #define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_MAJOR 4 #define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_MINOR 3 #define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_PATCH 0 -#define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_PRERELEASE "beta.1" +#define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_PRERELEASE "beta.2" #define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_ITOA_HELPER(i) #i #define AZURE_SECURITY_KEYVAULT_KEYS_VERSION_ITOA(i) \ diff --git a/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md index e848b7c34a..a8d5bab494 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 4.1.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 4.1.0-beta.1 (2022-07-07) ### Features Added diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/private/package_version.hpp b/sdk/keyvault/azure-security-keyvault-secrets/src/private/package_version.hpp index 7b5d417fbd..23e0cc9253 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/private/package_version.hpp +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/private/package_version.hpp @@ -13,7 +13,7 @@ #define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MAJOR 4 #define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_MINOR 1 #define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PATCH 0 -#define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PRERELEASE "beta.1" +#define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_PRERELEASE "beta.2" #define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA_HELPER(i) #i #define AZURE_SECURITY_KEYVAULT_SECRETS_VERSION_ITOA(i) \