#dagger + ijhttp

1 messages · Page 1 of 1 (latest)

dense bloom
#

Working on a new workflow for running ijhttp for integration tests and pretty happy with it so far

test.go

func (i *Integration) Test(server, test *dagger.Directory) (string, error) {
serverService := dag.Container().
From("golang:latest").
WithDirectory("/src", server).
WithExposedPort(1323).
WithWorkdir("/src/server").
WithExec([]string{"go", "run", "main.go"}).
AsService()

return dag.Container().
    From("alpine:latest").
    WithDirectory("/workdir", test).
    WithExec([]string{"apk", "add", "openjdk17-jdk", "curl", "unzip"}).
    WithExec([]string{"/bin/sh", "-c", "mkdir /ijhttp"}).
    WithExec([]string{"curl", "-f", "-L", "-o", "/ijhttp/ijhttp.zip", "https://jb.gg/ijhttp/latest"}).
    WithExec([]string{"unzip", "/ijhttp/ijhttp.zip"}).
    WithExec([]string{"/bin/sh", "-c", "chmod +x /ijhttp/ijhttp"}).
    WithServiceBinding("server", serverService).
    WithExec([]string{"sh", "/ijhttp/ijhttp", "/workdir/test.http"}).
    Stdout(context.Background())

}

test.http

GET http://server:1323/

{%
client.test("Test status code", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}

JetBrains

JetBrains is a cutting-edge software vendor specializing in the creation of intelligent development tools, including IntelliJ IDEA – the leading Java IDE, and the Kotlin programming language.

jade olive
#

This is great! Should we get you back on the community call @dense bloom ? 😉