From 40cf5608afdb5e7f8b4285a714a10207a3d5d6e1 Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Wed, 24 Aug 2022 14:19:31 -0700 Subject: [PATCH] Moved winhttp tests to WS2022 for WSL support (#3898) * Moved winhttp tests to WS2022 for WSL support * Windows 2022 images has VS 2022 not 2019 * Fixed get-binarysizes script to account for WS 2022 image; formatted platform matrix files * Install squid proxies * Fixed typo in Install-WSL script * Added WS2022 to live tests * Cleaned up platform matrix platforms; removed code coverage exception to proxy tests * Fixed two compiler warnings reported by the cognitive services team --- .vscode/cspell.json | 4 +- .../stages/platform-matrix-live.json | 310 ++++++++-------- .../templates/stages/platform-matrix.json | 334 ++++++++++-------- eng/scripts/Get-BinarySizes.ps1 | 23 +- eng/scripts/Install-WSL.ps1 | 14 + .../azure-core/inc/azure/core/context.hpp | 8 + sdk/core/azure-core/test/ut/CMakeLists.txt | 6 +- .../proxy_tests/localproxy.passwd/Dockerfile | 6 +- .../proxy_tests/localproxy.passwd/squid.conf | 4 +- .../test/ut/proxy_tests/run_wsl_proxy.ps1 | 27 ++ .../test/ut/transport_policy_options.cpp | 54 +-- .../azure-core/test/ut/websocket_test.cpp | 2 +- sdk/core/ci.yml | 30 +- sdk/core/test-resources.bicep | 116 ------ 14 files changed, 453 insertions(+), 485 deletions(-) create mode 100644 eng/scripts/Install-WSL.ps1 create mode 100644 sdk/core/azure-core/test/ut/proxy_tests/run_wsl_proxy.ps1 delete mode 100644 sdk/core/test-resources.bicep diff --git a/.vscode/cspell.json b/.vscode/cspell.json index a62e2688de..ec5a6d9b3e 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -11,8 +11,8 @@ "*.exe", "*.a", "*.lib", - "*.yaml", - "**/libcurl-stress-test/README.md", + "*.yaml", + "**/libcurl-stress-test/README.md", ".github/CODEOWNERS", ".gitignore", ".vscode/cspell.json", diff --git a/eng/pipelines/templates/stages/platform-matrix-live.json b/eng/pipelines/templates/stages/platform-matrix-live.json index 7e9f018107..1c0264d892 100644 --- a/eng/pipelines/templates/stages/platform-matrix-live.json +++ b/eng/pipelines/templates/stages/platform-matrix-live.json @@ -1,152 +1,172 @@ { - "displayNames": { - "_": "" + "displayNames": { + "MacOS": "" + }, + "include": [ + { + "StaticConfigs": { + "x64_with_unit_test": { + "Pool": "Azure Pipelines", + "OSVmImage": "macos-11", + "VCPKG_DEFAULT_TRIPLET": "x64-osx", + "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DDISABLE_PROXY_TESTS=ON ", + "AZURE_CORE_ENABLE_JSON_TESTS": 1, + "BuildArgs": "-j 4" + } + } + }, + { + "StaticConfigs": { + "Ubu1804": { + "VCPKG_DEFAULT_TRIPLET": "x64-linux", + "BuildArgs": "-j 4", + "Pool": "azsdk-pool-mms-ubuntu-1804-general", + "OSVmImage": "MMSUbuntu18.04", + "RunProxyTests": true + } + }, + "BuildConfig": { + "x64_gcc5_with_unit_test": { + "CmakeEnvArg": "CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake", + "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON" + }, + "x64_with_unit_test": { + "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_CODE_COVERAGE=ON", + "AptDependencies": "gcovr lcov", + "CODE_COVERAGE": "enabled", + "CODE_COVERAGE_COLLECT_ONLY": 1, + "AZURE_CORE_ENABLE_JSON_TESTS": 1 + } + } + }, + { + "StaticConfigs": { + "Ubu20": { + "BuildArgs": "-j 4", + "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "OSVmImage": "MMSUbuntu20.04", + "VCPKG_DEFAULT_TRIPLET": "x64-linux", + "RunProxyTests": true + } + }, + "BuildConfiguration": { + "x64_with_unit_test": { + "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON", + "AZURE_CORE_ENABLE_JSON_TESTS": 1 + }, + "samples": { + "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Release ", + "RunSamples": 1 + }, + "x64_no_rtti": { + "CmakeArgs": " -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release " + } + } }, - "include": [ - { - "StaticConfigs": { - "MacOS_x64_with_unit_test": { - "Pool": "Azure Pipelines", - "OSVmImage": "macos-11", - "VCPKG_DEFAULT_TRIPLET": "x64-osx", - "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON", - "AZURE_CORE_ENABLE_JSON_TESTS": 1, - "BuildArgs": "-j 4" - } - } + { + "StaticConfigs": { + "Win2019": { + "Pool": "azsdk-pool-mms-win-2019-general", + "OSVmImage": "MMS2019", + "CMAKE_GENERATOR": "Visual Studio 16 2019" + } + }, + "BuildConfig": { + "x86_with_unit_test_winHttp": { + "VcpkgInstall": "openssl", + "CMAKE_GENERATOR_PLATFORM": "Win32", + "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON -DDISABLE_PROXY_TESTS=ON ", + "VCPKG_DEFAULT_TRIPLET": "x86-windows-static", + "WindowsCtestConfig": "-C Release", + "BuildArgs": "-v --parallel 8 --config Release" + }, + "x86_no_rtti_with_unit_test": { + "VcpkgInstall": "libxml2 openssl", + "CMAKE_GENERATOR_PLATFORM": "Win32", + "CmakeArgs": " -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON -DDISABLE_PROXY_TESTS=ON ", + "VCPKG_DEFAULT_TRIPLET": "x86-windows-static", + "WindowsCtestConfig": "-C Release", + "BuildArgs": "-v --parallel 8 --config Release" + }, + "x86_with_unit_test_libcurl": { + "CMAKE_GENERATOR_PLATFORM": "Win32", + "VCPKG_DEFAULT_TRIPLET": "x86-windows-static", + "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON -DDISABLE_PROXY_TESTS=ON ", + "BuildArgs": "-v --parallel 8" + }, + "HSM_x64_with_unit_test_libcurl": { + "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", + "CMAKE_GENERATOR_PLATFORM": "x64", + "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON -DDISABLE_PROXY_TESTS=ON ", + "BuildArgs": "-v --parallel 8 --config Release", + "WindowsCtestConfig": "-C Release", + "KVLocation": "eastus2", + "EnableHSM": 1 + }, + "x64_with_unit_samples_libcurl": { + "VcpkgInstall": "curl[winssl] openssl", + "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", + "CMAKE_GENERATOR_PLATFORM": "x64", + "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON -DDISABLE_PROXY_TESTS=ON ", + "BuildArgs": "-v --parallel 8 --config Release", + "RunSamples": 1, + "WindowsCtestConfig": "-C Release" + } + } + }, + { + "StaticConfigs": { + "Win2022": { + "Pool": "Azure Pipelines", + "OSVmImage": "windows-2022", + "CMAKE_GENERATOR": "Visual Studio 17 2022", + "RunProxyTests": true + } + }, + "BuildConfig": { + "x64_with_json_unit_test_winHttp": { + "VcpkgInstall": "openssl", + "CMAKE_GENERATOR_PLATFORM": "x64", + "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ", + "BuildArgs": "-v --parallel 8 --config Release", + "AZURE_CORE_ENABLE_JSON_TESTS": 1, + "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", + "WindowsCtestConfig": "-C Release" + }, + "x86_with_unit_test_libcurl": { + "CMAKE_GENERATOR_PLATFORM": "Win32", + "VCPKG_DEFAULT_TRIPLET": "x86-windows-static", + "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON ", + "BuildArgs": "-v --parallel 8" }, - { - "StaticConfigs": { - "_": { - "VCPKG_DEFAULT_TRIPLET": "x64-linux", - "BuildArgs": "-j 4", - "Pool": "azsdk-pool-mms-ubuntu-1804-general", - "OSVmImage": "MMSUbuntu18.04" - } - }, - "BuildConfig": { - "Linux_x64_gcc5_with_unit_test": { - "CmakeEnvArg": "CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake", - "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON" - }, - "Linux_x64_with_unit_test": { - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_CODE_COVERAGE=ON", - "AptDependencies": "gcovr lcov", - "CODE_COVERAGE": "enabled", - "CODE_COVERAGE_COLLECT_ONLY": 1, - "AZURE_CORE_ENABLE_JSON_TESTS": 1 - } - } + "x64_with_json_unit_samples_winHttp": { + "VcpkgInstall": "openssl", + "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", + "CMAKE_GENERATOR_PLATFORM": "x64", + "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ", + "BuildArgs": "-v --parallel 8 --config Release", + "AZURE_CORE_ENABLE_JSON_TESTS": 1, + "RunSamples": 1, + "WindowsCtestConfig": "-C Release" }, - { - "StaticConfigs": { - "_": { - "BuildArgs": "-j 4", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", - "OSVmImage": "MMSUbuntu20.04", - "VCPKG_DEFAULT_TRIPLET": "x64-linux" - } - }, - "BuildConfiguration": { - "Ubuntu20_x64_with_unit_test": { - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_SAMPLES=ON", - "AZURE_CORE_ENABLE_JSON_TESTS": 1 - }, - "Ubuntu20_samples": { - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DCMAKE_BUILD_TYPE=Release ", - "RunSamples": 1 - }, - "Ubuntu20_x64_no_rtti": { - "CmakeArgs": " -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release " - } - } + "x64_with_unit_test_winHttp": { + "VcpkgInstall": "openssl", + "CMAKE_GENERATOR_PLATFORM": "x64", + "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON ", + "BuildArgs": "-v --parallel 8 --config Release", + "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", + "WindowsCtestConfig": "-C Release" }, - { - "StaticConfigs": { - "_": { - "Pool": "azsdk-pool-mms-win-2019-general", - "OSVmImage": "MMS2019", - "CMAKE_GENERATOR": "Visual Studio 16 2019" - } - }, - "BuildConfig": { - "Win_x86_with_unit_test_winHttp": { - "VcpkgInstall": "openssl", - "CMAKE_GENERATOR_PLATFORM": "Win32", - "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON ", - "VCPKG_DEFAULT_TRIPLET": "x86-windows-static", - "WindowsCtestConfig": "-C Release", - "BuildArgs": "-v --parallel 8 --config Release" - }, - "Win_x86_no_rtti_with_unit_test": { - "VcpkgInstall": "libxml2 openssl", - "CMAKE_GENERATOR_PLATFORM": "Win32", - "CmakeArgs": " -DBUILD_RTTI=OFF -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON", - "VCPKG_DEFAULT_TRIPLET": "x86-windows-static", - "WindowsCtestConfig": "-C Release", - "BuildArgs": "-v --parallel 8 --config Release" - }, - "Win_x86_with_unit_test_libcurl": { - "CMAKE_GENERATOR_PLATFORM": "Win32", - "VCPKG_DEFAULT_TRIPLET": "x86-windows-static", - "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON ", - "BuildArgs": "-v --parallel 8" - }, - "Win_x64_with_json_unit_test_winHttp": { - "VcpkgInstall": "openssl", - "CMAKE_GENERATOR_PLATFORM": "x64", - "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ", - "BuildArgs": "-v --parallel 8 --config Release", - "AZURE_CORE_ENABLE_JSON_TESTS": 1, - "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", - "WindowsCtestConfig": "-C Release" - }, - "Win_x64_with_json_unit_samples_winHttp": { - "VcpkgInstall": "openssl", - "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", - "CMAKE_GENERATOR_PLATFORM": "x64", - "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ", - "BuildArgs": "-v --parallel 8 --config Release", - "AZURE_CORE_ENABLE_JSON_TESTS": 1, - "RunSamples": 1, - "WindowsCtestConfig": "-C Release" - }, - "Win_x64_with_unit_test_winHttp": { - "VcpkgInstall": "openssl", - "CMAKE_GENERATOR_PLATFORM": "x64", - "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON ", - "BuildArgs": "-v --parallel 8 --config Release", - "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", - "WindowsCtestConfig": "-C Release" - }, - "Win_x64_with_unit_samples_winHttp": { - "VcpkgInstall": "openssl", - "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", - "CMAKE_GENERATOR_PLATFORM": "x64", - "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON ", - "BuildArgs": "-v --parallel 8 --config Release", - "RunSamples": 1, - "WindowsCtestConfig": "-C Release" - }, - "HSM_Win_x64_with_unit_test_libcurl": { - "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", - "CMAKE_GENERATOR_PLATFORM": "x64", - "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DMSVC_USE_STATIC_CRT=ON ", - "BuildArgs": "-v --parallel 8 --config Release", - "WindowsCtestConfig": "-C Release", - "KVLocation": "eastus2", - "EnableHSM": 1 - }, - "Win_x64_with_unit_samples_libcurl": { - "VcpkgInstall": "curl[winssl] openssl", - "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", - "CMAKE_GENERATOR_PLATFORM": "x64", - "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON ", - "BuildArgs": "-v --parallel 8 --config Release", - "RunSamples": 1, - "WindowsCtestConfig": "-C Release" - } - } + "x64_with_unit_samples_winHttp": { + "VcpkgInstall": "openssl", + "VCPKG_DEFAULT_TRIPLET": "x64-windows-static", + "CMAKE_GENERATOR_PLATFORM": "x64", + "CmakeArgs": " -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DBUILD_SAMPLES=ON -DMSVC_USE_STATIC_CRT=ON ", + "BuildArgs": "-v --parallel 8 --config Release", + "RunSamples": 1, + "WindowsCtestConfig": "-C Release" } - ] + } + } + ] } \ No newline at end of file diff --git a/eng/pipelines/templates/stages/platform-matrix.json b/eng/pipelines/templates/stages/platform-matrix.json index 889b8392c3..76d1bd0368 100644 --- a/eng/pipelines/templates/stages/platform-matrix.json +++ b/eng/pipelines/templates/stages/platform-matrix.json @@ -1,162 +1,186 @@ { - "displayNames": { - "_": "" + "displayNames": { + "_": "" + }, + "include": [ + { + "OSConfiguration": { + "macOS-11": { + "OSVmImage": "macos-11", + "XCODE_VERSION": "12.5.1" + } + }, + "StaticConfigs": { + "_": { + "Pool": "Azure Pipelines", + "BuildArgs": "-j 10", + "VCPKG_DEFAULT_TRIPLET": "x64-osx", + "CmakeArgs": " -DBUILD_TESTING=ON -DDISABLE_PROXY_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON", + "PublishMapFiles": "true" + } + }, + "BuildConfig": { + "debug": { + "CMAKE_BUILD_TYPE": "Debug" + }, + "release": { + "CMAKE_BUILD_TYPE": "Release" + } + } }, - "include": [ - { - "OSConfiguration": { - "macOS-11": { - "OSVmImage": "macos-11", - "XCODE_VERSION": "12.5.1" - } - }, - "StaticConfigs": { - "_": { - "Pool": "Azure Pipelines", - "BuildArgs": "-j 10", - "VCPKG_DEFAULT_TRIPLET": "x64-osx", - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON", - "PublishMapFiles": "true" - } - }, - "BuildConfig": { - "debug": { - "CMAKE_BUILD_TYPE": "Debug" - }, - "release": { - "CMAKE_BUILD_TYPE": "Release" - } - } + { + "StaticConfigs": { + "Win2019": { + "OSVmImage": "MMS2019", + "Pool": "azsdk-pool-mms-win-2019-general", + "CMAKE_GENERATOR": "Visual Studio 16 2019" + } + }, + "TargetPlatform": { + "Win32Api_curl": { + "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON" }, - { - "StaticConfigs": { - "Windows2019": { - "OSVmImage": "MMS2019", - "Pool": "azsdk-pool-mms-win-2019-general", - "CMAKE_GENERATOR": "Visual Studio 16 2019" - } - }, - "TargetPlatform": { - "Win32Api_curl": { - "CmakeArgs": " -DBUILD_TRANSPORT_CURL=ON" - }, - "Win32Api_release_curl": { - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON -DMSVC_USE_STATIC_CRT=ON", - "BuildArgs": "--parallel 8 --config Release", - "PublishMapFiles": "true" - }, - "Win32Api_debug_tests": { - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON -DBUILD_TRANSPORT_WINHTTP=ON -DMSVC_USE_STATIC_CRT=ON", - "BuildArgs": "--parallel 8 --config Debug", - "PublishMapFiles": "true" - } - }, - "TargetArchitecture": { - "x86": { - "CMAKE_GENERATOR_PLATFORM": "Win32", - "VCPKG_DEFAULT_TRIPLET": "x86-windows-static" - }, - "x64": { - "CMAKE_GENERATOR_PLATFORM": "x64", - "VCPKG_DEFAULT_TRIPLET": "x64-windows-static" - } - } + "Win32Api_release_curl": { + "CmakeArgs": " -DBUILD_TESTING=ON -DDISABLE_PROXY_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON -DMSVC_USE_STATIC_CRT=ON ", + "BuildArgs": "--parallel 8 --config Release", + "PublishMapFiles": "true" + } + }, + "TargetArchitecture": { + "x86": { + "CMAKE_GENERATOR_PLATFORM": "Win32", + "VCPKG_DEFAULT_TRIPLET": "x86-windows-static" }, - { - "StaticConfigs": { - "Windows2019": { - "VcpkgInstall": "openssl", - "OSVmImage": "MMS2019", - "Pool": "azsdk-pool-mms-win-2019-general", - "CMAKE_GENERATOR": "Visual Studio 16 2019", - "PublishMapFiles": "true" - } - }, - "TargetPlatform": { - "UWP_debug": { - "CMAKE_SYSTEM_NAME": "WindowsStore", - "CMAKE_SYSTEM_VERSION": "10.0", - "CmakeArgs": " -DBUILD_TRANSPORT_WINHTTP=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ", - "BuildArgs": "--parallel 8 --config Debug" - }, - "UWP_release": { - "CMAKE_SYSTEM_NAME": "WindowsStore", - "CMAKE_SYSTEM_VERSION": "10.0", - "CmakeArgs": " -DBUILD_TRANSPORT_WINHTTP=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ", - "BuildArgs": "--parallel 8 --config Release" - } - }, - "TargetArchitecture": { - "x64": { - "CMAKE_GENERATOR_PLATFORM": "x64", - "VCPKG_DEFAULT_TRIPLET": "x64-uwp" - } - } + "x64": { + "CMAKE_GENERATOR_PLATFORM": "x64", + "VCPKG_DEFAULT_TRIPLET": "x64-windows-static" + } + } + }, + { + "StaticConfigs": { + "Win2022": { + "OSVmImage": "windows-2022", + "Pool": "Azure Pipelines", + "RunProxyTests": true, + "CMAKE_GENERATOR": "Visual Studio 17 2022" + } + }, + "TargetPlatform": { + "Win32Api_debug_tests": { + "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_TRANSPORT_CURL=ON -DBUILD_TRANSPORT_WINHTTP=ON -DMSVC_USE_STATIC_CRT=ON", + "BuildArgs": "--parallel 8 --config Debug", + "PublishMapFiles": "true" + } + }, + "TargetArchitecture": { + "x86": { + "CMAKE_GENERATOR_PLATFORM": "Win32", + "VCPKG_DEFAULT_TRIPLET": "x86-windows-static" }, - { - "StaticConfigs": { - "Ubuntu18": { - "OSVmImage": "MMSUbuntu18.04", - "Pool": "azsdk-pool-mms-ubuntu-1804-general", - "VCPKG_DEFAULT_TRIPLET": "x64-linux", - "BuildArgs": "-j 10" - } - }, - "BuildSettings": { - "gpp-5": { - "AptDependencies": "g++-5", - "CmakeEnvArg": "CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 " - }, - "gpp-8": { - "AptDependencies": "g++-8", - "CC": "/usr/bin/gcc-8", - "CXX": "/usr/bin/g++-8" - }, - "gpp-9": { - "AptDependencies": "g++-9", - "CC": "/usr/bin/gcc-9", - "CXX": "/usr/bin/g++-9" - }, - "included_coverage": { - "AptDependencies": "gcovr lcov", - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_CODE_COVERAGE=ON -DCMAKE_VERBOSE_MAKEFILE=ON", - "CODE_COVERAGE_COLLECT_ONLY": "1", - "CODE_COVERAGE": "enabled", - "PublishMapFiles": "true" - }, - "included": {}, - "included_release": { - "CMAKE_BUILD_TYPE": "Release", - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON", - "PublishMapFiles": "true" - }, - "included_samples": { - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON ", - "PublishMapFiles": "true" - } - } + "x64": { + "CMAKE_GENERATOR_PLATFORM": "x64", + "VCPKG_DEFAULT_TRIPLET": "x64-windows-static" + } + } + }, + { + "StaticConfigs": { + "Win2019": { + "VcpkgInstall": "openssl", + "OSVmImage": "MMS2019", + "Pool": "azsdk-pool-mms-win-2019-general", + "CMAKE_GENERATOR": "Visual Studio 16 2019", + "PublishMapFiles": "true" + } + }, + "TargetPlatform": { + "UWP_debug": { + "CMAKE_SYSTEM_NAME": "WindowsStore", + "CMAKE_SYSTEM_VERSION": "10.0", + "CmakeArgs": " -DBUILD_TRANSPORT_WINHTTP=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ", + "BuildArgs": "--parallel 8 --config Debug" }, - { - "StaticConfigs": { - "Ubuntu20": { - "OSVmImage": "MMSUbuntu20.04", - "Pool": "azsdk-pool-mms-ubuntu-2004-general", - "VCPKG_DEFAULT_TRIPLET": "x64-linux", - "BuildArgs": "-j 10", - "CC": "/usr/bin/clang-11", - "CXX": "/usr/bin/clang++-11", - "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON", - "PublishMapFiles": "true" - } - }, - "BuildSettings": { - "clang-11": { - "CHECK_CLANG_FORMAT": "1" - }, - "included_release": { - "CMAKE_BUILD_TYPE": "Release" - } - } - } - ] + "UWP_release": { + "CMAKE_SYSTEM_NAME": "WindowsStore", + "CMAKE_SYSTEM_VERSION": "10.0", + "CmakeArgs": " -DBUILD_TRANSPORT_WINHTTP=ON -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON ", + "BuildArgs": "--parallel 8 --config Release" + } + }, + "TargetArchitecture": { + "x64": { + "CMAKE_GENERATOR_PLATFORM": "x64", + "VCPKG_DEFAULT_TRIPLET": "x64-uwp" + } + } + }, + { + "StaticConfigs": { + "Ubuntu18": { + "OSVmImage": "MMSUbuntu18.04", + "Pool": "azsdk-pool-mms-ubuntu-1804-general", + "VCPKG_DEFAULT_TRIPLET": "x64-linux", + "BuildArgs": "-j 10", + "RunProxyTests": true + } + }, + "BuildSettings": { + "gpp-5": { + "AptDependencies": "g++-5", + "CmakeEnvArg": "CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 " + }, + "gpp-8": { + "AptDependencies": "g++-8", + "CC": "/usr/bin/gcc-8", + "CXX": "/usr/bin/g++-8" + }, + "gpp-9": { + "AptDependencies": "g++-9", + "CC": "/usr/bin/gcc-9", + "CXX": "/usr/bin/g++-9" + }, + "included_coverage": { + "AptDependencies": "gcovr lcov", + "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DBUILD_CODE_COVERAGE=ON -DCMAKE_VERBOSE_MAKEFILE=ON", + "CODE_COVERAGE_COLLECT_ONLY": "1", + "CODE_COVERAGE": "enabled", + "PublishMapFiles": "true" + }, + "included": {}, + "included_release": { + "CMAKE_BUILD_TYPE": "Release", + "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON", + "PublishMapFiles": "true" + }, + "included_samples": { + "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_SAMPLES=ON ", + "PublishMapFiles": "true" + } + } + }, + { + "StaticConfigs": { + "Ubuntu20": { + "OSVmImage": "MMSUbuntu20.04", + "Pool": "azsdk-pool-mms-ubuntu-2004-general", + "VCPKG_DEFAULT_TRIPLET": "x64-linux", + "BuildArgs": "-j 10", + "CC": "/usr/bin/clang-11", + "CXX": "/usr/bin/clang++-11", + "CmakeArgs": " -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON", + "PublishMapFiles": "true", + "RunProxyTests": true + } + }, + "BuildSettings": { + "clang-11": { + "CHECK_CLANG_FORMAT": "1" + }, + "included_release": { + "CMAKE_BUILD_TYPE": "Release" + } + } + } + ] } diff --git a/eng/scripts/Get-BinarySizes.ps1 b/eng/scripts/Get-BinarySizes.ps1 index d032123801..1cc164e4ee 100644 --- a/eng/scripts/Get-BinarySizes.ps1 +++ b/eng/scripts/Get-BinarySizes.ps1 @@ -41,13 +41,16 @@ function setEnvVar($key, $value) { } function getTargetOs { - if ($OsVMImage.StartsWith('macOS')) { + if ($OsVMImage.StartsWith('macOS', $true, (Get-Culture).InvariantCulture)) { return $OsVMImage } if ($OsVMImage -eq "MMS2019") { return "win-2019" } + if ($OsVMImage -eq "windows-2022") { + return "win-2022" + } if ($OsVMImage -eq "MMSUbuntu18.04") { return "ubuntu-18.04" @@ -57,11 +60,11 @@ function getTargetOs { return "ubuntu-20.04" } - LogError "Could not infer target OS" + LogError "Could not infer target OS from " $OSVmImage } function getTargetArchitecture { - if ($OSVmImage.StartsWith('macOS')) { + if ($OSVmImage.StartsWith('macOS', $true, (Get-Culture).InvariantCulture)) { return "x64" } @@ -78,7 +81,7 @@ function getTargetArchitecture { } function getToolChain { - if ($OSVmImage.StartsWith('macOS')) { + if ($OSVmImage.StartsWith('macOS', $true, (Get-Culture).InvariantCulture)) { return "AppleClang 12" } @@ -86,6 +89,10 @@ function getToolChain { return "MSVC" } + if ($OSVmImage -eq "windows-2022") { + return "MSVC17" + } + if ($OSVmImage.Contains("Ubuntu")) { if ($CmakeEnvArg.Contains('g++-5')) { return 'g++-5' @@ -98,15 +105,15 @@ function getToolChain { } return "g++-7" } - LogError "Could not infer toolchain" + LogError "Could not infer toolchain from " $OSVmImage and $CmakeEnvArg } function getTargetPlatform { - if ($OSVmImage.StartsWith('macOS')) { + if ($OSVmImage.StartsWith('macOS', $true, (Get-Culture).InvariantCulture)) { return "macos" } - if ($OSVmImage -eq 'MMS2019') { + if ($OSVmImage -eq 'MMS2019' -or $OsVMImage -eq "windows-2022") { if (!$env:CMAKE_SYSTEM_NAME -and !$CmakeArgs.Contains('WindowsStore')) { return 'win32' } elseif ($env:CMAKE_SYSTEM_NAME -eq 'WindowsStore' -or $CmakeArgs.Contains('WindowsStore')) { @@ -118,7 +125,7 @@ function getTargetPlatform { return 'linux' } - LogError "Could not infer target platform" + LogError "Could not infer target platform from " $OSVmImage } function getBuildConfiguration { diff --git a/eng/scripts/Install-WSL.ps1 b/eng/scripts/Install-WSL.ps1 new file mode 100644 index 0000000000..1230632df2 --- /dev/null +++ b/eng/scripts/Install-WSL.ps1 @@ -0,0 +1,14 @@ +write-host "WSL install of ubuntu." +wsl --install -d Ubuntu-20.04 + +write-host "Launch WSL." +[console]::OutputEncoding = New-Object System.Text.UnicodeEncoding +$wsl = wsl -l -v | out-string + +write-host $wsl +while ($wsl -notmatch 'Ubuntu-20.04.*running') { + start-sleep -seconds 1 + $wsl = wsl -l -v | out-string + write-host $wsl +} +write-host "Ubuntu installed." diff --git a/sdk/core/azure-core/inc/azure/core/context.hpp b/sdk/core/azure-core/inc/azure/core/context.hpp index 5a610bb3d9..68ee8b31cd 100644 --- a/sdk/core/azure-core/inc/azure/core/context.hpp +++ b/sdk/core/azure-core/inc/azure/core/context.hpp @@ -146,6 +146,14 @@ namespace Azure { namespace Core { */ Context() : m_contextSharedState(std::make_shared()) {} + /** + * @brief Constructs a `%Context` from another `%Context` instance. + * + * @param that Another instance to copy. + * + */ + Context(Context const& that) = default; + /** * @brief Assigns `%Context` to another `%Context` instance. * diff --git a/sdk/core/azure-core/test/ut/CMakeLists.txt b/sdk/core/azure-core/test/ut/CMakeLists.txt index 917615e2d2..db39d8f34b 100644 --- a/sdk/core/azure-core/test/ut/CMakeLists.txt +++ b/sdk/core/azure-core/test/ut/CMakeLists.txt @@ -100,9 +100,9 @@ if (MSVC) target_compile_options(azure-core-test PUBLIC /wd26495 /wd26812 /wd6326 /wd28204 /wd28020 /wd6330 /wd4389) endif() -if (BUILD_CODE_COVERAGE) -message(STATUS "Building for Code Coverage." ) -add_compile_definitions(CODE_COVERAGE) +if (DISABLE_PROXY_TESTS) +message(STATUS "Disabling proxy tests because they cannot be supported on this environment." ) +add_compile_definitions(DISABLE_PROXY_TESTS) endif() # Additional test files to be copied to the output directory. diff --git a/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd/Dockerfile b/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd/Dockerfile index 4bfef7bd1d..45bd84dfa5 100644 --- a/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd/Dockerfile +++ b/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd/Dockerfile @@ -20,11 +20,11 @@ RUN apt-get -y update WORKDIR / -COPY ./squid.conf /etc/squid/squid.conf -COPY ./proxypasswd /etc/squid/passwords +COPY ./squid.conf /tmp/squid.conf +COPY ./proxypasswd /tmp/proxypasswd EXPOSE 3129 STOPSIGNAL SIGTERM -ENTRYPOINT squid -f /etc/squid/squid.conf && sleep 10 && tail -f /var/log/squid/access.log +ENTRYPOINT squid -f /tmp/squid.conf && sleep 10 && tail -f /var/log/squid/access.log diff --git a/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd/squid.conf b/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd/squid.conf index 594e350202..0494ddb0e1 100644 --- a/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd/squid.conf +++ b/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd/squid.conf @@ -439,7 +439,7 @@ ##auth_param ntlm children 20 startup=0 idle=1 ##auth_param ntlm keep_alive on ## -auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords +auth_param basic program /usr/lib/squid/basic_ncsa_auth /tmp/proxypasswd auth_param basic children 5 startup=5 idle=1 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours @@ -4181,7 +4181,7 @@ http_port 3129 # TAG: pid_filename # A filename to write the process-id to. To disable, enter "none". #Default: -# pid_filename /var/run/squid.pid +pid_filename /var/run/squid2.pid # TAG: client_netmask # A netmask for client addresses in logfiles and cachemgr output. diff --git a/sdk/core/azure-core/test/ut/proxy_tests/run_wsl_proxy.ps1 b/sdk/core/azure-core/test/ut/proxy_tests/run_wsl_proxy.ps1 new file mode 100644 index 0000000000..6d91729520 --- /dev/null +++ b/sdk/core/azure-core/test/ut/proxy_tests/run_wsl_proxy.ps1 @@ -0,0 +1,27 @@ +# cspell: words auxf +wsl sudo apt-get -y install squid +if (!$?) { + write-error "Failed to launch anonymous server." +} + +copy localproxy/squid.conf \\wsl$\Ubuntu-20.04\etc\squid\squid.conf +copy localproxy.passwd/proxypasswd //wsl$/Ubuntu-20.04/tmp/proxypasswd +copy localproxy.passwd/squid.conf \\wsl$\Ubuntu-20.04\tmp\squid.conf + +write-host "Verify contents of /etc/squid and /tmp to confirm copy succeeded." +wsl ls -l /etc/squid /tmp + +write-host "Launch anonymous squid server." +wsl sudo squid -f /etc/squid/squid.conf +if (!$?) { + write-error "Failed to launch anonymous server." +} + +write-host "Launch authenticated squid server." +wsl sudo squid -f /tmp/squid.conf +if (!$?) { + write-error "Failed to launch authenticated server." +} + +write-host "Dump processes; verify two copies of squid running." +wsl ps auxf diff --git a/sdk/core/azure-core/test/ut/transport_policy_options.cpp b/sdk/core/azure-core/test/ut/transport_policy_options.cpp index 3c8977de20..eda51ba327 100644 --- a/sdk/core/azure-core/test/ut/transport_policy_options.cpp +++ b/sdk/core/azure-core/test/ut/transport_policy_options.cpp @@ -14,6 +14,7 @@ #include #include +#if !defined(DISABLE_PROXY_TESTS) namespace Azure { namespace Core { namespace Test { namespace { constexpr static const char AzureSdkHttpbinServerSchema[] = "https"; @@ -91,32 +92,30 @@ namespace Azure { namespace Core { namespace Test { std::string HttpProxyServer() { -#if defined(CODE_COVERAGE) - return "http://127.0.0.1:3128"; -#else std::string anonymousServer{ Azure::Core::_internal::Environment::GetVariable("ANONYMOUSCONTAINERIPV4ADDRESS")}; + GTEST_LOG_(INFO) << "Anonymous server: " << anonymousServer; if (anonymousServer.empty()) { + GTEST_LOG_(ERROR) + << "Could not find value for ANONYMOUSCONTAINERIPV4ADDRESS, Assuming local."; anonymousServer = "127.0.0.1"; } return "http://" + anonymousServer + ":3128"; -#endif } std::string HttpProxyServerWithPassword() { -#if defined(CODE_COVERAGE) - return "http://127.0.0.1:3129"; -#else std::string authenticatedServer{ Azure::Core::_internal::Environment::GetVariable("AUTHENTICATEDCONTAINERIPV4ADDRESS")}; + GTEST_LOG_(INFO) << "Authenticated server: " << authenticatedServer; if (authenticatedServer.empty()) { + GTEST_LOG_(ERROR) + << "Could not find value for AUTHENTICATEDCONTAINERIPV4ADDRESS, Assuming local."; authenticatedServer = "127.0.0.1"; } return "http://" + authenticatedServer + ":3129"; -#endif } protected: @@ -248,25 +247,9 @@ namespace Azure { namespace Core { namespace Test { using namespace Azure::Core::Http::_internal; using namespace Azure::Core::Http::Policies::_internal; -#if defined(CODE_COVERAGE) -#else -#endif - // constexpr char SocksProxyServer[] = "socks://98.162.96.41:4145"; - TEST_F(TransportAdapterOptions, SimpleProxyTests_LIVEONLY_) + TEST_F(TransportAdapterOptions, SimpleProxyTests) { - // will skip test under some cased where test can't run (usually LIVE only tests) -#if !defined(CODE_COVERAGE) - if (GetTestMode() != TestMode::LIVE) - { - GTEST_LOG_(INFO) << "Skipping live only test."; - GTEST_SKIP(); - } - else - { - GTEST_LOG_(INFO) << "Running live only test."; - } -#endif Azure::Core::Url testUrl(AzureSdkHttpbinServer::Get()); std::string myIpAddress; { @@ -315,15 +298,8 @@ namespace Azure { namespace Core { namespace Test { typedef int CURLcode; #endif - TEST_F(TransportAdapterOptions, ProxyWithPasswordHttps_LIVENONLY_) + TEST_F(TransportAdapterOptions, ProxyWithPasswordHttps) { - // will skip test under some cased where test can't run (usually LIVE only tests) -#if !defined(CODE_COVERAGE) - if (GetTestMode() != TestMode::LIVE) - { - GTEST_SKIP(); - } -#endif Azure::Core::Url testUrl(AzureSdkHttpbinServer::Get()); // HTTPS Connections. @@ -367,15 +343,8 @@ namespace Azure { namespace Core { namespace Test { } } - TEST_F(TransportAdapterOptions, ProxyWithPasswordHttp_LIVEONLY_) + TEST_F(TransportAdapterOptions, ProxyWithPasswordHttp) { - // will skip test under some cased where test can't run (usually LIVE only tests) -#if !defined(CODE_COVERAGE) - if (GetTestMode() != TestMode::LIVE) - { - GTEST_SKIP(); - } -#endif Azure::Core::Url testUrl(AzureSdkHttpbinServer::Get()); // HTTP Connections. testUrl.SetScheme("http"); @@ -408,4 +377,5 @@ namespace Azure { namespace Core { namespace Test { CheckBodyFromBuffer(*response, expectedResponseBodySize); } } -}}} // namespace Azure::Core::Test \ No newline at end of file +}}} // namespace Azure::Core::Test +#endif // defined(DISABLE_PROXY_TESTS) diff --git a/sdk/core/azure-core/test/ut/websocket_test.cpp b/sdk/core/azure-core/test/ut/websocket_test.cpp index e45ab021aa..0227f7ce6d 100644 --- a/sdk/core/azure-core/test/ut/websocket_test.cpp +++ b/sdk/core/azure-core/test/ut/websocket_test.cpp @@ -396,7 +396,7 @@ TEST_F(WebSocketTests, PingSendTest) TEST_F(WebSocketTests, MultiThreadedTestOnSingleSocket) { constexpr size_t threadCount = 50; - constexpr size_t testDataLength = 220000; + constexpr size_t testDataLength = 275000; constexpr size_t testDataSize = 100; constexpr auto testDuration = 10s; diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index e47adae6dc..45e6e3e0e2 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -62,23 +62,37 @@ stages: filePath: build/sdk/core/azure-core/test/ut/Start-WebSocketServer.ps1 arguments: $(Build.SourcesDirectory)/WebSocketServer.log workingDirectory: build/sdk/core/azure-core/test/ut - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) + condition: and(succeeded(), contains(variables['Agent.OS'], 'windows'), contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) # It would be nice to collapse this branch with the previous one, but nohup doesn't seem to # behave when called from powershell. - bash: | nohup python sdk/core/azure-core/test/ut/websocket_server.py > $(Build.SourcesDirectory)/WebSocketServer.log & workingDirectory: build - condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'), contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) + condition: and(succeeded(), not(contains(variables['Agent.OS'], 'windows')), contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) displayName: Launch python websocket server (Linux). - pwsh: | docker build -t squid-local $(Build.SourcesDirectory)/sdk/core/azure-core/test/ut/proxy_tests/localproxy docker build -t squid-local.passwd $(Build.SourcesDirectory)/sdk/core/azure-core/test/ut/proxy_tests/localproxy.passwd docker run --rm -d -p 3128:3128 squid-local docker run --rm -d -p 3129:3129 squid-local.passwd - displayName: Launch Docker container proxy. - # The image we use for MacOS doesn't support docker, so skip on MacOS. - # We don't have a squid proxy container for windows, so we only run this on Ubuntu. - condition: and(succeeded(), contains(variables.CmakeArgs, 'CODE_COVERAGE'), contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) + displayName: Launch Linux Docker container proxy + # If we're on Ubuntu and running proxy tests, build and launch a local squid proxy + condition: and(succeeded(), contains(variables['Agent.OS'], 'linux'), variables.RunProxyTests, contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) + + - pwsh: eng/scripts/Install-WSL.ps1 + displayName: Install WSL on Windows hosts when proxy tests are enabled.. + condition: and(succeeded(), contains(variables['Agent.OS'], 'windows'), variables.RunProxyTests, contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) + + - pwsh: ./run_wsl_proxy.ps1 + displayName: Launch WSL Proxy Server. + workingDirectory: $(Build.SourcesDirectory)/sdk/core/azure-core/test/ut/proxy_tests + condition: and(succeeded(), contains(variables['Agent.OS'], 'windows'), variables.RunProxyTests, contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) + + # Verify that the proxy servers are running locally whenever we're expected to run proxy tests. + - pwsh: ./verify_proxy.ps1 + workingDirectory: $(Build.SourcesDirectory)/sdk/core/azure-core/test/ut/proxy_tests + displayName: Verify Proxy Server Working Correctly. + condition: and(succeeded(), variables.RunProxyTests, contains(variables.CmakeArgs, 'BUILD_TESTING=ON')) PostTestSteps: # Shut down the test server. This uses curl to send a request to the "terminateserver" websocket endpoint. @@ -97,11 +111,11 @@ stages: displayName: Shutdown WebSocket server. condition: contains(variables.CmakeArgs, 'BUILD_TESTING=ON') - pwsh: | - docker ps -q -f ancestor=azsdkengsys.azurecr.io/cpp/squid | ForEach-Object { ` + docker ps -q -f ancestor=ubuntu/squid | ForEach-Object { ` docker stop $_ ` } displayName: Shutdown Squid Proxy. - condition: and(contains(variables.CmakeArgs, 'BUILD_TESTING=ON'), contains(variables['OSVmImage'], 'ubuntu')) + condition: and(contains(variables.CmakeArgs, 'BUILD_TESTING=ON'), variables.RunProxyTests, contains(variables['OSVmImage'], 'linux')) - template: /eng/common/pipelines/templates/steps/publish-artifact.yml parameters: ArtifactPath: '$(Build.SourcesDirectory)/WebSocketServer.log' diff --git a/sdk/core/test-resources.bicep b/sdk/core/test-resources.bicep deleted file mode 100644 index 0c3b0ed91e..0000000000 --- a/sdk/core/test-resources.bicep +++ /dev/null @@ -1,116 +0,0 @@ -// cspell: words azuresdkforcppproxy azuresdkforcppauthproxy -@description('Name for the container group') -param anonymousName string = 'azuresdkforcppproxy' - -@description('Name for the container group') -param authenticatedName string = 'azuresdkforcppauthproxy' - -@description('Location for all resources.') -param location string = resourceGroup().location - -@description('Container image to deploy. Should be of the form repoName/imagename:tag for images stored in public Docker Hub, or a fully qualified URI for other registries. Images from private registries require additional registry credentials.') -param anonymousImage string = 'azsdkengsys.azurecr.io/cpp/squid:latest' - -@description('Container image to deploy. Should be of the form repoName/imagename:tag for images stored in public Docker Hub, or a fully qualified URI for other registries. Images from private registries require additional registry credentials.') -param authenticatedImage string = 'azsdkengsys.azurecr.io/cpp/squid.passwd:latest' - -@description('Port to open on the container and the public IP address.') -param anonymousPort int = 3128 -@description('Port to open on the container and the public IP address.') -param authenticatedPort int = 3129 - -@description('The number of CPU cores to allocate to the container.') -param cpuCores int = 1 - -@description('The amount of memory to allocate to the container in gigabytes.') -param memoryInGb int = 2 - -@description('The behavior of Azure runtime if container has stopped.') -@allowed([ - 'Always' - 'Never' - 'OnFailure' -]) -param restartPolicy string = 'Always' - -resource anonymousContainerGroup 'Microsoft.ContainerInstance/containerGroups@2021-09-01' = { - name: anonymousName - location: location - properties: { - containers: [ - { - name: anonymousName - properties: { - image: anonymousImage - ports: [ - { - port: anonymousPort - protocol: 'TCP' - } - ] - environmentVariables:[ - { } - ] - resources: { - requests: { - cpu: cpuCores - memoryInGB: memoryInGb - } - } - } - } - ] - osType: 'Linux' - restartPolicy: restartPolicy - ipAddress: { - type: 'Public' - ports: [ - { - port: anonymousPort - protocol: 'TCP' - } - ] - } - } -} - -resource authenticatedContainerGroup 'Microsoft.ContainerInstance/containerGroups@2021-09-01' = { - name: authenticatedName - location: location - properties: { - containers: [ - { - name: authenticatedName - properties: { - image: authenticatedImage - ports: [ - { - port: authenticatedPort - protocol: 'TCP' - } - ] - resources: { - requests: { - cpu: cpuCores - memoryInGB: memoryInGb - } - } - } - } - ] - osType: 'Linux' - restartPolicy: restartPolicy - ipAddress: { - type: 'Public' - ports: [ - { - port: authenticatedPort - protocol: 'TCP' - } - ] - } - } -} - -output anonymousContainerIPv4Address string = anonymousContainerGroup.properties.ipAddress.ip -output authenticatedContainerIPv4Address string = authenticatedContainerGroup.properties.ipAddress.ip