fix: enable weekly storage cleanup
Desktop Client Build / Resolve Build Metadata (push) Successful in 32s
Frontend CI / Frontend (push) Successful in 2m6s
Backend CI / Backend (push) Successful in 16m11s
Desktop Client Build / Build Desktop Client (push) Successful in 23m50s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 37s

This commit is contained in:
2026-06-19 21:11:14 +08:00
parent a48f450de6
commit f26802c76e
8 changed files with 125 additions and 17 deletions
@@ -1,7 +1,11 @@
package objectstorage
import (
"context"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/geo-platform/tenant-api/internal/shared/config"
)
@@ -34,6 +38,61 @@ func TestAliyunPutObjectOptionsRejectsUnsupportedObjectACL(t *testing.T) {
}
}
func TestAliyunExistsHonorsContextCancellation(t *testing.T) {
t.Parallel()
requestStarted := make(chan struct{})
blockRequest := make(chan struct{})
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
select {
case <-requestStarted:
default:
close(requestStarted)
}
<-blockRequest
w.WriteHeader(http.StatusOK)
}))
defer func() {
close(blockRequest)
server.Close()
}()
client := NewAliyunClient(config.ObjectStorageConfig{
Provider: "aliyun",
Endpoint: server.URL,
AccessKey: "test-access-key",
SecretKey: "test-secret-key",
Bucket: "test-bucket",
Region: "cn-test",
}, nil)
ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond)
defer cancel()
started := make(chan struct{})
done := make(chan error, 1)
go func() {
close(started)
_, err := client.Exists(ctx, "desktop-client/releases/test.dmg")
done <- err
}()
<-started
select {
case <-requestStarted:
case <-time.After(time.Second):
t.Fatal("expected aliyun request to reach the test server")
}
select {
case err := <-done:
if err == nil {
t.Fatal("expected context cancellation error")
}
case <-time.After(2 * time.Second):
t.Fatal("aliyun Exists did not honor context cancellation")
}
}
func TestIsPublicReadACL(t *testing.T) {
t.Parallel()