feat(files): MinIO fallback for stale S3 downloads (#152)
Release Please / Release Please (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go stable) (pull_request) Successful in 1m15s
Tests / Test (Go 1.25) (pull_request) Successful in 1m22s
Release Please / Release Please (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go stable) (pull_request) Successful in 1m15s
Tests / Test (Go 1.25) (pull_request) Successful in 1m22s
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
//go:build integration
|
||||
|
||||
package onlyoffice
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TestIntegrationMinioFallback downloads known stale-S3 files through the local
|
||||
// MinIO fallback. Requires ONLYOFFICE_URL/USER/PASS (as all integration tests),
|
||||
// MINIO_ACCESS_KEY/MINIO_SECRET_KEY and MINIO_TEST_FILE_IDS="3785,3859,3666";
|
||||
// skips when any of those are missing.
|
||||
func TestIntegrationMinioFallback(t *testing.T) {
|
||||
if os.Getenv("MINIO_ACCESS_KEY") == "" || os.Getenv("MINIO_SECRET_KEY") == "" {
|
||||
t.Skip("MINIO_ACCESS_KEY/MINIO_SECRET_KEY not set — skipping integration test")
|
||||
}
|
||||
raw := strings.TrimSpace(os.Getenv("MINIO_TEST_FILE_IDS"))
|
||||
if raw == "" {
|
||||
t.Skip("MINIO_TEST_FILE_IDS not set — skipping integration test")
|
||||
}
|
||||
c := liveClient(t)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
||||
defer cancel()
|
||||
for _, id := range strings.Split(raw, ",") {
|
||||
id = strings.TrimSpace(id)
|
||||
if id == "" {
|
||||
continue
|
||||
}
|
||||
n, err := c.DownloadFile(ctx, id, io.Discard)
|
||||
if err != nil {
|
||||
t.Errorf("DownloadFile(%s): %v", id, err)
|
||||
continue
|
||||
}
|
||||
if n == 0 {
|
||||
t.Errorf("DownloadFile(%s): 0 bytes", id)
|
||||
} else {
|
||||
t.Logf("DownloadFile(%s): %d bytes", id, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user