Skip to content

Conversation

@soheiokamoto
Copy link
Contributor

  • I understand that this repository is auto-generated and my pull request may not be merged

This updates logpull_retention test:

  1. Add import test.
  2. Switch to Plan and State Checks from legacy Checks.

Test passes locally:

go test ./internal/services/logpull_retention -run "^TestAccLogpullRetention" -v -count 1

=== RUN   TestAccLogpullRetention_Basic
--- PASS: TestAccLogpullRetention_Basic (10.48s)
PASS
ok      github.com/cloudflare/terraform-provider-cloudflare/internal/services/logpull_retention 10.487s

Config: testLogpullRetentionSetConfig(rnd, zoneID, true),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
//plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out plancheck.ExpectResourceAction() for both steps, as I get error like below inconsistently:

go test ./internal/services/logpull_retention -run "^TestAccLogpullRetention" -v -count 1
=== RUN   TestAccLogpullRetention_Basic
    resource_test.go:28: Step 2/3 error: Pre-apply plan check(s) failed:
        'cloudflare_logpull_retention.mgvohhbmfy' - expected Create, got action(s): [delete create]
--- FAIL: TestAccLogpullRetention_Basic (7.11s)
FAIL
FAIL    github.com/cloudflare/terraform-provider-cloudflare/internal/services/logpull_retention 7.114s
FAIL

logpull_retention is based on a single flag / state per zone (and not multiple resources), so the state / action may be different based on initial state (before running the test).

This updates `logpull_retention` test:
 1. Add import test.
 2. Switch to Plan and State Checks from legacy Checks.

Test passes locally:
```
go test ./internal/services/logpull_retention -run "^TestAccLogpullRetention" -v -count 1

=== RUN   TestAccLogpullRetention_Basic
--- PASS: TestAccLogpullRetention_Basic (10.48s)
PASS
ok      github.com/cloudflare/terraform-provider-cloudflare/internal/services/logpull_retention 10.487s
```
@soheiokamoto soheiokamoto force-pushed the sohei/DS-15400-update-logpull-retention-test branch from fa5d0ea to efaf862 Compare November 4, 2025 18:28
@soheiokamoto
Copy link
Contributor Author

Rebased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant