Skip to content

Commit c28a943

Browse files
ei-gradclaude
andcommitted
test: Remove standalone SDK validation tests, covered by InternalValidate in consistency test
Co-Authored-By: Claude <[email protected]>
1 parent 97001ab commit c28a943

1 file changed

Lines changed: 0 additions & 55 deletions

File tree

github/resource_github_etag_unit_test.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package github
22

33
import (
4-
"strings"
54
"testing"
65

76
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -72,60 +71,6 @@ func TestEtagDiffSuppressFunction(t *testing.T) {
7271
}
7372
}
7473

75-
// TestEtagComputedOnlyRejectsSuppress verifies that the SDK rejects
76-
// DiffSuppressFunc on Computed-only fields, proving Optional is required.
77-
func TestEtagComputedOnlyRejectsSuppress(t *testing.T) {
78-
p := &schema.Provider{
79-
ResourcesMap: map[string]*schema.Resource{
80-
"test": {
81-
Schema: map[string]*schema.Schema{
82-
"etag": {
83-
Type: schema.TypeString,
84-
Computed: true,
85-
DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool {
86-
return true
87-
},
88-
DiffSuppressOnRefresh: true,
89-
},
90-
},
91-
},
92-
},
93-
}
94-
err := p.InternalValidate()
95-
if err == nil {
96-
t.Fatal("expected SDK to reject DiffSuppressFunc on Computed-only field")
97-
}
98-
if !strings.Contains(err.Error(), "DiffSuppressFunc") {
99-
t.Fatalf("unexpected error: %s", err)
100-
}
101-
}
102-
103-
// TestEtagOptionalComputedAcceptsSuppress verifies that the SDK accepts
104-
// DiffSuppressFunc on Optional+Computed fields.
105-
func TestEtagOptionalComputedAcceptsSuppress(t *testing.T) {
106-
p := &schema.Provider{
107-
ResourcesMap: map[string]*schema.Resource{
108-
"test": {
109-
Schema: map[string]*schema.Schema{
110-
"etag": {
111-
Type: schema.TypeString,
112-
Optional: true,
113-
Computed: true,
114-
DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool {
115-
return true
116-
},
117-
DiffSuppressOnRefresh: true,
118-
},
119-
},
120-
},
121-
},
122-
}
123-
err := p.InternalValidate()
124-
if err != nil {
125-
t.Fatalf("Optional+Computed with DiffSuppressFunc should be valid, got: %s", err)
126-
}
127-
}
128-
12974
// TestEtagSchemaConsistency ensure DiffSuppressFunc and DiffSuppressOnRefresh are consistently applied.
13075
func TestEtagSchemaConsistency(t *testing.T) {
13176
resourcesWithEtag := map[string]*schema.Resource{

0 commit comments

Comments
 (0)