//go:build !dev package s3 import ( "context" "strings" "testing" ) // TestProdClientIsStub verifies the production (!dev) build's S3 client is // flagged as the stub: main.go uses ClientIsStub to warn at startup that // object-store operations (including profile-picture deletion) cannot perform // real work in this build. func TestProdClientIsStub(t *testing.T) { if !ClientIsStub { t.Error("expected ClientIsStub to be true in the !dev build (the client is the 'not implemented' stub)") } } // TestProdStubDeleteNotImplemented verifies the prod stub's Delete always fails // with a "not implemented" error — the retry-s3-deletions job cannot drain any // outbox row in this build, so the attempt cap + critical notification is the // only signal the operator gets. func TestProdStubDeleteNotImplemented(t *testing.T) { c := &S3Client{bucket: "b", endpoint: "http://localhost:9000"} err := c.Delete(context.Background(), "test-bucket", "profiles/x.jpg") if err == nil { t.Fatal("expected the prod stub Delete to return an error") } if !strings.Contains(err.Error(), "not implemented") { t.Errorf("expected the prod stub Delete error to say 'not implemented', got: %v", err) } }