From 1923155fadba4e8f73d6a7c0732b80a675b63cc3 Mon Sep 17 00:00:00 2001 From: Philip Lin Date: Thu, 9 Jan 2020 12:26:16 -0800 Subject: [PATCH] Seanmcd/e2e devicename2 (#1698) (#2280) fix devicename length issue Co-authored-by: Sean McDowell --- scripts/windows/test/Run-E2ETest.ps1 | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/scripts/windows/test/Run-E2ETest.ps1 b/scripts/windows/test/Run-E2ETest.ps1 index e508fa64fcc..e9e549f4986 100644 --- a/scripts/windows/test/Run-E2ETest.ps1 +++ b/scripts/windows/test/Run-E2ETest.ps1 @@ -1158,6 +1158,11 @@ Function RunLeafDeviceTest [bool]$useSecondaryCredential = $False ) { + + if ($leafDeviceId.Length -gt 64) { + throw "can't generate cert. asn1 device name length of 64 exceeded. $leafDeviceId" + } + $testCommand = $null switch ($authType) { "sas" @@ -1304,23 +1309,25 @@ Function RunTransparentGatewayTest # run the various leaf device tests $deviceId = "e2e-${ReleaseLabel}-Win-${Architecture}" - RunLeafDeviceTest "sas" "Mqtt" "$deviceId-mqtt-sas-noscope-leaf" $null - RunLeafDeviceTest "sas" "Amqp" "$deviceId-amqp-sas-noscope-leaf" $null + # NOTE: device name cannot be > 64 chars because of asn1 limits for certs + # thus we're abbreviating noscope/inscope as no/in and leaf as lf, x509ca as x5c, x509th as x5t, pri as p, sec as s. + RunLeafDeviceTest "sas" "Mqtt" "$deviceId-mqtt-sas-no-lf" $null + RunLeafDeviceTest "sas" "Amqp" "$deviceId-amqp-sas-no-lf" $null - RunLeafDeviceTest "sas" "Mqtt" "$deviceId-mqtt-sas-inscope-leaf" $edgeDeviceId - RunLeafDeviceTest "sas" "Amqp" "$deviceId-amqp-sas-inscope-leaf" $edgeDeviceId + RunLeafDeviceTest "sas" "Mqtt" "$deviceId-mqtt-sas-in-lf" $edgeDeviceId + RunLeafDeviceTest "sas" "Amqp" "$deviceId-amqp-sas-in-lf" $edgeDeviceId - RunLeafDeviceTest "x509CA" "Mqtt" "$deviceId-mqtt-x509ca-inscope-leaf" $edgeDeviceId - RunLeafDeviceTest "x509CA" "Amqp" "$deviceId-amqp-x509ca-inscope-leaf" $edgeDeviceId + RunLeafDeviceTest "x509CA" "Mqtt" "$deviceId-mqtt-x5c-in-lf" $edgeDeviceId + RunLeafDeviceTest "x509CA" "Amqp" "$deviceId-amqp-x5c-in-lf" $edgeDeviceId # run thumbprint test using primary cert with MQTT - RunLeafDeviceTest "x509Thumprint" "Mqtt" "$deviceId-mqtt-pri-x509th-inscope-leaf" $edgeDeviceId + RunLeafDeviceTest "x509Thumprint" "Mqtt" "$deviceId-mqtt-p-x5t-in-lf" $edgeDeviceId # run thumbprint test using secondary cert with MQTT - RunLeafDeviceTest "x509Thumprint" "Mqtt" "$deviceId-mqtt-sec-x509th-inscope-leaf" $edgeDeviceId $True + RunLeafDeviceTest "x509Thumprint" "Mqtt" "$deviceId-mqtt-s-x5t-in-lf" $edgeDeviceId $True # run thumbprint test using primary cert with AMQP - RunLeafDeviceTest "x509Thumprint" "Amqp" "$deviceId-amqp-pri-x509th-inscope-leaf" $edgeDeviceId + RunLeafDeviceTest "x509Thumprint" "Amqp" "$deviceId-amqp-p-x5t-in-lf" $edgeDeviceId # run thumbprint test using secondary cert with AMQP - RunLeafDeviceTest "x509Thumprint" "Amqp" "$deviceId-amqp-sec-x509th-inscope-leaf" $edgeDeviceId $True + RunLeafDeviceTest "x509Thumprint" "Amqp" "$deviceId-amqp-s-x5t-in-lf" $edgeDeviceId $True Return $testExitCode }