Containers/Import-Testing.ps1
function Import-Testing { Param( [Parameter(Mandatory=$false)] [string] $ContainerName, [Parameter(Mandatory=$false)] [pscredential] $Credential, [Parameter(Mandatory=$false)] [switch] $includeLibrariesOnly ) if ($null -eq $ContainerName -or $ContainerName -eq "") { $ContainerName = (Get-EnvironmentKeyValue -KeyName 'name') } if ($null -eq $Credential) { $NewCredential = New-CredentialFromEnvironmentJson if ($NewCredential -eq $false) { $Credential = [PSCredential]::new('admin', (ConvertTo-SecureString 'P@ssword1' -AsPlainText -Force)) $Password = (ConvertTo-SecureString 'P@ssword1' -AsPlainText -Force) } else { $Credential = $NewCredential $Password = (ConvertTo-SecureString (Get-EnvironmentKeyValue -KeyName "password") -AsPlainText -Force) } } else { $Password = $Credential.Password } [version]$platform = Get-AppKeyValue -KeyName 'platform' if ($platform.Major -eq 11) { Disable-SymbolLoading -ContainerName $ContainerName Start-Sleep -Seconds 5 } $startParameters = @{} if ($platform.Major -le 14) { $startParameters.Add('sqlCredential', [PSCredential]::new('sa', $Password)) } else { $startParameters.Add('credential', $Credential) $startParameters.Add('doNotUseRuntimePackages', $true) } if ($platform.Major -eq 11) { $startParameters.Add('doNotUpdateSymbols', $true) } if ($includeLibrariesOnly.IsPresent) { $startParameters.Add('includeTestLibrariesOnly', $true) } else { $startParameters.Add('includeTestLibrariesOnly', $false) } $locale = Get-EnvironmentKeyValue -KeyName "locale" if ($locale -ne "") { if ($locale -eq 'na') { $locale = 'US' } $startParameters.Add('testToolkitCountry', $locale) } Import-TestToolkitToBCContainer -containerName $ContainerName -ImportAction Overwrite @startParameters } Export-ModuleMember Import-Testing |