* Stress test (#3820) * 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 * Fixed the metadata for better handling (#3824) Co-authored-by: sima-zhu <sizhu@microsoft.com> * Update attestation core vcpkg dependency to latest GA version that is required. (#3830) * Update attestation core vcpkg dependency to latest GA version that is required. * Update vcpkg config.cmake to match the dependency version needed. * Remove winhttp (#3832) * remove refs to winhttp * this tsst only curl * Move perf.yml to eng/common (#3833) Co-authored-by: Mike Harder <mharder@microsoft.com> * Sync eng/common directory with azure-sdk-tools for PR 3656 (#3834) * someone wants to reference the test-proxy startup scripts externally. to make this easy on them we're parameterizing the root of the eng/common for easy use in that scenario * two leading $ signs on the definition of the certificate path was causing some issues! Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com> * Update casing for 'verison' (#3821) Co-authored-by: Daniel Jurek <djurek@microsoft.com> * Print additional result summary formats to pipelines UI (#3842) Co-authored-by: Mike Harder <mharder@microsoft.com> * Sync eng/common directory with azure-sdk-tools for PR 3702 (#3843) * Add language-service to list of valid sample slugs * Update link to taxonomies Co-authored-by: Heath Stewart <heaths@microsoft.com> * Fix incorrect failure notification in vcpkg publishing (#3838) * Set up for testing of template pipeline * Override branches, set up for template GA release * More TODOs to prevent merging an unintended change * More removal of TestPipeline * Increment template version number * Use script to set package version * Check out the correct branch * branch parameter in the command * Use $(PublishToVcpkg) to determine if we should check for changes * dictionary syntax * Set GA package version to validate GA publish scenario * Update changelog * create-pull-request.yml optionally pushes changes * Output GH PR URI * Macro syntax with a variable set earlier * Move up to 1.2.0-beta.2 * beta.1 * Revert changelog * Revert testing-related changes * Revert vcpkg-clone.yml * Revert eng/common changes, ensure global $(HasChanges) is set properly * Changes to enable testing * 1.1.0-beta.1 * vcpkg clone should clone at configured branch * Clone "main" branch of vcpkg betas * Undo test-specific changes * More PR cleanup * PR cleanup * Helm charts (#3841) * helm chart * first pipe setup * poi * magiks * ewewe * stress * cleanup * pr * QFE and readme * clang * stupid clang , waste of time * ewqwewewrqrewewrqewrqwrqr * stupid clang * cspell * PR * try try again * clang again * Sync eng/common directory with azure-sdk-tools for PR 3661 (#3846) * Add full clone fallback to sparse checkout * Improve clone handling and overrides for sparse checkout * Use SkipSparseCheckout variable name Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com> * Sync eng/common directory with azure-sdk-tools for PR 3735 (#3845) * Detect API changes using new snadboxinx approach * Added strictmode * Remove unset variable * Changes as per strict mode 3 * Rervert strict mode to allow language level fixes to merge first Co-authored-by: praveenkuttappan <prmarott@microsoft.com> * Increment version for keyvault releases (#3809) * Increment package version after release of azure-security-keyvault-keys * Increment package version after release of azure-security-keyvault-secrets * Increment package version after release of azure-security-keyvault-certificates * Removed hard dependency on opentelemetry version (#3844) * Revert "Add full clone fallback to sparse checkout (#3661)" (#3851) This reverts commit 7605ead00308dd20f20f2afe5acc4ec9900a2c47. Co-authored-by: Ben Broderick Phillips <ben@benbp.net> * Sync eng/common directory with azure-sdk-tools for PR 3753 (#3857) * Bump MacOs version to macos-11 * Update eng/common/scripts/job-matrix/tests/job-matrix-functions.tests.ps1 Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com> * Update eng/common/scripts/job-matrix/tests/job-matrix-functions.tests.ps1 Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com> Co-authored-by: sima-zhu <sizhu@microsoft.com> Co-authored-by: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com> * Bump macOs version to macos-11 (#3853) * Update CHANGELOG.md * Fix misleading step name in az module install (#3859) Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com> * Retry poll calls on EINTR (#3858) When signals are delievered to the process, calls here to poll may be interrupted and return with a spurious failure. The call instead should be restarted. * Fix bad path to sample matrix json (#3860) Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com> * Sync eng/common directory with azure-sdk-tools for PR 3826 (#3863) * Add link checking for stress CI * Remove region segment from stress testing links Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com> * Core August releases (#3862) * Core August releases * cspell Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com> * Increment version for core releases (#3865) * Increment package version after release of azure-core * Increment package version after release of azure-core-tracing-opentelemetry * Storage Aug GA release (#3864) * CG only runs on internal (#3866) * Condition added and indentation changes * STG 79 80 81 Features (#3850) * Sync eng/common directory with azure-sdk-tools for PR 3860 (#3871) * updating pfx and cert * update the targeted version of the proxy as well Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com> * Storage August Preview Release (#3868) * Storage August Preview Release * update versions * Increment version for storage releases (#3875) * Increment package version after release of azure-storage-common * Increment package version after release of azure-storage-blobs * Fix an issue that reason phrase is missing as expected from HTTP/2 server (#3879) * Fix an issue that reason phrase is missing as expected from HTTP/2 server * reverse the condition * compact comments * fix clang format * Update CODEOWNERS (#3881) * updated targeted proxy version to one that properly allows consumption of TLS certificates (#3888) Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com> * Fix `azure-storage-blobs-cpp` beta install (#3889) Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com> * Fixed merge conflict typo Co-authored-by: George Arama <50641385+gearama@users.noreply.github.com> Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: sima-zhu <sizhu@microsoft.com> Co-authored-by: Ahson Khan <ahson_ahmedk@yahoo.com> Co-authored-by: Mike Harder <mharder@microsoft.com> Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com> Co-authored-by: Daniel Jurek <djurek@microsoft.com> Co-authored-by: Heath Stewart <heaths@microsoft.com> Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com> Co-authored-by: praveenkuttappan <prmarott@microsoft.com> Co-authored-by: Ben Broderick Phillips <ben@benbp.net> Co-authored-by: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com> Co-authored-by: Rick Winter <rick.winter@microsoft.com> Co-authored-by: John Heffner <john@topofcenter.net> Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com> Co-authored-by: JinmingHu <jinmhu@microsoft.com> Co-authored-by: Jonathan Cárdenas <JonathanCrd@users.noreply.github.com> Co-authored-by: keshen-msft <53491277+keshen-msft@users.noreply.github.com> Co-authored-by: microzchang <110015819+microzchang@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| clouds | ||
| build-test-resource-config.yml | ||
| deploy-test-resources.yml | ||
| New-TestResources.cmd | ||
| New-TestResources.ps1 | ||
| New-TestResources.ps1.md | ||
| README.md | ||
| remove-test-resources.yml | ||
| Remove-TestResources.cmd | ||
| Remove-TestResources.ps1 | ||
| Remove-TestResources.ps1.md | ||
| setup-environments.yml | ||
| SubConfig-Helpers.ps1 | ||
| Update-TestResources.cmd | ||
| Update-TestResources.ps1 | ||
| Update-TestResources.ps1.md | ||
Live Test Resource Management
Running and recording live tests often requires first creating some resources
in Azure. Service directories that include a test-resources.json or test-resources.bicep
file require running New-TestResources.ps1 to create these resources and output
environment variables you must set.
The following scripts can be used both in on your desktop for developer scenarios as well as on hosted agents for continuous integration testing.
- New-TestResources.ps1 - Creates new test resources for a given service.
- Remove-TestResources.ps1 - Deletes previously created resources.
Prerequisites
- Install PowerShell version 7.0 or newer.
- Install the Azure PowerShell.
On the Desktop
To set up your Azure account to run live tests, you'll need to log into Azure,
and create the resources defined in your test-resources.json or test-resources.bicep
template as shown in the following example using Azure Key Vault. The script will create
a service principal automatically, or you may create a service principal that can be reused
subsequently.
Note that -Subscription is an optional parameter but recommended if your account
is a member of multiple subscriptions. If you didn't specify it when logging in,
you should select your desired subscription using Select-AzSubscription. The
default can be saved using Set-AzDefault for future sessions.
Connect-AzAccount -Subscription 'YOUR SUBSCRIPTION ID'
eng\common\TestResources\New-TestResources.ps1 keyvault
The OutFile switch will be set by default if you are running this for a .NET project on Windows.
This will save test environment settings into a test-resources.json.env file next to test-resources.json
or a test-resources.bicep.env file next to test-resources.bicep. The file is protected via DPAPI.
The environment file would be scoped to the current repository directory and avoids the need to
set environment variables or restart your IDE to recognize them.
Along with some log messages, this will output environment variables based on your current shell like in the following example:
${env:KEYVAULT_TENANT_ID} = '<<secret>>'
${env:KEYVAULT_CLIENT_ID} = '<<secret>>'
${env:KEYVAULT_CLIENT_SECRET} = '<<secret>>'
${env:KEYVAULT_SUBSCRIPTION_ID} = 'YOUR SUBSCRIPTION ID'
${env:KEYVAULT_RESOURCE_GROUP} = 'rg-myusername'
${env:KEYVAULT_LOCATION} = 'westus'
${env:KEYVAULT_SKU} = 'premium'
${env:AZURE_KEYVAULT_URL} = '<<url>>'
For security reasons we do not set these environment variables automatically for either the current process or persistently for future sessions. You must do that yourself based on your current platform and shell.
If your current shell was detected properly, you should be able to copy and paste the output directly in your terminal and add to your profile script. For example, in PowerShell on Windows you can copy the output above and paste it back into the terminal to set those environment variables for the current process. To persist these variables for future terminal sessions or for applications started outside the terminal, you could copy and paste the following commands:
setx KEYVAULT_TENANT_ID ${env:KEYVAULT_TENANT_ID}
setx KEYVAULT_CLIENT_ID ${env:KEYVAULT_CLIENT_ID}
setx KEYVAULT_CLIENT_SECRET ${env:KEYVAULT_CLIENT_SECRET}
setx KEYVAULT_SUBSCRIPTION_ID ${env:KEYVAULT_SUBSCRIPTION_ID}
setx KEYVAULT_RESOURCE_GROUP ${env:KEYVAULT_RESOURCE_GROUP}
setx KEYVAULT_LOCATION ${env:KEYVAULT_LOCATION}
setx KEYVAULT_SKU ${env:KEYVAULT_SKU}
setx AZURE_KEYVAULT_URL ${env:AZURE_KEYVAULT_URL}
Pre- and Post- Scripts
Sometimes creating test resources requires either some work to be done prior to or after the main test-resources.json script is executed.
For these scenarios a test-resources-pre.ps1 or test-resources-post.ps1, respectively, can be created in the same folder as the test-resources.json file.
For example, it may be necessary to create artifacts prior to provisioning the actual resource, such as a certificate.
Typically the created artifact will need to be passed to test-resources.json to be used in the ARM template or as output (or both).
Below is an example of how $templateFileParameters can be used to pass data from the pre- script to test-resources.json.
Snippet from test-resources-pre.ps1
$cert = New-X509Certificate2 -SubjectName 'E=opensource@microsoft.com, CN=Azure SDK, OU=Azure SDK, O=Microsoft, L=Frisco, S=TX, C=US' -ValidDays 3652
# Create new entries in $templateFileParameters
$templateFileParameters['ConfidentialLedgerPrincipalPEM'] = Format-X509Certificate2 -Certificate $cert
$templateFileParameters['ConfidentialLedgerPrincipalPEMPK'] = Format-X509Certificate2 -Type Pkcs8 -Certificate $cert
Snippet from the corresponding test-resources.json.
Note that the values present in $templateFileParameters will map to parameters of the same name.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"_comment": "Other required parameters would go here... (this is not part of the actual test-resources.json)",
"ConfidentialLedgerPrincipalPEM": {
"type": "string",
"metadata": {
"description": "The certificate to configure as a certBasedSecurityPrincipal."
}
},
"ConfidentialLedgerPrincipalPEMPK": {
"type": "string",
"metadata": {
"description": "The certificate to configure as a certBasedSecurityPrincipal."
}
}
},
}
Cleaning up Resources
By default, resource groups are tagged with a DeleteAfter value and date according to the default or specified
value for the -DeleteAfterHours switch. You can use this tag in scheduled jobs to remove older resources based
on that date.
If you are not ready for the resources to be deleted, you can update the resource group by running Update-TestResources.ps1:
Update-TestResources.ps1 keyvault
This will extend the expiration time by the default value (e.g. 48 hours) from now.
Alternatively, after running or recording live tests, if you do not plan on further testing you can immediately remove the test resources you created above by running Remove-TestResources.ps1:
Remove-TestResources.ps1 keyvault -Force
If you persisted environment variables, you should also remove those as well.
Passing Additional Arguments
Some test-resources.json templates utilize the AdditionalParameters parameter to control additional resource configuration options. For example:
New-TestResources.ps1 keyvault -AdditionalParameters @{enableHsm = $true}
In CI
Test pipelines should include deploy-test-resources.yml and remove-test-resources.yml like in the following examples:
- template: /eng/common/TestResources/deploy-test-resources.yml
parameters:
ServiceDirectory: '${{ parameters.ServiceDirectory }}'
# Run tests
- template: /eng/common/TestResources/remove-test-resources.yml
Be sure to link the Secrets for Resource Provisioner variable group into the test pipeline for these scripts to work.
Documentation
To regenerate documentation for scripts within this directory, you can install platyPS and run it like in the following example:
Install-Module platyPS -Scope CurrentUser -Force
New-MarkdownHelp -Command .\New-TestResources.ps1 -OutputFolder . -Force
After the markdown files are generated, please make sure all "http" URIs use "https".
PowerShell markdown documentation created with platyPS.