Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: restore and fix SSH tests on Windows Server Core images #391

9 changes: 6 additions & 3 deletions tests/sshAgent.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ Describe "[$global:IMAGE_NAME] image has correct version of java and git-lfs ins
}
}

Describe "[$global:IMAGE_NAME] create agent container with pubkey as argument" -Skip:($global:WINDOWSFLAVOR -eq 'windowsservercore') {
Describe "[$global:IMAGE_NAME] create agent container with pubkey as argument" {
BeforeAll {
docker run --detach --tty --name="$global:CONTAINERNAME" --publish-all "$global:IMAGE_NAME" "$global:PUBLIC_SSH_KEY"
Is-ContainerRunning $global:CONTAINERNAME | Should -BeTrue
Start-Sleep -Seconds 10
}

It 'runs commands via ssh' {
Expand All @@ -143,10 +144,11 @@ Describe "[$global:IMAGE_NAME] create agent container with pubkey as argument" -
}
}

Describe "[$global:IMAGE_NAME] create agent container with pubkey as envvar" -Skip:($global:WINDOWSFLAVOR -eq 'windowsservercore') {
Describe "[$global:IMAGE_NAME] create agent container with pubkey as envvar" {
BeforeAll {
docker run --detach --tty --name="$global:CONTAINERNAME" --publish-all --env="JENKINS_AGENT_SSH_PUBKEY=$global:PUBLIC_SSH_KEY" "$global:IMAGE_NAME"
Is-ContainerRunning $global:CONTAINERNAME | Should -BeTrue
Start-Sleep -Seconds 10
}

It 'runs commands via ssh' {
Expand All @@ -162,11 +164,12 @@ Describe "[$global:IMAGE_NAME] create agent container with pubkey as envvar" -Sk


$global:DOCKER_PLUGIN_DEFAULT_ARG="/usr/sbin/sshd -D -p 22"
Describe "[$global:IMAGE_NAME] create agent container like docker-plugin with '$global:DOCKER_PLUGIN_DEFAULT_ARG' as argument" -Skip:($global:WINDOWSFLAVOR -eq 'windowsservercore') {
Describe "[$global:IMAGE_NAME] create agent container like docker-plugin with '$global:DOCKER_PLUGIN_DEFAULT_ARG' as argument" {
BeforeAll {
[string]::IsNullOrWhiteSpace($global:DOCKER_PLUGIN_DEFAULT_ARG) | Should -BeFalse
docker run --detach --tty --name="$global:CONTAINERNAME" --publish-all --env="JENKINS_AGENT_SSH_PUBKEY=$global:PUBLIC_SSH_KEY" "$global:IMAGE_NAME" "$global:DOCKER_PLUGIN_DEFAULT_ARG"
Is-ContainerRunning $global:CONTAINERNAME | Should -BeTrue
Start-Sleep -Seconds 10
}

It 'runs commands via ssh' {
Expand Down