Skip to content

Commit 654b7fd

Browse files
dikshagupta1agadgil-progress
authored andcommitted
address review comments
fix Anka VM's stale Homebrew index fix PSScriptAnalyzer issues Signed-off-by: dikshagupta1 <dikshag@progress.com>
1 parent 426040d commit 654b7fd

8 files changed

Lines changed: 81 additions & 383 deletions

File tree

.expeditor/end_to_end.pipeline.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,8 @@ steps:
11831183
inherit-environment-vars: true
11841184
env:
11851185
BUILD_PKG_TARGET: aarch64-darwin
1186+
HOMEBREW_NO_AUTO_UPDATE: 1
1187+
HOMEBREW_NO_INSTALL_CLEANUP: 1
11861188

11871189
- label: "[:mac: test_studio_version]"
11881190
command:
@@ -1199,6 +1201,8 @@ steps:
11991201
inherit-environment-vars: true
12001202
env:
12011203
BUILD_PKG_TARGET: aarch64-darwin
1204+
HOMEBREW_NO_AUTO_UPDATE: 1
1205+
HOMEBREW_NO_INSTALL_CLEANUP: 1
12021206

12031207
- label: "[:mac: test_studio_can_build_packages]"
12041208
command:
@@ -1215,6 +1219,8 @@ steps:
12151219
inherit-environment-vars: true
12161220
env:
12171221
BUILD_PKG_TARGET: aarch64-darwin
1222+
HOMEBREW_NO_AUTO_UPDATE: 1
1223+
HOMEBREW_NO_INSTALL_CLEANUP: 1
12181224

12191225
- label: "[:mac: test_pkg_download]"
12201226
command:
@@ -1231,6 +1237,8 @@ steps:
12311237
inherit-environment-vars: true
12321238
env:
12331239
BUILD_PKG_TARGET: aarch64-darwin
1240+
HOMEBREW_NO_AUTO_UPDATE: 1
1241+
HOMEBREW_NO_INSTALL_CLEANUP: 1
12341242

12351243
- label: "[:mac: test_fresh_install_can_communicate_with_builder]"
12361244
command:
@@ -1247,6 +1255,8 @@ steps:
12471255
inherit-environment-vars: true
12481256
env:
12491257
BUILD_PKG_TARGET: aarch64-darwin
1258+
HOMEBREW_NO_AUTO_UPDATE: 1
1259+
HOMEBREW_NO_INSTALL_CLEANUP: 1
12501260

12511261
- label: "[:mac: test_self_signed_cert_is_loaded_by_hab]"
12521262
command:
@@ -1263,6 +1273,8 @@ steps:
12631273
inherit-environment-vars: true
12641274
env:
12651275
BUILD_PKG_TARGET: aarch64-darwin
1276+
HOMEBREW_NO_AUTO_UPDATE: 1
1277+
HOMEBREW_NO_INSTALL_CLEANUP: 1
12661278

12671279
- label: "[:mac: test_hab_plan_cli]"
12681280
command:
@@ -1279,6 +1291,8 @@ steps:
12791291
inherit-environment-vars: true
12801292
env:
12811293
BUILD_PKG_TARGET: aarch64-darwin
1294+
HOMEBREW_NO_AUTO_UPDATE: 1
1295+
HOMEBREW_NO_INSTALL_CLEANUP: 1
12821296

12831297
- label: "[:mac: test_pkg_uninstall_darwin]"
12841298
command:
@@ -1295,6 +1309,8 @@ steps:
12951309
inherit-environment-vars: true
12961310
env:
12971311
BUILD_PKG_TARGET: aarch64-darwin
1312+
HOMEBREW_NO_AUTO_UPDATE: 1
1313+
HOMEBREW_NO_INSTALL_CLEANUP: 1
12981314

12991315
- label: "[:mac: test_simple_hooks_darwin]"
13001316
command:
@@ -1311,6 +1327,8 @@ steps:
13111327
inherit-environment-vars: true
13121328
env:
13131329
BUILD_PKG_TARGET: aarch64-darwin
1330+
HOMEBREW_NO_AUTO_UPDATE: 1
1331+
HOMEBREW_NO_INSTALL_CLEANUP: 1
13141332

13151333
- label: "[:mac: test_external_binaries_darwin]"
13161334
command:
@@ -1327,6 +1345,8 @@ steps:
13271345
inherit-environment-vars: true
13281346
env:
13291347
BUILD_PKG_TARGET: aarch64-darwin
1348+
HOMEBREW_NO_AUTO_UPDATE: 1
1349+
HOMEBREW_NO_INSTALL_CLEANUP: 1
13301350

13311351
- wait
13321352

.expeditor/scripts/end_to_end/run_e2e_test_core.ps1

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ param (
99
$ErrorActionPreference = "stop"
1010

1111
if (!$IsCoreCLR) {
12-
Write-Error "End-to-end tests are only compatiable with Powershell Core"
12+
Write-Error "End-to-end tests are only compatible with PowerShell Core"
1313
}
1414

1515
###################################################################################################
@@ -42,7 +42,7 @@ function Wait-PathUpdatedAfter($Path, $Time, $Timeout) {
4242
$testScript = {
4343
(Test-Path -Path $Path) -And ((Get-Item -Path $Path).LastWriteTime -gt $Time)
4444
}
45-
$timeoutScript = { Write-Error "Timed out waiting $Timeout seconds for '$Path' to be updated after '$($Time.ToString("yyyy-MM-ddTHH:MM:ssZ"))'" }
45+
$timeoutScript = { Write-Error "Timed out waiting $Timeout seconds for '$Path' to be updated after '$($Time.ToString("yyyy-MM-ddTHH:mm:ssZ"))'"}
4646
Wait-True -TestScript $testScript -TimeoutScript $timeoutScript -Timeout $Timeout
4747
}
4848

@@ -65,7 +65,7 @@ function Wait-PathHasContent($Path, $Time, $Timeout) {
6565
$testScript = {
6666
(Test-Path -Path $Path) -And ((Get-Content -Path $Path).Length -gt 0)
6767
}
68-
$timeoutScript = { Write-Error "Timed out waiting $Timeout seconds for '$Path' to have content after '$($Time.ToString("yyyy-MM-ddTHH:MM:ssZ"))'" }
68+
$timeoutScript = { Write-Error "Timed out waiting $Timeout seconds for '$Path' to have content after '$($Time.ToString("yyyy-MM-ddTHH:mm:ssZ"))'"}
6969
Wait-True -TestScript $testScript -TimeoutScript $timeoutScript -Timeout $Timeout
7070
}
7171

@@ -134,7 +134,7 @@ function Wait-SupervisorService($ServiceName, $Timeout = ($DefaultServiceTimeout
134134
}
135135
$status = (Invoke-WebRequest "$url" | ConvertFrom-Json).process.state
136136
$status -eq "up"
137-
} catch { $false } # We ignore 404s and other unsuccesful codes
137+
} catch { $false } # We ignore 404s and other unsuccessful codes
138138
}
139139
$timeoutScript = { Write-Error "Timed out waiting $Timeout seconds for Supervisor to start $ServiceName" }
140140
Wait-True -TestScript $testScript -TimeoutScript $timeoutScript -Timeout $Timeout
@@ -210,8 +210,9 @@ function New-TemporaryDirectory {
210210
}
211211

212212
function Restart-Supervisor {
213-
if ($IsLinux) {
214-
pkill --signal=HUP hab-launch
213+
if ($IsLinux -Or $IsMacOS) {
214+
# macOS pkill does not support GNU --signal= syntax
215+
pkill -HUP hab-launch
215216
Start-Sleep 3 # wait for the signal to be processed
216217
} else {
217218
Stop-Process | Get-Process hab-sup
@@ -247,7 +248,7 @@ function Wait-Release($Ident, $Remote, $Timeout = ($DefaultServiceTimeout)) {
247248
$currentIdent = (Invoke-WebRequest "http://${Remote}:9631/services/$serviceName/default" | ConvertFrom-Json).pkg.ident
248249
$currentIdent -eq $Ident
249250
}
250-
$timeoutScript = { Write-Error "Timed out waiting $Timeout seconds for $Remote to Update to $Release" }
251+
$timeoutScript = { Write-Error "Timed out waiting $Timeout seconds for $Remote to update to $Ident" }
251252
Wait-True -TestScript $testScript -TimeoutScript $timeoutScript -Timeout $Timeout
252253
}
253254

@@ -268,12 +269,16 @@ function Get-Leader($Remote, $ServiceGroup) {
268269
}
269270

270271
function Invoke-Build($PackageName, $RefreshChannel) {
271-
$commandArgs = @("--reuse")
272+
$commandArgs = @()
273+
if (!$IsMacOS) {
274+
# --reuse is not compiled for macOS
275+
$commandArgs += @("--reuse")
276+
}
272277
if($RefreshChannel) {
273278
$commandArgs += @("--refresh-channel", $RefreshChannel)
274279
}
275280
hab pkg build test/fixtures/$PackageName $commandArgs
276-
if ($IsLinux) {
281+
if ($IsLinux -Or $IsMacOS) {
277282
# This changes the format of last_build from `var=value` to `$var='value'`
278283
# so that powershell can parse and source the script
279284
Set-Content -Path "results/last_build.ps1" -Value ""
@@ -284,8 +289,15 @@ function Invoke-Build($PackageName, $RefreshChannel) {
284289
Function Invoke-BuildAndInstall($PackageName, $RefreshChannel) {
285290
Invoke-Build @PSBoundParameters
286291
. ./results/last_build.ps1
287-
hab pkg install ./results/$pkg_artifact
288-
hab studio run "rm /hab/pkgs/$pkg_ident/hooks"
292+
if ($IsMacOS) {
293+
# Use --ignore-install-hook because the install hook interpreter
294+
# (core/busybox-static) is not available for aarch64-darwin.
295+
hab pkg install --ignore-install-hook ./results/$pkg_artifact
296+
# On macOS native studio there is no chroot, so no hook cleanup is needed.
297+
} else {
298+
hab pkg install ./results/$pkg_artifact
299+
hab studio run "rm /hab/pkgs/$pkg_ident/hooks"
300+
}
289301
}
290302

291303
function Stop-ComposeSupervisor($Remote) {
@@ -316,7 +328,14 @@ function Get-HabServicePID($PackageName) {
316328

317329
###################################################################################################
318330

319-
Import-Module (Join-Path -Path $(hab pkg path core/pester) module Pester.psd1)
331+
# Import Pester: prefer the hab-installed package, fall back to system-installed module
332+
$pesterPkgPath = $null
333+
try { $pesterPkgPath = hab pkg path core/pester 2>$null } catch { $pesterPkgPath = $null }
334+
if ($pesterPkgPath -and (Test-Path $pesterPkgPath)) {
335+
Import-Module (Join-Path -Path $pesterPkgPath module Pester.psd1)
336+
} else {
337+
Import-Module Pester
338+
}
320339

321340
if(Test-Path $TestName) {
322341
$testPath = $TestName

0 commit comments

Comments
 (0)