terraform/provider: make the unknown endpoint test check the unknown-setting error

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-05 15:03:54 -08:00
1 parent ae14b2b27e
commit 19af53a363
1 file changed
+4 -2
@@ -63,6 +63,8 @@ func TestBoolConfigValue(t *testing.T) {
func TestConfigureRejectsUnknownEndpoint(t *testing.T) {
t.Setenv("SEAWEEDFS_ENDPOINT", "http://127.0.0.1:8333")
t.Setenv("SEAWEEDFS_ACCESS_KEY", "test-key")
t.Setenv("SEAWEEDFS_SECRET_KEY", "test-secret")
ctx := context.Background()
p := &seaweedfsProvider{}
var schemaResp provider.SchemaResponse
@@ -79,8 +81,8 @@ func TestConfigureRejectsUnknownEndpoint(t *testing.T) {
Schema: schemaResp.Schema,
Raw: tftypes.NewValue(objectType, values),
}}, &resp)
if !resp.Diagnostics.HasError() {
t.Fatal("expected an unknown endpoint to be rejected")
if !resp.Diagnostics.HasError() || resp.Diagnostics.Errors()[0].Summary() != "Unknown SeaweedFS provider setting" {
t.Fatalf("diagnostics = %v, want the unknown endpoint rejected", resp.Diagnostics)
}
if resp.ResourceData != nil {
t.Fatal("expected no client when the endpoint is unknown")