Skip to content

Commit 89f059a

Browse files
authored
Test custom cmd line set via Windows install script (#6370)
* Test custom cmd line set via Windows install script * Fix logical expression on test
1 parent 725fa07 commit 89f059a

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/scripts/win-test-services.ps1

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ param (
66
[string]$with_fluentd = "true",
77
[string]$with_msi_uninstall_comments = "",
88
[string]$api_url = "https://api.${realm}.signalfx.com",
9-
[string]$ingest_url = "https://ingest.${realm}.signalfx.com"
9+
[string]$ingest_url = "https://ingest.${realm}.signalfx.com",
10+
[string]$with_svc_args = ""
1011
)
1112

1213
$ErrorActionPreference = 'Stop'
@@ -96,3 +97,18 @@ if ($installed_version -gt [Version]"0.97.0.0") {
9697
If (!(Test-Path -Path "${Env:ProgramData}\Splunk\OpenTelemetry Collector\*_config.yaml")) {
9798
throw "No config files found in ${Env:ProgramData}\Splunk\OpenTelemetry Collector these files are expected after the install"
9899
}
100+
101+
$svc_commandline = ""
102+
try {
103+
$svc_commandline = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\splunk-otel-collector" -Name "ImagePath"
104+
} catch {
105+
throw "Failed to retrieve the service command line from the registry."
106+
}
107+
108+
if ($with_svc_args -ne "") {
109+
if (-not $svc_commandline.EndsWith($with_svc_args)) {
110+
throw "Service command line does not match the expected arguments. Found: '$svc_commandline', Expected to end with: '$with_svc_args'"
111+
} else {
112+
Write-Host "Service command line matches the expected arguments."
113+
}
114+
}

.github/workflows/win-installer-script-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ jobs:
3737
run: |
3838
$ErrorActionPreference = 'Stop'
3939
$env:VERIFY_ACCESS_TOKEN = "false"
40-
.\packaging\installer\install.ps1 -access_token "testing123" -realm "test" -mode "${{ matrix.MODE }}" -memory "256" -with_fluentd $${{ matrix.WITH_FLUENTD }} -msi_public_properties "ARPCOMMENTS=`"Installed via install.ps1`""
40+
.\packaging\installer\install.ps1 -access_token "testing123" -realm "test" -mode "${{ matrix.MODE }}" -memory "256" -with_fluentd $${{ matrix.WITH_FLUENTD }} -msi_public_properties "ARPCOMMENTS=`"Installed via install.ps1`" COLLECTOR_SVC_ARGS=`"--discovery --set=processors.batch.timeout=10s`""
4141
Start-Sleep -s 30
42-
& ${{ github.workspace }}\.github\workflows\scripts\win-test-services.ps1 -mode "${{ matrix.MODE }}" -access_token "testing123" -realm "test" -memory "256" -with_fluentd "${{ matrix.WITH_FLUENTD }}" -with_msi_uninstall_comments "Installed via install.ps1"
42+
& ${{ github.workspace }}\.github\workflows\scripts\win-test-services.ps1 -mode "${{ matrix.MODE }}" -access_token "testing123" -realm "test" -memory "256" -with_fluentd "${{ matrix.WITH_FLUENTD }}" -with_msi_uninstall_comments "Installed via install.ps1" -with_svc_args "--discovery --set=processors.batch.timeout=10s"
4343
& ${{ github.workspace }}\.github\workflows\scripts\win-test-support-bundle.ps1 -mode "${{ matrix.MODE }}" -with_fluentd "${{ matrix.WITH_FLUENTD }}"
4444
4545
- name: splunk-otel-collector logs

0 commit comments

Comments
 (0)