diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 1656fd1..6c09013 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -28,5 +28,5 @@ jobs: compiler: ldc-latest - name: http1-test - working-directory: integration-tests + working-directory: integration-tests/http1-basic run: dub run --single http1-test.d diff --git a/integration-tests/.gitignore b/integration-tests/http1-basic/.gitignore similarity index 100% rename from integration-tests/.gitignore rename to integration-tests/http1-basic/.gitignore diff --git a/integration-tests/http1-test.d b/integration-tests/http1-basic/http1-test.d similarity index 76% rename from integration-tests/http1-test.d rename to integration-tests/http1-basic/http1-test.d index 4804dbd..7ef69a8 100755 --- a/integration-tests/http1-test.d +++ b/integration-tests/http1-basic/http1-test.d @@ -1,5 +1,5 @@ /+ dub.sdl: - dependency "handy-http-transport" path="../" + dependency "handy-http-transport" path="../../" dependency "requests" version="~>2.1" +/ @@ -24,11 +24,7 @@ int main() { .build(); configureLoggingProvider(loggingProvider); - HttpTransport transport = new Http1Transport(HttpRequestHandler.of((ref ServerHttpRequest request, ref ServerHttpResponse response) { - response.headers.add("Content-Type", "text/plain"); - response.headers.add("Content-Length", "13"); - response.outputStream.writeToStream(cast(ubyte[]) "Hello, world!"); - })); + HttpTransport transport = new Http1Transport(HttpRequestHandler.of(&handleRequest)); Thread thread = transport.startInNewThread(); scope(exit) { transport.stop(); @@ -38,6 +34,7 @@ int main() { Thread.sleep(msecs(100)); // Wait for the server to start. // Send a simple GET request to the server. + info("Sending GET request to http://localhost:8080"); auto content = getContent("http://localhost:8080"); ubyte[] data = content.data; if (data.length != 13 || (cast(string) data) != "Hello, world!") { @@ -48,3 +45,9 @@ int main() { info("Test completed successfully."); return 0; } + +void handleRequest(ref ServerHttpRequest request, ref ServerHttpResponse response) { + response.headers.add("Content-Type", "text/plain"); + response.headers.add("Content-Length", "13"); + response.outputStream.writeToStream(cast(ubyte[]) "Hello, world!"); +} diff --git a/integration-tests/http1-speed-test/http1-speed-test.d b/integration-tests/http1-speed-test/http1-speed-test.d new file mode 100644 index 0000000..5568b61 --- /dev/null +++ b/integration-tests/http1-speed-test/http1-speed-test.d @@ -0,0 +1,6 @@ +module integration_tests.http1_speed_test; + + +void main() { + +} diff --git a/integration-tests/run_all.sh b/integration-tests/run_all.sh new file mode 100755 index 0000000..6934c10 --- /dev/null +++ b/integration-tests/run_all.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# This script runs all integration tests. + +set -e -o pipefail + +cd http1-basic +dub build --single http1-test.d +./http1-test + +cd ..