Skip to content

Commit

Permalink
CI build failure (#10)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Tilmann Zäschke <tilmann.zaeschke@inf.ethz.ch>
  • Loading branch information
tzaeschke and Tilmann Zäschke authored Feb 6, 2024
1 parent c233bee commit 7a0c3dd
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Changed
- BREAKING CHANGE: Changed maven artifactId to "client"
[#9](https://github.com/tzaeschke/phtree-cpp/pull/9)

### Fixed
- CI failures on JDK 8. [#10](https://github.com/tzaeschke/phtree-cpp/pull/10)

## [0.1.0-ALPHA] - 2024-02-01

Expand Down
3 changes: 0 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@
## Plan

### 0.1.0
- Fix CI failure (it works locally and used to work up until the release)
- Fix 2023->2024 in headers
- rename artifact from "scion-java-client" to "client"
- SCMP error handling (only error, not info)
- implement callbacks (+ option to NOT ignore)
- E.g. MTU exceeded, path expired, checksum problem, "destination unreachable"
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/scion/demo/DemoConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class DemoConstants {

public enum Network {
MOCK_TOPOLOGY, // SCION Java JUnit mock network
MOCK_TOPOLOGY_IPV4, // SCION Java JUnit mock network, IPv4 only
TINY_PROTO, // Try to connect to "tiny" scionproto network
MINIMAL_PROTO, // Try to connect to "minimal" scionproto network
PRODUCTION // production network
Expand Down
8 changes: 6 additions & 2 deletions src/test/java/org/scion/demo/DemoTopology.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ static DemoTopology configureTiny111_112() {
return cfg;
}

static DemoTopology configureMock() {
static DemoTopology configureMock(boolean remoteIPv4) {
DemoTopology cfg = new DemoTopology();
MockNetwork.startTiny(true, false);
MockNetwork.startTiny(true, remoteIPv4);
cfg.clientDaemonAddress = MockDaemon.DEFAULT_ADDRESS;
// cfg.serverDaemonAddress = new InetSocketAddress("fd00:f00d:cafe::7", 30255);
return cfg;
}

static DemoTopology configureMock() {
return configureMock(false);
}

static void shutDown() {
MockNetwork.stopTiny();
}
Expand Down
9 changes: 8 additions & 1 deletion src/test/java/org/scion/demo/PingPongChannelClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ public static void receiveMessage(DatagramChannel channel) throws IOException {
public static void main(String[] args) throws IOException, InterruptedException {
// Demo setup
switch (NETWORK) {
case MOCK_TOPOLOGY_IPV4:
{
DemoTopology.configureMock(true);
MockDNS.install("1-ff00:0:112", "localhost", "127.0.0.1");
doClientStuff(DemoConstants.ia112);
DemoTopology.shutDown();
break;
}
case MOCK_TOPOLOGY:
{
DemoTopology.configureMock();
Expand Down Expand Up @@ -92,7 +100,6 @@ private static void doClientStuff(long destinationIA) throws IOException {
DatagramChannel channel = startClient();
String msg = "Hello scion";
InetSocketAddress serverAddress = PingPongChannelServer.getServerAddress(NETWORK);
// ScionSocketAddress serverAddress = ScionSocketAddress.create(isdAs, "::1", 44444);
Path path = Scion.defaultService().getPaths(destinationIA, serverAddress).get(0);

sendMessage(channel, msg, path);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/scion/demo/PingPongChannelServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static InetSocketAddress getServerAddress(DemoConstants.Network network)
case MOCK_TOPOLOGY:
case TINY_PROTO:
return new InetSocketAddress("::1", SERVER_PORT);
case MOCK_TOPOLOGY_IPV4:
case MINIMAL_PROTO:
return new InetSocketAddress("127.0.0.1", SERVER_PORT);
default:
Expand Down
11 changes: 9 additions & 2 deletions src/test/java/org/scion/demo/PingPongDemoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,24 @@

import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.scion.ScionService;

public class PingPongDemoTest {

@BeforeAll
public static void beforeAll() {
ScionService.closeDefault();
}

@Test
public void test() throws InterruptedException {
AtomicInteger failures = new AtomicInteger();
PingPongChannelServer.PRINT = false;
PingPongChannelServer.NETWORK = DemoConstants.Network.MOCK_TOPOLOGY;
PingPongChannelServer.NETWORK = DemoConstants.Network.MOCK_TOPOLOGY_IPV4;
PingPongChannelClient.PRINT = false;
PingPongChannelClient.NETWORK = DemoConstants.Network.MOCK_TOPOLOGY;
PingPongChannelClient.NETWORK = DemoConstants.Network.MOCK_TOPOLOGY_IPV4;
Thread server =
new Thread(
() -> {
Expand Down
27 changes: 17 additions & 10 deletions src/test/java/org/scion/testutil/MockTopologyServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ private class TopologyServerImpl implements Runnable {

@Override
public void run() {
try (ServerSocketChannel chnLocal = ServerSocketChannel.open().bind(null)) {
try (ServerSocketChannel chnLocal = ServerSocketChannel.open()) {
// Explicit binding to "localhost" to avoid automatic binding to IPv6 which is not
// supported by GitHub CI (https://github.com/actions/runner-images/issues/668).
InetSocketAddress local = new InetSocketAddress(InetAddress.getLocalHost(), 45678);
chnLocal.bind(local);
chnLocal.configureBlocking(true);
ByteBuffer buffer = ByteBuffer.allocate(66000);
serverSocket.set((InetSocketAddress) chnLocal.getLocalAddress());
Expand All @@ -196,15 +200,18 @@ public void run() {
logger.info("Topology server serves file to " + srcAddress);
buffer.clear();

StringBuilder out = new StringBuilder();
out.append("HTTP/1.1 200 OK\n");
out.append("Connection: close\n");
out.append("Content-Type: text/plain\n");
out.append("Content-Length:").append(topologyFile.length()).append("\n");
out.append("\n");
out.append(topologyFile).append("\n");

buffer.put(out.toString().getBytes());
String out =
"HTTP/1.1 200 OK\n"
+ "Connection: close\n"
+ "Content-Type: text/plain\n"
+ "Content-Length:"
+ topologyFile.length()
+ "\n"
+ "\n"
+ topologyFile
+ "\n";

buffer.put(out.getBytes());
buffer.flip();
ss.write(buffer);
} else {
Expand Down

0 comments on commit 7a0c3dd

Please sign in to comment.