Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DeviceId collision in LH and Stress tests #3028

Merged
Merged
12 changes: 10 additions & 2 deletions scripts/linux/runE2ETest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,14 @@ function process_args() {
echo 'Required parameters are provided'
}

function get_hash() {
# TODO: testHelper.sh needs to be shared across build pipelines
local length=$1
local hash=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c $length)

echo "$hash"
}

function run_all_tests()
{
local funcRet=0
Expand Down Expand Up @@ -698,7 +706,7 @@ function run_longhaul_test() {
print_highlighted_message "Run Long Haul test for $image_architecture_label"
test_setup

local device_id="$RELEASE_LABEL-Linux-$image_architecture_label-longhaul"
local device_id="$RELEASE_LABEL-Linux-$image_architecture_label-longhaul-$(get_hash 8)"

test_start_time="$(date '+%Y-%m-%d %H:%M:%S')"
print_highlighted_message "Run Long Haul test with -d '$device_id' started at $test_start_time"
Expand Down Expand Up @@ -776,7 +784,7 @@ function run_stress_test() {
print_highlighted_message "Run Stress test for $image_architecture_label"
test_setup

local device_id="$RELEASE_LABEL-Linux-$image_architecture_label-stress"
local device_id="$RELEASE_LABEL-Linux-$image_architecture_label-stress-$(get_hash 8)"

test_start_time="$(date '+%Y-%m-%d %H:%M:%S')"
print_highlighted_message "Run Stress test with -d '$device_id' started at $test_start_time"
Expand Down
9 changes: 7 additions & 2 deletions scripts/windows/test/Run-E2ETest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ Function GetImageArchitectureLabel
Throw "Can't find image architecture label for $Architecture"
}

Function GetHash
{
return -join ((48..57) + (65..90) + (97..122) | Get-Random -Count $args[0] | % {[char]$_})
}

Function GetLongHaulDeploymentFilename
{
If (GetImageArchitectureLabel -eq "amd64")
Expand Down Expand Up @@ -1022,7 +1027,7 @@ Function RunLongHaulTest
TestSetup

$testStartAt = Get-Date
$deviceId = "${ReleaseLabel}-Windows-${Architecture}-longHaul"
$deviceId = "${ReleaseLabel}-Windows-${Architecture}-longHaul-$(GetHash 8)"
PrintHighlightedMessage "Run Long Haul test with -d ""$deviceId"" started at $testStartAt"

$testCommand = "&$IotEdgeQuickstartExeTestPath ``
Expand Down Expand Up @@ -1054,7 +1059,7 @@ Function RunStressTest
TestSetup

$testStartAt = Get-Date
$deviceId = "${ReleaseLabel}-Windows-${Architecture}-stress"
$deviceId = "${ReleaseLabel}-Windows-${Architecture}-stress-$(GetHash 8)"
PrintHighlightedMessage "Run Stress test with -d ""$deviceId"" started at $testStartAt"

$testCommand = "&$IotEdgeQuickstartExeTestPath ``
Expand Down