dev_init.ps1
# This is sample initialization to be used in dev environments. Please modify the parameters below to fir your environment #cd ..\..\..\..\PowerShellTests_FA2.2\bin\Debug\netcoreapp2.1\publish\ xcopy *.* publish /Y cd publish Import-Module ./PureStoragePowerShellSDK2.dll $ArrayEndpoint = "vm-hanan" $ArrayUsername = "pureuser" $ArrayPassword = "pureuser" $ArrayClientname = $env:COMPUTERNAME + "-" + "Debug" $ArrayIssuer = $ArrayClientname $TargetEndPoint = "vm-hanan" $TargetClientname = $ArrayClientname $TargetIssuer = $ArrayClientname $PrivateKeyPassword = "R00tr00t#" $DebugPreference = "Continue" $WarningPreference = "Continue" #$VerbosePreference = "Continue" $ErrorActionPreference = "Continue" $Password = ConvertTo-SecureString $ArrayPassword -AsPlainText -Force $Oauth = $True if ($Oauth) { $Issuer = "PureStorage" $ClientName = "test" $ArrayAuth = New-Pfa2ArrayAuth -Endpoint $ArrayEndpoint -ApiClientName $ArrayClientname -Issuer $ArrayIssuer -Username $ArrayUsername -Password $Password -Force $ClientId = $ArrayAuth.PureClientApiClientInfo.clientId $KeyId = $ArrayAuth.PureClientApiClientInfo.KeyId $PrivateKeyFile = $ArrayAuth.pureCertInfo.privateKeyFile $PrivatePassword = ConvertTo-SecureString $PrivateKeyPassword -AsPlainText -Force $Array = Connect-Pfa2Array -Endpoint $ArrayEndpoint -Username $ArrayUsername -Issuer $ArrayIssuer -ClientId $ClientId -KeyId $KeyId -PrivateKeyFile $PrivateKeyFile -PrivateKeyPassword $PrivatePassword -IgnoreCertificateError -DisableVerbosePhoneHomeLogging } else { $Array = Connect-Pfa2Array -Endpoint $ArrayEndpoint -Username $ArrayUsername -Password $Password -IgnoreCertificateError -DisableVerbosePhoneHomeLogging } $TestMethodNames = { param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter) $FileFilter = $fakeBoundParameter.File Select-String -Path .\TestScripts\$FileFilter -Pattern "function.*Test()" | ForEach-Object { ($_ -Split "function ")[1].Trim('(',')') } } function Run-Pfa2Test { param( [ArgumentCompleter( { (Get-ChildItem -Path "$(Get-Location)\TestScripts\" -File).Name } )] [string] $File, [ArgumentCompleter({ & $TestMethodNames @Args })] [string] $TestMethod ) #$ArrayEndpoint = "vm-jporkka" $ArrayUsername = "pureuser" $ArrayPassword = "pureuser" $ArrayClientname = $env:COMPUTERNAME + "-" + "Debug" $ArrayIssuer = $ArrayClientname $TestName = $TestMethod #$TargetEndPoint = "vm-jporkka" $TargetClientname = $ArrayClientname $TargetIssuer = $ArrayClientname $PrivateKeyPassword = "R00tr00t#" $script:GeneratedNames = @( "PSTest-$($env:COMPUTERNAME)" ) . $File -ArrayEndpoint $ArrayEndpoint -ArrayUsername $ArrayUsername -ArrayPassword $ArrayPassword -ArrayClientname $ArrayClientname -ArrayIssuer $ArrayIssuer -TestName $TestName -TargetEndPoint $TargetEndPoint -TargetClientname $TargetClientname -TargetIssuser $TargetIssuer -PrivateKeyPassword $PrivateKeyPassword } |