Closed gesellix closed 5 years ago
It seems like the way the integrative tests are performed makes triggers the issue.
@Requires({ LocalDocker.available() })
Both 1. and 2. check AFUNIXSocket.isSupported()
, which internally tries new NativeLibraryLoader().loadLibrary()
.
This one works without issues:
package de.gesellix.gradle.docker
import de.gesellix.docker.client.DockerClientImpl
import spock.lang.Requires
import spock.lang.Specification
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
@Requires({ LocalDocker.available() })
class TestJunixsocket extends Specification {
def "perform simple test"() {
expect:
200 == new DockerClientImpl().ping().status.code
}
def "perform async test"() {
given:
def result = new AtomicInteger()
def latch = new CountDownLatch(1)
when:
Thread.start {
def code = new DockerClientImpl().ping().status.code
result.set(code)
latch.countDown()
}
while (!latch.await(5, TimeUnit.SECONDS)) {
Thread.sleep(500)
}
then:
result.get() == 200
}
}
--> does using the GradleRunner break anything?
See https://github.com/gesellix/gradle-testkit-junixsocket-issue for a reproducible test and https://github.com/kohlschutter/junixsocket/issues/60 for a discussion
junixsocket 2.2.0 fixes the issue
The build fails with this exception: https://github.com/kohlschutter/junixsocket/blob/6b88c5f8aa65b9f0f77b6e4880c521ee09a176f5/junixsocket-common/src/main/java/org/newsclub/net/unix/AFUNIXSocket.java#L54
Stacktrace: