Skip to content

Commit

Permalink
chore: restore and fix SSH tests on Windows Server Core images (#391)
Browse files Browse the repository at this point in the history
While working on #388 I remembered we disabled SSH specific tests for Windows Server Core image in order to deliver a new image cf notes of #289.

This PR removes this skip and fix them by waiting 10s before trying to connect with SSH (5s wasn't enough), as discovered in #388 (comment).
  • Loading branch information
lemeurherve authored Apr 28, 2024
1 parent 189c72c commit a57e36f
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit a57e36f

Please sign in to comment.