Skip to content

Commit

Permalink
repeated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 7, 2025
1 parent f2794b5 commit 7d1c61f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
5 changes: 5 additions & 0 deletions eo-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ SOFTWARE.
<artifactId>guava</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.artsok</groupId>
<artifactId>rerunner-jupiter</artifactId>
<version>2.1.6</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
25 changes: 13 additions & 12 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOnet/EOsocketTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.jcabi.log.Logger;
import com.sun.jna.Native;
import com.sun.jna.ptr.IntByReference;
import io.github.artsok.RepeatedIfExceptionsTest;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
Expand Down Expand Up @@ -172,7 +173,7 @@ private static int randomPort() {
@DisabledOnOs({OS.MAC, OS.LINUX})
@Execution(ExecutionMode.SAME_THREAD)
final class WindowsSocketTest {
@Test
@RepeatedIfExceptionsTest(repeats = 3)
void connectsToLocalServerViaSyscall() throws IOException, InterruptedException {
final RandomServer server = new RandomServer().started();
final int started = this.startup();
Expand All @@ -199,7 +200,7 @@ void connectsToLocalServerViaSyscall() throws IOException, InterruptedException
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
void refusesConnectionViaSyscall() throws UnknownHostException {
final int started = this.startup();
try {
Expand All @@ -225,7 +226,7 @@ void refusesConnectionViaSyscall() throws UnknownHostException {
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
void bindsSocketSuccessfullyViaSyscall() throws UnknownHostException {
final int started = this.startup();
try {
Expand All @@ -249,7 +250,7 @@ void bindsSocketSuccessfullyViaSyscall() throws UnknownHostException {
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
void startsListenOnPosixSocket() throws UnknownHostException {
final int started = this.startup();
try {
Expand All @@ -274,7 +275,7 @@ void startsListenOnPosixSocket() throws UnknownHostException {
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
void acceptsConnectionOnSocket() throws InterruptedException, UnknownHostException {
final int started = this.startup();
Expand Down Expand Up @@ -342,7 +343,7 @@ socket, addr, new IntByReference(addr.size())
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
@SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes")
void sendsAndReceivesMessagesViaSyscalls()
throws InterruptedException, UnknownHostException {
Expand Down Expand Up @@ -532,7 +533,7 @@ private SockaddrIn sockaddr(final int port) throws UnknownHostException {
@DisabledOnOs(OS.WINDOWS)
@Execution(ExecutionMode.SAME_THREAD)
final class PosixSocketTest {
@Test
@RepeatedIfExceptionsTest(repeats = 3)
void connectsToLocalServerViaSyscall() throws IOException {
final RandomServer server = new RandomServer().started();
final int socket = this.openSocket();
Expand All @@ -553,7 +554,7 @@ void connectsToLocalServerViaSyscall() throws IOException {
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
void refusesConnectionViaSyscall() {
final int socket = this.openSocket();
try {
Expand All @@ -570,7 +571,7 @@ void refusesConnectionViaSyscall() {
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
void bindsSocketSuccessfullyViaSyscall() {
final int socket = this.openSocket();
try {
Expand All @@ -588,7 +589,7 @@ void bindsSocketSuccessfullyViaSyscall() {
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
void startsListenOnPosixSocket() {
final int socket = this.openSocket();
try {
Expand All @@ -607,7 +608,7 @@ void startsListenOnPosixSocket() {
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
void acceptsConnectionOnSocket() throws InterruptedException {
final AtomicInteger accept = new AtomicInteger(0);
final AtomicReference<String> error = new AtomicReference<>();
Expand Down Expand Up @@ -666,7 +667,7 @@ socket, addr, new IntByReference(addr.size())
}
}

@Test
@RepeatedIfExceptionsTest(repeats = 3)
void sendsAndReceivesMessagesViaSyscalls() throws InterruptedException {
final AtomicInteger received = new AtomicInteger(-1);
final AtomicReference<byte[]> bytes = new AtomicReference<>();
Expand Down

0 comments on commit 7d1c61f

Please sign in to comment.