|
8 | 8 | versionSpec: '$(python.version)'
|
9 | 9 | architecture: '$(python.architecture)'
|
10 | 10 |
|
| 11 | +- powershell: | |
| 12 | + echo "Installing FS-iSCSITarget-Server" |
| 13 | + Install-WindowsFeature -Name FS-iSCSITarget-Server |
| 14 | +
|
| 15 | + # Allow connection on loopback interface. |
| 16 | + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\iSCSI Target' -Name AllowLoopBack -Value 1 |
| 17 | +
|
| 18 | + echo "Starting MsiSCSI" |
| 19 | + Start-Service msiscsi |
| 20 | + $retry = 10 |
| 21 | + do |
| 22 | + { |
| 23 | + $count = (Get-Service msiscsi | ? {$_.status -eq "Running"}).count |
| 24 | + $retry-- |
| 25 | + sleep -Milliseconds 500 |
| 26 | + } until ($count -Eq 0 -or $retry -Eq 0) |
| 27 | +
|
| 28 | + $service = Get-Service msiscsi |
| 29 | + if ($service.Status -Ne "Running") { |
| 30 | + throw "msiscsi not running" |
| 31 | + } |
| 32 | +
|
| 33 | + echo "Configuring Firewall" |
| 34 | + Get-NetFirewallServiceFilter -Service msiscsi | Enable-NetFirewallRule |
| 35 | +
|
| 36 | + echo "Configuring RAMDisk" |
| 37 | + New-IscsiVirtualDisk -ComputerName localhost -Path ramdisk:RAMDISK1.vhdx -Size 1GB |
| 38 | + New-IscsiServerTarget Target1 -ComputerName localhost -InitiatorId "IQN:*" |
| 39 | + Add-IscsiVirtualDiskTargetMapping -ComputerName localhost -TargetName Target1 -Path ramdisk:RAMDISK1.vhdx -Lun 1 |
| 40 | +
|
| 41 | + echo "Connecting to iSCSI" |
| 42 | + $ip = (Get-NetIPAddress -AddressFamily IPv4).ipaddress[0] |
| 43 | + New-IscsiTargetPortal -TargetPortalAddress $ip |
| 44 | + Get-IscsiTarget | Connect-IscsiTarget |
| 45 | +
|
| 46 | + echo "Configuring disk" |
| 47 | + Get-IscsiConnection | Get-Disk | Set-Disk -IsOffline $False |
| 48 | + Get-IscsiConnection | Get-Disk | Initialize-Disk -PartitionStyle MBR |
| 49 | + Get-IscsiConnection | Get-Disk | New-Partition -UseMaximumSize -DriveLetter R |
| 50 | + Format-Volume -DriveLetter R -NewFileSystemLabel Temp -FileSystem NTFS |
| 51 | +
|
| 52 | + echo "Adding permissions" |
| 53 | + mkdir R:\Temp |
| 54 | + $acl = Get-Acl "R:\Temp" |
| 55 | + $rule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow") |
| 56 | + $acl.AddAccessRule($rule) |
| 57 | + Set-Acl "R:\Temp" $acl |
| 58 | + displayName: Setup RAM Disk |
| 59 | + |
11 | 60 | - bash: pip install --upgrade setuptools tox
|
12 | 61 | displayName: Install Tox
|
13 | 62 |
|
14 |
| -- script: tox -e py -- -m unit -n 3 --junit-xml=junit/unit-test.xml |
| 63 | +- script: |
| 64 | + tox -e py -- -m unit --junit-xml=junit/unit-test.xml |
| 65 | + env: |
| 66 | + TEMP: "R:\\Temp" |
15 | 67 | displayName: Tox run unit tests
|
16 | 68 |
|
17 | 69 | - ${{ if eq(parameters.runIntegrationTests, 'true') }}:
|
|
23 | 75 |
|
24 | 76 | # Shorten paths to get under MAX_PATH or else integration tests will fail
|
25 | 77 | # https://bugs.python.org/issue18199
|
26 |
| - subst T: $env:TEMP |
27 |
| - $env:TEMP = "T:\" |
28 |
| - $env:TMP = "T:\" |
| 78 | + $env:TEMP = "R:\Temp" |
29 | 79 |
|
30 | 80 | tox -e py -- -m integration -n 3 --duration=5 --junit-xml=junit/integration-test.xml
|
31 | 81 | displayName: Tox run integration tests
|
|
0 commit comments