From 652ef6a19375dfdfaa2d17bc292c9b052b816948 Mon Sep 17 00:00:00 2001 From: Anubhav10 Date: Sun, 6 Mar 2016 14:35:53 +0530 Subject: [PATCH 1/2] Fixed Issue 1104 Made changes in configure-integration-tests.ps1. For an optional value it gives the option to change or remove the value, for a necessary value it doesn't give an option. --- script/configure-integration-tests.ps1 | 37 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/script/configure-integration-tests.ps1 b/script/configure-integration-tests.ps1 index 590291d95c..3f4d3e9a1e 100644 --- a/script/configure-integration-tests.ps1 +++ b/script/configure-integration-tests.ps1 @@ -1,4 +1,4 @@ -# TODO: this should indicate whether a variable is required or optional +# TODO: this should indicate whether a variable is required or optional function SetVariable([string]$key, [string]$value) { @@ -43,21 +43,34 @@ function VerifyEnvironmentVariable([string]$friendlyName, [string]$key, [bool]$o else { Write-Host "$existing_value found as the configured $friendlyName" - $reset = Read-Host -Prompt "Want to change this? Press Y, otherwise we'll move on" - if ($reset -eq "Y") - { - $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" - SetVariable $key $value - } - if ($optional -eq $true) { - $clear = Read-Host -Prompt 'Want to remove this optional value, press Y' + $clear = Read-Host -Prompt 'Want to remove or change this optional value, press Y' if ($clear -eq "Y") { - SetVariable $key $null - } - } + $reset = Read-Host -Prompt "Press R to remove and Press C to change the value, otherwise we'll move on" + if ($reset -eq "C") + { + $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" + SetVariable $key $value + } + elseif ($reset -eq "R") + { + SetVariable $key $null + } + } + + } + else + { + $reset = Read-Host -Prompt "Want to change this value , press Y, otherwise we'll move on" + if ($reset -eq "Y") + { + $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" + SetVariable $key $value + } + } + } Write-Host From 8609575dd640cb31d8c6090651dd73e28b710491 Mon Sep 17 00:00:00 2001 From: Anubhav10 Date: Mon, 7 Mar 2016 20:20:19 +0530 Subject: [PATCH 2/2] Made change in configure-integration-tests made white spaces consistent and changed the message --- script/configure-integration-tests.ps1 | 123 ++++++++++++------------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/script/configure-integration-tests.ps1 b/script/configure-integration-tests.ps1 index 3f4d3e9a1e..0bfcc1f186 100644 --- a/script/configure-integration-tests.ps1 +++ b/script/configure-integration-tests.ps1 @@ -1,4 +1,3 @@ -# TODO: this should indicate whether a variable is required or optional function SetVariable([string]$key, [string]$value) { @@ -8,72 +7,70 @@ function SetVariable([string]$key, [string]$value) function AskYesNoQuestion([string]$question, [string]$key) { - $answer = Read-Host -Prompt ($question + " Press Y to set this, otherwise we'll skip it") - if ($answer -eq "Y") - { - SetVariable $key "YES" - } - else - { - SetVariable $key $null - } - - Write-Host - - return ($answer -eq "Y") + $answer = Read-Host -Prompt ($question + " Press Y to set this, otherwise we'll skip it") + if ($answer -eq "Y") + { + SetVariable $key "YES" + } + else + { + SetVariable $key $null + } + + Write-Host + + return ($answer -eq "Y") } function VerifyEnvironmentVariable([string]$friendlyName, [string]$key, [bool]$optional = $false) { - if ($optional -eq $true) - { - $label = "(optional)" - } - else - { - $label = "(required)" - } - - $existing_value = [environment]::GetEnvironmentVariable($key,"User") - if ($existing_value -eq $null) - { - $value = Read-Host -Prompt "Set the $friendlyName to use for the integration tests $label" - SetVariable $key $value - } - else - { - Write-Host "$existing_value found as the configured $friendlyName" - if ($optional -eq $true) - { - $clear = Read-Host -Prompt 'Want to remove or change this optional value, press Y' - if ($clear -eq "Y") - { - $reset = Read-Host -Prompt "Press R to remove and Press C to change the value, otherwise we'll move on" - if ($reset -eq "C") - { - $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" - SetVariable $key $value - } - elseif ($reset -eq "R") - { - SetVariable $key $null - } - } - - } - else - { - $reset = Read-Host -Prompt "Want to change this value , press Y, otherwise we'll move on" - if ($reset -eq "Y") - { - $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" - SetVariable $key $value - } - } - - } - - Write-Host + if ($optional -eq $true) + { + $label = "(optional)" + } + else + { + $label = "(required)" + } + + $existing_value = [environment]::GetEnvironmentVariable($key,"User") + if ($existing_value -eq $null) + { + $value = Read-Host -Prompt "Set the $friendlyName to use for the integration tests $label" + SetVariable $key $value + } + else + { + Write-Host "$existing_value found as the configured $friendlyName" + if ($optional -eq $true) + { + $clear = Read-Host -Prompt 'Want to remove or change this optional value, press Y' + if ($clear -eq "Y") + { + $reset = Read-Host -Prompt "Press R to remove and Press C to change the value, otherwise we'll move on" + if ($reset -eq "C") + { + $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" + SetVariable $key $value + } + elseif ($reset -eq "R") + { + SetVariable $key $null + } + } + } + else + { + $reset = Read-Host -Prompt "Press Y to change this value, otherwise we'll move on " + if ($reset -eq "Y") + { + $value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests" + SetVariable $key $value + } + } + } + + Write-Host } Write-Host