Skip to content

Commit

Permalink
POSIX conformance: run an HTTP file server (#215)
Browse files Browse the repository at this point in the history
This simplifies a lot of other code that was spinning up busybox as an http server. This has failed a number of times in CI. The simpler deployment of this approach has a lot going for it. The one downside is that it shows non-canonical usage of the POSIX log. But as there's already an HTTP server running, it seems wasteful to not take advantage in this way.
  • Loading branch information
mhutchinson authored Sep 5, 2024
1 parent 8d18b88 commit 7b5263e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Start Tessera
run: docker compose -f ./cmd/conformance/posix/docker/compose.yaml up --build --detach
- name: Run benchmark
run: go run ./hammer --log_public_key=example.com/log/testdata+33d7b496+AeHTu4Q3hEIMHNqc6fASMsq3rKNx280NI+oO5xCFkkSx --log_url=http://localhost:2024 --write_log_url=http://localhost:2025 --max_read_ops=0 --num_writers=512 --max_write_ops=512 --max_runtime=1m --leaf_write_goal=2500 --show_ui=false
run: go run ./hammer --log_public_key=example.com/log/testdata+33d7b496+AeHTu4Q3hEIMHNqc6fASMsq3rKNx280NI+oO5xCFkkSx --log_url=http://localhost:2025 --max_read_ops=0 --num_writers=512 --max_write_ops=512 --max_runtime=1m --leaf_write_goal=2500 --show_ui=false
- name: Stop Tessera
if: ${{ always() }}
run: docker compose -f ./cmd/conformance/posix/docker/compose.yaml down
6 changes: 3 additions & 3 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Start Docker services (tessera-conformance-posix-read-proxy and tessera-conformance-posix)
- name: Start Docker services (tessera-conformance-posix)
run: docker compose -f ./cmd/conformance/posix/docker/compose.yaml up --build --detach
- name: Run integration test
run: go test -v -race ./integration/... --run_integration_test=true --log_url="http://localhost:2024" --write_log_url="http://localhost:2025" --log_public_key="example.com/log/testdata+33d7b496+AeHTu4Q3hEIMHNqc6fASMsq3rKNx280NI+oO5xCFkkSx"
- name: Stop Docker services (tessera-conformance-posix-read-proxy and tessera-conformance-posix)
run: go test -v -race ./integration/... --run_integration_test=true --log_url="http://localhost:2025" --write_log_url="http://localhost:2025" --log_public_key="example.com/log/testdata+33d7b496+AeHTu4Q3hEIMHNqc6fASMsq3rKNx280NI+oO5xCFkkSx"
- name: Stop Docker services (tessera-conformance-posix)
if: ${{ always() }}
run: docker compose -f ./cmd/conformance/posix/docker/compose.yaml down
6 changes: 2 additions & 4 deletions cmd/conformance/posix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ go run ./cmd/conformance/posix \
In another terminal, run the hammer against the log.
In this example, we're running 32 writers against the log to add 128 new leaves within 1 minute.

Note that the writes are sent to the HTTP server we brought up in the previous step, but reads are sent directly to the file system.

```shell
go run ./hammer \
--log_public_key=example.com/log/testdata+33d7b496+AeHTu4Q3hEIMHNqc6fASMsq3rKNx280NI+oO5xCFkkSx \
--write_log_url=http://localhost:2025 \
--log_url=file:///tmp/mylog2/ \
--max_read_ops=0 \
--num_writers=32 \
--max_write_ops=64 \
Expand All @@ -37,7 +34,8 @@ go run ./hammer \
--show_ui=false
```

Optionally, inspect the log using the woodpecker tool to see the contents:
Optionally, inspect the log on the filesystem using the woodpecker tool to see the contents.
Note that this reads only from the files on disk, so none of the commands above need to be running for this to work.

```shell
go run github.com/mhutchinson/woodpecker@main --custom_log_type=tiles --custom_log_url=file:///${LOG_DIR}/ --custom_log_origin=example.com/log/testdata --custom_log_vkey=${LOG_PUBLIC_KEY}
Expand Down
18 changes: 0 additions & 18 deletions cmd/conformance/posix/docker/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
services:

tessera-conformance-posix-read-proxy:
container_name: tessera-conformance-posix-read-proxy
image: "busybox:stable"
ports:
- "2024:2024"
command: [
"/bin/busybox",
"httpd",
"-f",
"-p",
"2024",
"-h",
"/tmp/tessera-posix-log"
]
volumes:
- tiles:/tmp/tessera-posix-log
restart: always

tessera-conformance-posix:
container_name: tessera-conformance-posix
build:
Expand Down
3 changes: 3 additions & 0 deletions cmd/conformance/posix/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func main() {
return
}
})
// Proxy all GET requests to the filesystem as a lightweight file server.
// This makes it easier to test this implementation from another machine.
http.Handle("GET /", http.FileServer(http.Dir(*storageDir)))

// Run the HTTP server with the single handler and block until this is terminated
if err := http.ListenAndServe(*listen, http.DefaultServeMux); err != nil {
Expand Down

0 comments on commit 7b5263e

Please sign in to comment.