feat: upgrade to Go 1.26, add Docker targets, and improve build/test scripts - #147
feat: upgrade to Go 1.26, add Docker targets, and improve build/test scripts#147leinad-sch wants to merge 2 commits into
Conversation
| func testVerifyArgsAndEnv(test *testing.T, procPort string, mustHaveEnv bool) { | ||
| client := &http.Client{} | ||
| req, err := http.NewRequest("GET", fmt.Sprintf("http://localhost:%s/procinfo", procPort), nil) | ||
| req, err := http.NewRequest("GET", fmt.Sprintf("http://127.0.0.1:%s/procinfo", procPort), nil) |
There was a problem hiding this comment.
Can you please explain, why does this specific check need 127.0.0.1?
There was a problem hiding this comment.
I had issues with localhost, and in sone systems localhost might be missing (as it is just an entry in /etc/hosts).
I think without this the tests will faill.
There was a problem hiding this comment.
I guess I'm not ready to update this to 127.0.0.1 in just a single spot unless we know which "some" systems are and if we want to support them
| Command: "./test-server/test-server", | ||
| Args: "-p 12001 -healthcheck-port 2011 -sleep-before-listening 10s -sleep-before-listening-for-healthcheck 3s -startup-duration 5s", | ||
| HealthcheckCommand: "curl --fail http://localhost:2011", | ||
| HealthcheckCommand: "if command -v wget >/dev/null 2>&1; then wget -q -S --spider -T 2 \"http://localhost:2011/\"; else curl --fail -s \"http://localhost:2011/\"; fi", |
There was a problem hiding this comment.
I'm not sure why switching to wget makes sense here?
There was a problem hiding this comment.
The image golang:1.26-alpine doe not have curl, only wget.
My machine does not have wget (and I do not want wget), only curl.
This command covers both.
I could change the order, to try curl first and fall back to wget, if you want, from my view there is no difference.
| go build -o large-model-proxy | ||
|
|
||
| executable-docker: | ||
| docker run -e GOOS=linux --rm -v "./.mod:/go/pkg/mod" -v .:/app -w /app golang:1.26-alpine go build -o large-model-proxy |
There was a problem hiding this comment.
I'm not sure what's GOOs=linux doing here?
There was a problem hiding this comment.
Probably redundant, but it should not hurt.
If there are other OS builds, imo it would make it a little bit more readable.
There was a problem hiding this comment.
I don't want to maintain redundant. Let's remove everything redundant
|
Thank you for the contribution! |
Replace hardcoded curl healthcheck commands with a shell snippet that attempts to use wget first, falling back to curl if wget is unavailable. This improves robustness across different test environments.
542135e to
895be1d
Compare
| ProxyTargetPort: "12001", | ||
| Command: "./test-server/test-server", | ||
| Args: "-p 12001 -healthcheck-port 2011 -sleep-before-listening 10s -sleep-before-listening-for-healthcheck 3s -startup-duration 5s", | ||
| HealthcheckCommand: "curl --fail http://localhost:2011", |
There was a problem hiding this comment.
Let's add a Dockerfile over supporting wget here
There was a problem hiding this comment.
A Dockerfile would not solve the issue for systems without curl, and add a lot of extra time, complexity and maintenance overhead to the tests.
With this fix you could clone the repo and run make test or make test-docker, and you do not need anything else just Golang or Docker and curl or wget.
There was a problem hiding this comment.
@leinad-sch I don't want to support systems without curl. There is a maintenance cost to decisions like this one and making everyone install curl is an easier path.
We can have a script that builds docker container from Dockerfile, the same way it works with debian-package target, and then it will still be a single command.
895be1d to
8384e10
Compare
Update Go version to 1.26 in go.mod and CI workflows. Add Docker-based make targets for building and testing. Update GitHub Actions workflow to use Go 1.26. Ensure compatibility with Alpine-based Docker images.
8384e10 to
ba78ac8
Compare
|
@leinad-sch If you still like to move this forward, let's switch to a Dockerfile. It can still stay a single |
This PR introduces Docker-based build targets, upgrades the project to Go 1.26, and refactors shell scripts to ensure POSIX compliance and testing robustness.
Key Changes
Build & CI
go.modand CI workflows to use Go 1.26.executable-linuxtarget and updated.gitignoreto exclude generated binaries.Shell Script Refactoring
build.shandoutput-test.shto use/usr/bin/env sh.[[,echo -e) with POSIX equivalents ([,printf) and added proper variable quoting to prevent globbing errors.Testing Improvements
testLogOutputto accept atestNameparameter for generating dynamic log file paths.localhostwith127.0.0.1inprocinforequests to ensure reliable connectivity.wgetifcurlis unavailable.