원클릭으로
zio-golem-integration-tests
// Run and debug Golem Scala SDK integration tests. Use when running golem integration tests, debugging test failures, or working with GolemExamplesIntegrationSpec.
// Run and debug Golem Scala SDK integration tests. Use when running golem integration tests, debugging test failures, or working with GolemExamplesIntegrationSpec.
Explains the zio-golem WIT folder structure and how to regenerate the agent_guest.wasm base image. Use when working with WIT definitions, upgrading Golem versions, or regenerating the guest runtime WASM.
Generating Scala code in the golem subproject. Use when adding code generation steps, build-time source generators, scalameta AST construction, or sbt/Mill sourceGenerators to the golem/ subtree.
Compile, publish, and test the ZIO Golem Scala.js SDK. Use when working on the golem/ subtree: building the SDK, publishing locally, compiling/running the example demo, regenerating the agent_guest.wasm, or debugging end-to-end deployment.
| name | zio-golem-integration-tests |
| description | Run and debug Golem Scala SDK integration tests. Use when running golem integration tests, debugging test failures, or working with GolemExamplesIntegrationSpec. |
Integration tests for the Golem Scala SDK live in golem/integration-tests/. They exercise test agents against a real local Golem server.
golem-cli on PATH (v1.5.0-dev at ~/.cargo/bin/golem-cli)GOLEM_TS_PACKAGES_PATHsbt --client '++3.8.2; set ThisBuild / version := "0.0.0-SNAPSHOT"; set ThisBuild / packageDoc / publishArtifact := false; set every (publish / skip) := false; zioGolemModelJVM/publishLocal; zioGolemModelJS/publishLocal; zioGolemMacros/publishLocal; zioGolemCoreJS/publishLocal'
The simplest way to run all tests (unit + integration, Scala 2 + 3) is with non-client sbt:
GOLEM_TS_PACKAGES_PATH=<TS_PACKAGES_PATH> sbt golemTestAll
The GOLEM_TS_PACKAGES_PATH env var is forwarded automatically by build.sbt to javaOptions and envVars for the integration tests.
sbt --clientWith sbt --client, env vars don't propagate to the forked test JVM. Use the set override instead:
# All integration tests
sbt --client '++3.8.2; set zioGolemIntegrationTests / Test / javaOptions += "-Dgolem.tsPackagesPath=<TS_PACKAGES_PATH>"; zioGolemIntegrationTests/test'
# Only HTTP endpoint tests
sbt --client '++3.8.2; set zioGolemIntegrationTests / Test / javaOptions += "-Dgolem.tsPackagesPath=<TS_PACKAGES_PATH>"; zioGolemIntegrationTests/testOnly -- -t http-'
# A specific test by name
sbt --client '++3.8.2; set zioGolemIntegrationTests / Test / javaOptions += "-Dgolem.tsPackagesPath=<TS_PACKAGES_PATH>"; zioGolemIntegrationTests/testOnly -- -t sync-return'
Use the standard AGENTS.md sbt logging pattern (redirect to log file, check exit code).
The GolemServer.layer (ZLayer) handles everything:
golem-cli is on PATHGOLEM_TS_PACKAGES_PATH / golem.tsPackagesPath is setgolem-temp/ directory (stale REPL caches)golem-cli -vvv server run --clean --disable-app-manifest-discoverygolem-cli deploy (with one retry)Sample tests — TypeScript REPL scripts in golem/test-agents/samples/*/repl-*.ts. Each script is executed via golem-cli repl scala:examples --language typescript --script-file <script>. Output is checked for expected fragments.
HTTP endpoint tests — Direct HTTP calls to localhost:9006 (configured in golem.yaml). Test code-first HTTP routes defined via @agentDefinition(mount=...) and @endpoint(...).
| File | Purpose |
|---|---|
golem/integration-tests/src/test/scala/golem/integration/GolemExamplesIntegrationSpec.scala | All tests |
golem/test-agents/golem.yaml | App manifest (components, HTTP deployments) |
golem/test-agents/src/main/scala/example/minimal/ | Agent definitions and implementations |
golem/test-agents/samples/ | TypeScript REPL test scripts |
golem/test-agents/.golem/ | Build output (created by golem-cli deploy) |
golem/test-agents/.generated/agent_guest.wasm | Prebuilt QuickJS WASM runtime |
golem/test-agents/golem-temp/ | REPL caches, bridge SDKs (created at runtime) |
pkill -f "golem.*server" 2>/dev/null
rm -rf golem/test-agents/.golem golem/test-agents/target
rm -rf golem/macros/target golem/model/.jvm/target golem/model/.js/target
rm -rf golem/core/js/target
The Golem CLI caches builds aggressively ([UP-TO-DATE]). If you changed macro or core logic, you MUST delete .golem/ to force a rebuild.
.generated/agent_guest.wasm existscp golem/sbt/src/main/resources/golem/wasm/agent_guest.wasm golem/test-agents/.generated/agent_guest.wasm
This is normally done by sbt golemPrepare but the integration test deploy command needs it in place.
port 9881 is already in useA golem server is already running. Kill it: pkill -f "golem.*server"
GOLEM_TS_PACKAGES_PATH env var or golem.tsPackagesPath system property must be setPass the system property via javaOptions in the sbt command (see Running Tests above).
Cannot find package '@golem/golem-ts-repl/index.js'The TypeScript SDK packages are not built. Build them in the golem repo, or check the path is correct.
golem deploy failed after retryCheck the deploy output for the root cause. Common issues:
.generated/agent_guest.wasm[UP-TO-DATE] but code changedDelete golem/test-agents/.golem/ to force a full rebuild.
These are independent. REPL tests use golem-cli repl with TS scripts. HTTP tests use direct HTTP calls to port 9006.
deleteRecursive destroying files in external reposThe golem-temp/repl/ts/node_modules/@golem/ contains symlinks to the TS SDK packages directory. The cleanup code in GolemServer.layer checks for symlinks before recursing to avoid deleting symlink targets. Never use plain rm -rf on golem-temp/ — always delete symlinks first:
find golem/test-agents/golem-temp -type l -delete 2>/dev/null
rm -rf golem/test-agents/golem-temp
After deploy, inspect the component to verify constructor and method schemas:
golem-cli component get scala:examples --local
Look for correct parameter names in the output, e.g.:
WeatherAgent.getWeather(city: string) — not (value: string)CatalogAgent(region: string, catalog: string) — case class fields flattenedInventoryAgent(arg0: string, arg1: number) — tuple positional names@agentDefinition(mount=...) and @endpoint(...) in golem/test-agents/src/@agentImplementation()golem/test-agents/golem.yaml under httpApi.deployments.local[0].agentsGolemExamplesIntegrationSpec.scala:
test("http-my-test") {
for {
_ <- ZIO.service[GolemServer]
(status, body) <- httpGet("/api/my-agent/my-key/endpoint")
} yield assertTrue(status == 200) && assertTrue(body.contains("expected"))
}
golem/test-agents/samples/my-test/repl-my-test.tssamples list in GolemExamplesIntegrationSpec.scalamanifest covers all sample scripts) will fail if scripts exist without being registered