Skip to content

Commit cba86dd

Browse files
Add integration testing (#634)
* add initial integration test file * update auth * add skipping * organize tests into unit and integration * update formatting * WIP create config store * edit * update integration setup * copilot updates * initial working version of integration tests * remove obsolete tags and update formatting * updating tests * format * remove skipping, add tests * add cleanup stale resource call on startup and dispose * add back removed line * use persistent resource group * add ordering of apis test * add refresh test * add tests * add failover test * adding snapshot tests first draft * fix snapshot tests * add key vault tests * add more keyvault tests * fix keyvault tests * add cleanup of key values/secrets/snapshot * fix key vault isolation * remove base exception catches * update ci.yml to work with integration tests and use github repo secrets * add id token write permission * update ci.yml step to create subscription file * edit ci.yml * fix github action * update comment in powershell script * remove unused packages * update comment, remove unused methods * add request tracing test * check for status code in catch, move cleanupstaleresources call to dispose * PR comments * comments * comments * update copilot instructions * update copilot instructions * fix try blocks to only surround throwing code * fix setuptestkeys, simplify comments and setup code * tagfilters integration test in progress * tagfilters integration test in progress * correct api version * fixed tagfilter test * fix requesttracing test * allow commas in json reader * stale threshold * remove copilot instructions * use outputhelper * fix cleanupstale * update setup method, remove flag
1 parent 8b883cc commit cba86dd

23 files changed

+2165
-3
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414

1515
permissions:
1616
security-events: write
17+
id-token: write
1718

1819
jobs:
1920
build:
@@ -40,8 +41,17 @@ jobs:
4041
- name: Dotnet Pack
4142
run: pwsh pack.ps1
4243

44+
- name: Azure Login with OIDC
45+
uses: azure/login@v1
46+
with:
47+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
48+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
49+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
50+
4351
- name: Dotnet Test
4452
run: pwsh test.ps1
53+
env:
54+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
4555

4656
- name: Publish Test Results
4757
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
# Azure Functions localsettings file
77
local.settings.json
88

9+
# Integration test secrets
10+
appsettings.Secrets.json
11+
912
# User-specific files
1013
*.suo
1114
*.user

src/Microsoft.Extensions.Configuration.AzureAppConfiguration/FeatureManagement/FeatureManagementKeyValueAdapter.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,12 @@ private FeatureFlag ParseFeatureFlag(string settingKey, string settingValue)
426426
{
427427
var featureFlag = new FeatureFlag();
428428

429-
var reader = new Utf8JsonReader(System.Text.Encoding.UTF8.GetBytes(settingValue));
429+
var reader = new Utf8JsonReader(
430+
System.Text.Encoding.UTF8.GetBytes(settingValue),
431+
new JsonReaderOptions
432+
{
433+
AllowTrailingCommas = true
434+
});
430435

431436
try
432437
{
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env pwsh
2+
3+
# GetAzureSubscription.ps1
4+
# This script gets the AppConfig - Dev subscription ID and saves it to a JSON file
5+
6+
$outputPath = Join-Path $PSScriptRoot "appsettings.Secrets.json"
7+
8+
Write-Host "Checking for active Azure CLI login"
9+
10+
az account show | Out-Null
11+
12+
if ($LASTEXITCODE -ne 0) {
13+
Write-Host "Must be logged in with the Azure CLI to proceed"
14+
15+
az login
16+
17+
if ($LASTEXITCODE -ne 0) {
18+
Write-Host "Azure login failed"
19+
return
20+
}
21+
}
22+
23+
az account set --name "AppConfig - Dev"
24+
25+
# Get current subscription from az CLI
26+
$subscriptionId = az account show --query id -o tsv 2>&1
27+
28+
if ($LASTEXITCODE -ne 0) {
29+
Write-Host "Azure CLI command failed with exit code $LASTEXITCODE. Output: $subscriptionId"
30+
return
31+
}
32+
33+
# Check if the output is empty
34+
if ([string]::IsNullOrWhiteSpace($subscriptionId)) {
35+
Write-Host "No active Azure subscription found. Please run 'az login' first."
36+
37+
exit 1
38+
}
39+
40+
# If successful, save the subscription ID to a JSON file
41+
$result = @{
42+
SubscriptionId = $subscriptionId.Trim()
43+
}
44+
45+
$result | ConvertTo-Json | Out-File $outputPath -Encoding utf8
46+
Write-Host "Subscription information saved to: $outputPath"
47+
exit 0

0 commit comments

Comments
 (0)