The reprovision retired gitea.westgate.pw in favour of git.westgate.pw, but internal/topdata still defaulted to the old host and made a live API call during the native buildability check, so once CI checkout was fixed the parts tests failed (DNS, then HTTP 404). - defaultGiteaBaseURL -> https://git.westgate.pw; normalize git-ssh. -> git. - Add stubEmptyPartsManifest (stub_test.go) and call it from the 2 non-optional parts tests so they exercise the build offline. Per-test (t.Setenv) on purpose: a global TestMain SOW_ASSETS_SERVER_URL would override the git-remote-derived server other tests configure. VFX tests already pass (optional consumer ignores HTTP 404). make check + make smoke green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36 lines
1.5 KiB
Go
36 lines
1.5 KiB
Go
package topdata
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
// stubEmptyPartsManifest points the released-parts-manifest fetch at a local
|
|
// httptest server that serves an empty (but structurally valid) manifest, so a
|
|
// build/compare test exercises native build behaviour without reaching the live
|
|
// Gitea host. Use it in tests that build the non-optional `parts` consumer but
|
|
// do not depend on any released part rows.
|
|
//
|
|
// It is per-test (t.Setenv) on purpose: a package-global SOW_ASSETS_SERVER_URL
|
|
// would override the git-remote-derived server that other tests configure.
|
|
func stubEmptyPartsManifest(t *testing.T) {
|
|
t.Helper()
|
|
var srv *httptest.Server
|
|
srv = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
switch r.URL.Path {
|
|
case "/api/v1/repos/ShadowsOverWestgate/sow-assets/releases/tags/parts-manifest-current":
|
|
w.Header().Set("Content-Type", "application/json")
|
|
_, _ = w.Write([]byte(`{"assets":[{"name":"sow-parts-manifest.json","browser_download_url":"` + srv.URL + `/dl/sow-parts-manifest.json"}]}`))
|
|
case "/dl/sow-parts-manifest.json":
|
|
w.Header().Set("Content-Type", "application/json")
|
|
_, _ = w.Write([]byte(`{"repo":"ShadowsOverWestgate/sow-assets","ref":"main","categories":{"belt":[],"bicep":[],"chest":[],"foot":[],"forearm":[],"leg":[],"neck":[],"pelvis":[],"robe":[],"shin":[],"shoulder":[]}}`))
|
|
default:
|
|
http.NotFound(w, r)
|
|
}
|
|
}))
|
|
t.Cleanup(srv.Close)
|
|
t.Setenv("SOW_ASSETS_SERVER_URL", srv.URL)
|
|
t.Setenv("SOW_ASSETS_REPO", "ShadowsOverWestgate/sow-assets")
|
|
}
|