Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class OkDockerClientIntegrationSpec extends Specification {
]
}

@IgnoreIf({ OkDockerClientIntegrationSpec.dockerHubPassword == "-yet-another-password-" })
@IgnoreIf({ dockerHubPassword == "-yet-another-password-" })
def "should allow POST requests with body"() {
given:
def client = new OkDockerClient()
Expand Down Expand Up @@ -114,19 +114,16 @@ class OkDockerClientIntegrationSpec extends Specification {
def client = new OkDockerClient()

// pull image (ensure it exists locally)
client.post([path : "/images/create",
query : [fromImage: CONSTANTS.imageName],
headers: [EncodedRegistryAuth: "."]])
client.post([path : "/images/create",
query: [fromImage: CONSTANTS.imageName]])
// create container
// docker run --rm -it gesellix/testimage:os-windows cmd /V:ON /C "set /p line= & echo #!line!#"
def containerConfig = [
Tty : true,
// Tty : false,
OpenStdin: true,
Image : CONSTANTS.imageName,
Cmd : LocalDocker.isNativeWindows()
? ["cmd", "/V:ON", "/C", "set /p line= & echo #!line!#"]
: ["/bin/sh", "-c", "read line && echo \"#\$line#\""]
Tty : true,
// Tty : false,
OpenStdin : true,
Image : CONSTANTS.imageName,
Entrypoint: ["/cat"]
]
String containerId = client.post([path : "/containers/create".toString(),
query : [name: ""],
Expand All @@ -142,7 +139,7 @@ class OkDockerClientIntegrationSpec extends Specification {
// boolean multiplexStreams = !client.get([path: "/containers/${containerId}/json".toString()]).content.Config.Tty

String content = "attach ${UUID.randomUUID()}"
String expectedOutput = containerConfig.Tty ? "$content\r\n#$content#\r\n" : "#$content#\n"
String expectedOutput = containerConfig.Tty ? "$content\r\n$content\r\n" : "$content\n"

def stdout = new ByteArrayOutputStream(expectedOutput.length())
def stdin = new PipedOutputStream()
Expand Down Expand Up @@ -183,9 +180,9 @@ class OkDockerClientIntegrationSpec extends Specification {
stdin.write("$content\n".bytes)
stdin.flush()
stdin.close()
boolean sourceConsumed = onSourceConsumed.await(5, SECONDS)
boolean sinkWritten = onSinkWritten.await(5, SECONDS)
boolean sinkClosed = onSinkClosed.await(5, SECONDS)
boolean sourceConsumed = onSourceConsumed.await(5, SECONDS)

then:
sinkClosed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ class TestConstants {

final Map<String, Closure<Boolean>> versionDetails = [:]

static TestConstants CONSTANTS = new TestConstants()
public static TestConstants CONSTANTS = new TestConstants()

TestConstants() {
if (LocalDocker.isNativeWindows()) {
imageRepo = "gesellix/testimage"
imageRepo = "gesellix/echo-server"
imageTag = "os-windows"
imageDigest = "sha256:fd9e2bfa5acf34d40971f7749fcb560f3ef4423a814218055e5d124579ce7bd0"
//imageDigest = "sha256:ad668e7a31ddd5df9fa481b983df0ea300045da865179cfe058503c6ef16237d"
imageDigest = "sha256:9f33e2a85c7238da1205513c33b4f813176c34dbd3069752500e2f9f12bdde98"
}
else {
imageRepo = "gesellix/testimage"
imageRepo = "gesellix/echo-server"
imageTag = "os-linux"
imageDigest = "sha256:0ce18ad10d281bef97fe2333a9bdcc2dbf84b5302f66d796fed73aac675320db"
imageDigest = "sha256:9161d20871559b45e5afa19047ed0bfc1a0e2c6dfdd6a9488a2fd388fe28642d"
}
imageName = "$imageRepo:$imageTag"

Expand Down Expand Up @@ -56,9 +55,9 @@ class TestConstants {
versionDetails = [
ApiVersion : { it == "1.41" },
Arch : { it == "amd64" },
BuildTime : { it =~ "2021-07-30T\\w+" },
GitCommit : { it == "75249d8" },
GoVersion : { it == "go1.16.6" },
BuildTime : { it =~ "2021-11-18T\\w+" },
GitCommit : { it == "847da18" },
GoVersion : { it == "go1.16.9" },
KernelVersion: { it =~ "\\d.\\d{1,2}.\\d{1,2}\\w*" },
MinAPIVersion: { it == "1.24" },
Os : { it == "windows" },
Expand Down