Skip to content

Commit

Permalink
Fix SessionInfoTest failing on Ubuntu (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIMP authored Oct 17, 2024
1 parent 46a7a3b commit e581609
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions zenoh-kotlin/src/commonTest/kotlin/io/zenoh/SessionInfoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,43 +55,53 @@ class SessionInfoTest {
sessionC.close()
}


@Test
fun `routersZid test`() {
val jsonConfig = """

val listenerRouter = Zenoh.open(Config.fromJson("""
{
mode: "router",
listen: {
endpoints: ["tcp/localhost:7450"],
},
}
""".trimIndent()).getOrThrow()).getOrThrow()

val connectedRouterA = Zenoh.open(Config.fromJson("""
{
mode: "router",
connect: {
endpoints: ["tcp/localhost:7450"],
},
listen: {
endpoints: ["tcp/localhost:7452"],
endpoints: ["tcp/localhost:7451"],
},
}
""".trimIndent()
""".trimIndent()).getOrThrow()).getOrThrow()

val listenConfig = Config.fromJson("""
val connectedRouterB = Zenoh.open(Config.fromJson("""
{
mode: "router",
listen: {
connect: {
endpoints: ["tcp/localhost:7450"],
},
listen: {
endpoints: ["tcp/localhost:7452"],
},
}
""".trimIndent()).getOrThrow()
""".trimIndent()).getOrThrow()).getOrThrow()

val sessionC = Zenoh.open(listenConfig).getOrThrow()
val sessionA = Zenoh.open(Config.fromJson(jsonConfig).getOrThrow()).getOrThrow()
val sessionB = Zenoh.open(Config.fromJson(jsonConfig).getOrThrow()).getOrThrow()
val idA = connectedRouterA.info().zid().getOrThrow()
val idB = connectedRouterB.info().zid().getOrThrow()

val routers = listenerRouter.info().routersZid().getOrThrow()

val idA = sessionA.info().zid().getOrThrow()
val idB = sessionB.info().zid().getOrThrow()
val routers = sessionC.info().routersZid().getOrThrow()
assertTrue(routers.contains(idA))
assertTrue(routers.contains(idB))

sessionA.close()
sessionB.close()
sessionC.close()
connectedRouterA.close()
connectedRouterB.close()
listenerRouter.close()
}

@Test
Expand Down

0 comments on commit e581609

Please sign in to comment.