You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -301,7 +301,7 @@ func resourceGithubExampleDelete(ctx context.Context, d *schema.ResourceData, me
301
301
```go
302
302
funcresourceExampleRead(ctxcontext.Context, d *schema.ResourceData, many) diag.Diagnostics {
303
303
meta:= m.(*Owner)
304
-
// REST API client (go-github v82)
304
+
// REST API client (go-github)
305
305
client:= meta.v3client
306
306
307
307
// GraphQL client (for queries not available in REST)
@@ -326,7 +326,7 @@ if err != nil {
326
326
varghErr *github.ErrorResponse
327
327
if errors.As(err, &ghErr) {
328
328
if ghErr.Response.StatusCode == http.StatusNotFound {
329
-
log.Printf("[INFO] Removing %s from state because it no longer exists", name)
329
+
tflog.Info(ctx, "Removing resource from state because it no longer exists", map[string]any{"name": name})
330
330
d.SetId("")
331
331
returnnil
332
332
}
@@ -446,10 +446,21 @@ func resourceExampleCreate(ctx context.Context, d *schema.ResourceData, meta any
446
446
447
447
### Test Structure
448
448
449
+
Use `ConfigStateChecks` for post-apply state assertions and `ConfigPlanChecks` for plan-level assertions (e.g., verifying `ForceNew` triggers). These replace the legacy `Check:` + `resource.ComposeTestCheckFunc` pattern.
> **Legacy pattern:** Existing tests may still use `Check: resource.ComposeTestCheckFunc(...)`. New tests should use `ConfigStateChecks` and `ConfigPlanChecks` instead. See `data_source_github_ip_ranges_test.go` for a real-world example.
513
+
477
514
### Test Modes
478
515
479
516
Use `skipUnauthenticated(t)`, `skipUnlessHasOrgs(t)`, `skipUnlessHasPaidOrgs(t)`, `skipUnlessEnterprise(t)`, `skipUnlessMode(t, testModes...)` functions to run tests in appropriate contexts:
@@ -537,10 +574,8 @@ The following resources are deprecated and will be removed in future versions:
537
574
538
575
### Pending go-github Updates
539
576
540
-
Several features are blocked waiting for go-github v68+:
577
+
The following features are blocked waiting for upstream changes in [google/go-github#3364](https://github.com/google/go-github/issues/3364) (adds `assignment`, `parent_team_id`, `parent_team_slug` fields):
**Decision:** Migrate from the SDK testing package (`github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource`) to `terraform-plugin-testing` (`github.com/hashicorp/terraform-plugin-testing`). Use `ConfigStateChecks` and `ConfigPlanChecks` as the preferred assertion patterns, replacing `Check:` + `resource.ComposeTestCheckFunc`.
659
+
660
+
**Rationale:**`terraform-plugin-testing` is the standalone testing framework that decouples test utilities from the SDK. `ConfigStateChecks` and `ConfigPlanChecks` provide type-safe, composable assertions with better error messages.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,8 +53,8 @@ Once you have the repository cloned, there's a couple of additional steps you'll
53
53
54
54
### Local Development Iteration
55
55
56
-
1. Write a test describing what you will fix. See [`github_label`](./github/resource_github_issue_label_test.go) for an example format.
57
-
2. Run your test and observe it fail. Enabling debug output allows for observing the underlying requests and responses made as well as viewing state (search `STATE:`) generated during the acceptance test run.
56
+
1. Write a test describing what you will fix. See [`github_ip_ranges`](./github/data_source_github_ip_ranges_test.go) for an example using the preferred `ConfigStateChecks` pattern, and [ARCHITECTURE.md](ARCHITECTURE.md#test-structure) for full guidance.
57
+
2. Run your test and observe it fail. Enabling debug output allows for observing the underlying requests and responses made during the acceptance test run.
58
58
59
59
```sh
60
60
TF_LOG=DEBUG make testacc T=TestAccGithubIssueLabel
0 commit comments