Kest

Search

Search the documentation

Devtools

CI/CD integration

Catch an unexpected change to the application's structure.

Devtools.graphJson(container) writes the module graph as JSON, and Devtools.routes(...) the route table. Save them and compare in CI, so a pull request that adds a public endpoint or drops a guard is visible in review.

class StructureTest {
    @Test fun `the module graph and routes have not changed`() {
        val module = Testing.createModule<AppModule>()
        val server = module.startHttp(NettyHttpAdapter(0)) { useDevtools { token = "t" } }
        val routes = server.get("/_devtools/routes", mapOf("x-devtools-token" to "t")).text
        assertEquals(File("src/test/resources/routes.json").readText().trim(), routes.trim())     // update the file when a change is intended
    }
}

A failing test with a clear diff is the CI integration: no extra service is needed, and the reviewer sees exactly which routes changed. Publishing the graph to a hosted visualiser is not built.

Read more