azure-sdk-for-cpp/sdk/core/ci.yml
George Arama ef4d41267f
Test proxy (#4118)
* start

* recording

* playback

* refactor, playback and record

* recordings for kv

* klklk

* open telemetry, identity

* attest

* all tests recorded except storage

* STORAGE RECORDINGDS

* some cleanup

* ignore result

* testproxy remade

* fiiine , do something with the result , goooosh

* install test proxy

* clang

* clang

* certs maybe

* cmake generate fix,

* start test proxy script

* start test proxy on env

* clang, move TP after build

* reregen

* certs

* sda

* dss

* allow insecure connections

* put back

* debug

* iuy

* try again

* ewew

* chmod

* try again

* update sanitizer

* output testproxy log

* sjhgasjgdajh

* folder

* worxy

* fix tests and log file

* format files

* clang format

* clang

* sa

* sa

* cleanup

* cspell

* oops

* remove redundant method

* tests

* put back original

* restore to 933486385a

* recordings

* remove storage values

* storage recordings

* disable non functioning tests

* remove core install of test proxy

* _LIVEONLY_ tests

* clang install when needed

* logs on condition

* skip tests

* revert cpp to original version

* quick test

* right that one

* one skip

* identity pushed

* maybe

* override

* clang

* clang

* attestetion

* keyvault

* reenable 20+ tests

* 5 tests left , lease related

* a bit of cleanup

* try now

* snitizers

* some fixes

* capitalization

* clang , cover, peakA

* WEIRD NAME THING ON WINDOWS

* storage recordings

* one more livee

* createappenddelete_liveonly

* CreateWithTags_LIVEONLY_

* try capitalization

* another onw

* maybe now

* all liveonly

* try restore before test

* typo

* condition

* clang and cc

* azure core ci

* qwqwq

* dsasdas

* cleanup1

* typo

* spaces

* cleanup2

* cleanup 3

* remove start proxy

* cleanup +1

* Update cmake-modules/TestProxyPrep.cmake

Co-authored-by: Rick Winter <rick.winter@microsoft.com>

* Update eng/scripts/Start-TestProxy.ps1

Co-authored-by: Rick Winter <rick.winter@microsoft.com>

* Update eng/scripts/Stop-TestProxy.ps1

Co-authored-by: Rick Winter <rick.winter@microsoft.com>

* PR comments

* clangs

* Update sdk/core/azure-core-test/src/test_proxy_policy.cpp

* build

Co-authored-by: Rick Winter <rick.winter@microsoft.com>
2022-12-13 10:58:19 -08:00

124 lines
5.3 KiB
YAML

# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
batch: true
branches:
include:
- master
- main
- feature/*
- release/*
- hotfix/*
paths:
include:
- cmake-modules/
- eng/
- CMakeLists.txt
- sdk/core
pr:
branches:
include:
- master
- main
- feature/*
- release/*
- hotfix/*
paths:
include:
- cmake-modules/
- eng/
- CMakeLists.txt
- sdk/core
stages:
- template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: core
# CI has static code analysis disabled, while LiveTest will have it enabled
# In the case of changes to core we want to re-run all CI tests for all
# libraries to check for potential regressions everywhere.
CtestRegex: azure-core.|json-test
LiveTestCtestRegex: azure-core.|json-test
LiveTestTimeoutInMinutes: 90 # default is 60 min. We need a little longer on worst case for Win+jsonTests
LineCoverageTarget: 93
BranchCoverageTarget: 50
PreTestSteps:
- 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
$(Build.SourcesDirectory)/sdk/core/azure-core/test/ut/proxy_tests/runproxy.ps1
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:
- pwsh: |
docker ps -q -f ancestor=ubuntu/squid | ForEach-Object { `
docker stop $_ `
}
displayName: Shutdown Squid Proxy.
condition: and(variables.RunProxyTests, contains(variables.CmakeArgs, 'BUILD_TESTING=ON'), contains(variables['OSVmImage'], 'linux'))
Artifacts:
- Name: azure-core
Path: azure-core
VcpkgPortName: azure-core-cpp
- Name: azure-core-tracing-opentelemetry
Path: azure-core-tracing-opentelemetry
VcpkgPortName: azure-core-tracing-opentelemetry-cpp
# Since Azure Core will run all service's tests, it requires all the expected env vars from services
TestEnv:
# Key Vault
- Name: AZURE_KEYVAULT_URL
Value: "https://non-real-account.vault.azure.net"
- Name: AZURE_KEYVAULT_HSM_URL
Value: "https://non-real-account.managedhsm.azure.net/"
# Key Vault & Identity
- Name: AZURE_TENANT_ID
Value: "33333333-3333-3333-3333-333333333333"
- Name: AZURE_CLIENT_ID
Value: "non-real-client"
- Name: AZURE_CLIENT_SECRET
Value: "non-real-secret"
# Storage
- Name: AAD_TENANT_ID
Value: "33333333-3333-3333-3333-333333333333"
- Name: AAD_CLIENT_ID
Value: "non-real-client"
- Name: AAD_CLIENT_SECRET
Value: "non-real-secret"
- Name: STANDARD_STORAGE_CONNECTION_STRING
Value: "DefaultEndpointsProtocol=https;AccountName=notReal;AccountKey=3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333;EndpointSuffix=core.windows.net"
- Name: ADLS_GEN2_CONNECTION_STRING
Value: "DefaultEndpointsProtocol=https;AccountName=notReal;AccountKey=3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333;EndpointSuffix=core.windows.net"
- Name: PREMIUM_FILE_CONNECTION_STRING
Value: "DefaultEndpointsProtocol=https;AccountName=notReal;AccountKey=3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333;EndpointSuffix=core.windows.net"
# Attestation
- Name: LOCATION_SHORT_NAME
Value: "wus"
- Name: ATTESTATION_ISOLATED_URL
Value: https://NotRealAttestationInstanceiso.wus.attest.azure.net
- Name: ATTESTATION_AAD_URL
Value: https://NotRealAttestationInstanceaad.wus.attest.azure.net
CMakeTestOptions:
- Name: Default
Value: ''
- Name: Test
Value: '-DBUILD_TESTING=ON'