Skip to content

Commit

Permalink
Fix DeviceId collision in LH and Stress tests (#3028)
Browse files Browse the repository at this point in the history
Fix DeviceId collision in LH and Stress tests
  • Loading branch information
yophilav authored Jun 2, 2020
1 parent e5e1a9e commit bf482b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
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

0 comments on commit bf482b8

Please sign in to comment.