Skip to content

Commit 0509fd8

Browse files
authored
Merge pull request #10132 from priyawadhwa/windows-test
CI: add TestScheduledStop on windows in github actions
2 parents 55fcfd2 + 735781d commit 0509fd8

File tree

2 files changed

+388
-0
lines changed

2 files changed

+388
-0
lines changed

.github/workflows/master.yml

+192
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,198 @@ jobs:
651651
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
652652
if [ "$numPass" -lt 26 ];then echo "*** Failed to pass at least 26 ! ***";exit 2;fi
653653
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
654+
scheduled_stop_docker_windows:
655+
needs: [build_minikube]
656+
env:
657+
TIME_ELAPSED: time
658+
JOB_NAME: "scheduled_stop_docker_windows"
659+
GOPOGH_RESULT: ""
660+
STAT: ""
661+
runs-on: [self-hosted, windows-10-ent, 8CPUs]
662+
steps:
663+
- name: Clean up
664+
continue-on-error: true
665+
shell: powershell
666+
run: |
667+
echo $env:computerName
668+
ls
669+
$ErrorActionPreference = "SilentlyContinue"
670+
cd minikube_binaries
671+
ls
672+
$env:KUBECONFIG="${pwd}\testhome\kubeconfig"
673+
$env:MINIKUBE_HOME="${pwd}\testhome"
674+
.\minikube-windows-amd64.exe delete --all --purge
675+
Get-VM | Where-Object {$_.Name -ne "DockerDesktopVM"} | Foreach {
676+
.\minikube-windows-amd64.exe delete -p $_.Name
677+
Suspend-VM $_.Name
678+
Stop-VM $_.Name -Force
679+
Remove-VM $_.Name -Force
680+
}
681+
cd ..
682+
Remove-Item minikube_binaries -Force -Recurse
683+
ls
684+
- name: Download Binaries
685+
uses: actions/download-artifact@v1
686+
with:
687+
name: minikube_binaries
688+
- name: Start Docker Desktop
689+
shell: powershell
690+
continue-on-error: true
691+
run: |
692+
$ErrorActionPreference = "SilentlyContinue"
693+
docker ps 2>&1 | Out-Null
694+
$docker_running = $?
695+
if (!$docker_running) {
696+
Write-Output "Starting Docker as an administrator"
697+
Start-Process 'C:/Program Files/Docker/Docker/Docker Desktop.exe' -Verb runAs
698+
}
699+
while (!$docker_running) {
700+
Start-Sleep 5
701+
docker ps 2>&1 | Out-Null
702+
$docker_running = $?
703+
}
704+
Write-Output "Docker is running"
705+
docker system prune -f
706+
- name: Info
707+
shell: powershell
708+
run: |
709+
echo $env:computername
710+
echo "------------------------"
711+
docker info
712+
echo "------------------------"
713+
docker volume ls
714+
echo "------------------------"
715+
docker system info --format '{{json .}}'
716+
echo "------------------------"
717+
- uses: actions/setup-go@v2
718+
with:
719+
go-version: '1.15.5'
720+
stable: true
721+
- name: Install tools
722+
continue-on-error: true
723+
shell: powershell
724+
run: |
725+
(New-Object Net.WebClient).DownloadFile("https://github.com/medyagh/gopogh/releases/download/v0.3.0/gopogh.exe", "C:\ProgramData\chocolatey\bin\gopogh.exe")
726+
choco install -y kubernetes-cli
727+
choco install -y jq
728+
choco install -y caffeine
729+
if (Test-Path 'C:\Program Files\Docker\Docker\resources\bin\kubectl.exe') { Remove-Item 'C:\Program Files\Docker\Docker\resources\bin\kubectl.exe' };
730+
- name: Run Integration Test in powershell
731+
shell: powershell
732+
run: |
733+
cd minikube_binaries
734+
New-Item -Force -Path "report" -ItemType Directory
735+
New-Item -Force -Path "testhome" -ItemType Directory
736+
$START_TIME=(GET-DATE)
737+
$env:KUBECONFIG="${pwd}\testhome\kubeconfig"
738+
$env:MINIKUBE_HOME="${pwd}\testhome"
739+
$ErrorActionPreference = "SilentlyContinue"
740+
.\e2e-windows-amd64.exe --minikube-start-args="--driver=docker" --test.timeout=15m --timeout-multiplier=1 --test.v --test.run=TestScheduledStopWindows --binary=./minikube-windows-amd64.exe | Tee-Object -FilePath ".\report\testout.txt"
741+
$END_TIME=(GET-DATE)
742+
echo $END_TIME
743+
$DURATION=(NEW-TIMESPAN -Start $START_TIME -End $END_TIME)
744+
echo $DURATION
745+
$SECS=($DURATION.TotalSeconds)
746+
$MINS=($DURATION.TotalMinutes)
747+
$T_ELAPSED="$MINS m $SECS s"
748+
echo "----"
749+
echo $T_ELAPSED
750+
echo "----"
751+
echo "TIME_ELAPSED=$T_ELAPSED" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
752+
scheduled_stop_hyperv_windows:
753+
needs: [build_minikube]
754+
env:
755+
TIME_ELAPSED: time
756+
JOB_NAME: "scheduled_stop_hyperv_windows"
757+
GOPOGH_RESULT: ""
758+
runs-on: [self-hosted, windows-10-ent, Standard_D16s_v3, hyperv]
759+
steps:
760+
- name: Clean up
761+
continue-on-error: true
762+
shell: powershell
763+
run: |
764+
echo $env:computerName
765+
ls
766+
$ErrorActionPreference = "SilentlyContinue"
767+
cd minikube_binaries
768+
ls
769+
$env:KUBECONFIG="${pwd}\testhome\kubeconfig"
770+
$env:MINIKUBE_HOME="${pwd}\testhome"
771+
.\minikube-windows-amd64.exe delete --all --purge
772+
Get-VM | Where-Object {$_.Name -ne "DockerDesktopVM"} | Foreach {
773+
Stop-VM -Name $_.Name -Force
774+
Remove-VM $_.Name -Force
775+
}
776+
cd ..
777+
Remove-Item minikube_binaries -Force -Recurse
778+
ls
779+
- name: Download Binaries
780+
uses: actions/download-artifact@v1
781+
with:
782+
name: minikube_binaries
783+
- name: Start Docker Desktop
784+
shell: powershell
785+
continue-on-error: true
786+
run: |
787+
$ErrorActionPreference = "SilentlyContinue"
788+
docker ps 2>&1 | Out-Null
789+
$docker_running = $?
790+
if (!$docker_running) {
791+
Write-Output "Starting Docker as an administrator"
792+
Start-Process 'C:/Program Files/Docker/Docker/Docker Desktop.exe' -Verb runAs
793+
}
794+
while (!$docker_running) {
795+
Start-Sleep 5
796+
docker ps 2>&1 | Out-Null
797+
$docker_running = $?
798+
}
799+
Write-Output "Docker is running"
800+
docker system prune -f
801+
- name: Info
802+
continue-on-error: true
803+
shell: powershell
804+
run: |
805+
$ErrorActionPreference = "SilentlyContinue"
806+
cd minikube_binaries
807+
ls
808+
echo $env:computername
809+
Get-WmiObject -class Win32_ComputerSystem
810+
- uses: actions/setup-go@v2
811+
with:
812+
go-version: '1.15.5'
813+
stable: true
814+
- name: Install tools
815+
continue-on-error: true
816+
shell: powershell
817+
run: |
818+
$ErrorActionPreference = "SilentlyContinue"
819+
(New-Object Net.WebClient).DownloadFile("https://github.com/medyagh/gopogh/releases/download/v0.3.0/gopogh.exe", "C:\ProgramData\chocolatey\bin\gopogh.exe")
820+
choco install -y kubernetes-cli
821+
choco install -y jq
822+
choco install -y caffeine
823+
if (Test-Path 'C:\Program Files\Docker\Docker\resources\bin\kubectl.exe') { Remove-Item 'C:\Program Files\Docker\Docker\resources\bin\kubectl.exe' };
824+
- name: Run Integration Test in powershell
825+
shell: powershell
826+
run: |
827+
cd minikube_binaries
828+
New-Item -Force -Path "report" -ItemType Directory
829+
New-Item -Force -Path "testhome" -ItemType Directory
830+
$START_TIME=(GET-DATE)
831+
$env:KUBECONFIG="${pwd}\testhome\kubeconfig"
832+
$env:MINIKUBE_HOME="${pwd}\testhome"
833+
$ErrorActionPreference = "SilentlyContinue"
834+
.\e2e-windows-amd64.exe --minikube-start-args="--driver=hyperv" --test.timeout=20m --timeout-multiplier=1.5 --test.v --test.run=TestScheduledStopWindows --binary=./minikube-windows-amd64.exe | Tee-Object -FilePath ".\report\testout.txt"
835+
$END_TIME=(GET-DATE)
836+
echo $END_TIME
837+
$DURATION=(NEW-TIMESPAN -Start $START_TIME -End $END_TIME)
838+
echo $DURATION
839+
$SECS=($DURATION.TotalSeconds)
840+
$MINS=($DURATION.TotalMinutes)
841+
$T_ELAPSED="$MINS m $SECS s"
842+
echo "----"
843+
echo $T_ELAPSED
844+
echo "----"
845+
echo "TIME_ELAPSED=$T_ELAPSED" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
654846
functional_docker_ubuntu_arm64:
655847
needs: [ build_minikube ]
656848
runs-on: [ self-hosted, arm64 ]

0 commit comments

Comments
 (0)