ci / vet-and-test (pull_request) Successful in 46s
Why: an unset S3 client passed through the Store interface is not a nil interface, so uploads panic instead of using the local artifact directory. Evidence: TestIsNil and TestFinishOpenTypedNilS3UsesLocalArtifacts failed before this change and pass after it. The PostgreSQL case skips unless AGENT_PG_TEST_DSN is set. Impact: only an unset blob store falls back; a constructed S3 or local store is unchanged. Refs: internal/blobstore/blobstore.go internal/store/store.go Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
609 B
Go
30 lines
609 B
Go
package blobstore
|
|
|
|
import "testing"
|
|
|
|
func TestIsNil(t *testing.T) {
|
|
var unset Store
|
|
if !IsNil(unset) {
|
|
t.Fatal("nil interface must count as unset")
|
|
}
|
|
var typed *S3
|
|
var asStore Store = typed
|
|
if !IsNil(asStore) {
|
|
t.Fatal("typed nil *S3 must count as unset")
|
|
}
|
|
local, err := NewLocal(t.TempDir())
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if IsNil(local) {
|
|
t.Fatal("local store must count as configured")
|
|
}
|
|
s3, err := NewS3("http://127.0.0.1:9/bucket", "us-east-1", "access", "secret", "art/")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if IsNil(s3) {
|
|
t.Fatal("configured S3 must count as configured")
|
|
}
|
|
}
|