Skip to content

Commit

Permalink
Update 1.0.9 to have unique device ID in LH and Stress tests (Azure#3033
Browse files Browse the repository at this point in the history
)

Update 1.0.9 to have unique device ID in LH and Stress tests

Note: porting the changes from Azure#3028 (master) to` release/1.0.9` branch
  • Loading branch information
yophilav authored and darobs committed Jun 30, 2020
1 parent d600e9a commit fc7e5dd
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 @@ -436,6 +436,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 @@ -653,7 +661,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 @@ -729,7 +737,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 @@ -341,6 +341,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 @@ -967,7 +972,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 @@ -998,7 +1003,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 fc7e5dd

Please sign in to comment.