Tests/settings.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$Source = @"
 using System.Net;
  
 public class MyWebClient : WebClient
 {
  protected override WebRequest GetWebRequest(System.Uri address)
  {
   WebRequest request = base.GetWebRequest(address);
   if (request != null)
   {
    request.Timeout = -1;
   }
   return request;
  }
  }
"@
;
 
Add-Type -TypeDefinition $Source -Language CSharp -WarningAction SilentlyContinue | Out-Null

$imageName = "microsoft/dynamics-nav:2018"
$imageName2 = "microsoft/dynamics-nav:2018-dk"

$licenseFile = "c:\programdata\navcontainerhelper\license.flf"
if (!(Test-Path $licenseFile)) {
    throw "License file must be in $licenseFile to run test"
}

$navDvdUrl = "http://download.microsoft.com/download/F/D/1/FD164E3F-9FB2-46DB-B314-065D86ACA3B1/CU%2014%20NAV%202017%20W1.zip"
$navDvdPath = "c:\programdata\navcontainerhelper\navdvd"
if (!(Test-Path -Path $navDvdPath -PathType Container)) {
    Download-File -sourceUrl $navDvdUrl -destinationFile "${navDvdPath}.zip"
    Write-Host "Expanding .zip file"
    Expand-Archive -Path "${navDvdPath}.zip" -DestinationPath "${navDvdPath}.temp"
    (Get-item -Path "${navDvdPath}.temp\*.zip").FullName
    Write-Host "Expanding NAV DVD"
    $zipname = (Get-item -Path "${navDvdPath}.temp\*.zip").FullName
    Expand-Archive -Path $zipname -DestinationPath $navdvdPath
    Write-Host "Cleaning up"
    Remove-Item -Path "${navdvdPath}.temp" -Recurse -Force
    Remove-Item -Path "$navdvdPath.zip" -Force
}

if ($credential -eq $null -or $credential -eq [System.Management.Automation.PSCredential]::Empty) {
    $credential = Get-Credential -Username $env:USERNAME -Message "Enter a set of credentials to use for containers in the tests"
}
$sqlCredential = New-Object System.Management.Automation.PSCredential ('sa', $credential.Password)

#docker pull $imageName
#docker pull $imageName2