rentease/internal/driver/storage/minio_test.go
Ruidy 0f327c814a
Some checks failed
CI / checks (push) Has been cancelled
fix: normalize minio endpoints
2026-03-21 10:19:33 +01:00

31 lines
813 B
Go

package storage
import "testing"
func TestNormalizeEndpoint_WithSchemeOverridesSecureFlag(t *testing.T) {
endpoint, secure, err := normalizeEndpoint("https://s3api.nemausat.com", false)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if endpoint != "s3api.nemausat.com" {
t.Fatalf("expected normalized host, got %q", endpoint)
}
if !secure {
t.Fatal("expected https endpoint to force secure=true")
}
}
func TestNormalizeEndpoint_WithoutSchemePreservesSecureFlag(t *testing.T) {
endpoint, secure, err := normalizeEndpoint("s3api.nemausat.com", true)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if endpoint != "s3api.nemausat.com" {
t.Fatalf("expected endpoint to be preserved, got %q", endpoint)
}
if !secure {
t.Fatal("expected secure flag to be preserved")
}
}