test: circuit breaker states, bearer cache-hit, blob dedup, terraform/storage branches
This commit is contained in:
@@ -12,7 +12,10 @@ import (
|
||||
"git.unkin.net/unkin/artifactapi/internal/testsupport"
|
||||
)
|
||||
|
||||
var testS3 *S3
|
||||
var (
|
||||
testS3 *S3
|
||||
testEndpoint string
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
ctx := context.Background()
|
||||
@@ -32,6 +35,7 @@ func TestMain(m *testing.M) {
|
||||
panic(err)
|
||||
}
|
||||
testS3 = s3
|
||||
testEndpoint = conn.Endpoint
|
||||
code := m.Run()
|
||||
terminate()
|
||||
if code != 0 {
|
||||
@@ -95,6 +99,15 @@ func TestS3RoundTrip(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewS3ExistingBucket(t *testing.T) {
|
||||
requireS3(t)
|
||||
// The bucket already exists from TestMain, so ensureBucket takes the
|
||||
// "already present" path.
|
||||
if _, err := NewS3(testEndpoint, "minioadmin", "minioadmin", "test-bucket", false, ""); err != nil {
|
||||
t.Fatalf("second NewS3: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestS3DownloadMissing(t *testing.T) {
|
||||
requireS3(t)
|
||||
if _, _, err := testS3.Download(context.Background(), "does/not/exist"); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user