Fix: broken ci and tests
All checks were successful
Go test / run-go-vet (push) Successful in 5s
Go test / run-go-test (push) Successful in 22s
Go test / cleanup-go-test (push) Successful in 4s
Go test / check-swagger-up-to-date (push) Successful in 9s
Go test / release-image (push) Successful in 3m22s

This commit is contained in:
2025-12-13 02:17:46 +08:00
parent e6c46f29f5
commit 0fc8f1f08c
6 changed files with 36 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ func Test_01_Login(t *testing.T) {
t.Run("check preshared key failed", func(t *testing.T) {
resp, err := client.R().
SetBody(`{"userId": "testuser1"}`).
Post("http://localhost:8080/auth/gen-login-url")
Post("/auth/gen-login-url")
if err != nil {
t.Fatal("request failed")
}
@@ -32,7 +32,7 @@ func Test_01_Login(t *testing.T) {
SetBody(`{"userId": "testuser1"}`).
SetAuthToken("poop").
SetResult(&payload).
Post("http://localhost:8080/auth/gen-login-url")
Post("/auth/gen-login-url")
if err != nil || resp.StatusCode() != http.StatusOK {
t.Fatal("failed to get login url")

View File

@@ -28,7 +28,7 @@ func Test_02_PostImage(t *testing.T) {
resp, err := client.R().
SetBody(rawImage).
SetResult(&image).
Post("http://localhost:8080/api/image")
Post("/api/image")
if err != nil || resp.StatusCode() != http.StatusOK {
t.Logf("%+v", resp)

View File

@@ -3,6 +3,7 @@ package tests
import (
"fmt"
"net/http"
"strconv"
"testing"
)
@@ -17,8 +18,7 @@ func Test_03_PutImageAliases(t *testing.T) {
}
resp, err := client.R().
SetBody(payload).
Put(fmt.Sprintf("http://localhost:8080/api/image/%d/aliases",
image.Id))
Put(fmt.Sprintf("/api/image/%d/aliases", image.Id))
if err != nil || resp.StatusCode() != http.StatusOK {
t.Logf("%+v", resp)
t.Fatal("failed to put image alias")
@@ -61,6 +61,11 @@ func Test_03_PutImageAliases(t *testing.T) {
for _, alias := range aliases {
if alias.Name == "testalias2" {
t.Logf("%+v", resp)
resp, _ = client.R().
SetQueryParam("aliases",
strconv.FormatInt(alias.Id, 10)).
Get("/api/images")
t.Logf("%+v", resp)
t.Fatal("alias should be deleted")
}
}