-
Notifications
You must be signed in to change notification settings - Fork 765
fix: set computed_optional on various fields since these fields are a… #6279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
fix: set computed_optional on various fields since these fields are a… #6279
Conversation
49bbfc7 to
618db3c
Compare
44843f0 to
057b6a7
Compare
* chore: point to next
Co-authored-by: yihuaf <[email protected]>
* ci: build migrator v2 in ci * chore: uptake migrator v2 for dns_record
This change adds the token validation and schema validation acceptance tests to CI runner. Acceptance test zone `terraform.cfapi.net` seems to already be entitled to utilize both services. It also ensures that the schema validation tests can be executed in parallel without interferring with each other: ``` $ TF_ACC=1 go test ./internal/services/token_validation_* ./internal/services/schema_validation_* -run "^TestAccCloudflareTokenValidationConfig|TestAccCloudflareTokenValidationRules|TestAccCloudflarePerOperationSetting|TestAccCloudflareSchemaValidationSchemas|TestAccCloudflareSchemaValidationZoneSettings" -v -count 1 === RUN TestAccCloudflareTokenValidationConfig --- PASS: TestAccCloudflareTokenValidationConfig (36.15s) PASS ok github.com/cloudflare/terraform-provider-cloudflare/internal/services/token_validation_config 37.827s === RUN TestAccCloudflareTokenValidationRules --- PASS: TestAccCloudflareTokenValidationRules (26.03s) PASS ok github.com/cloudflare/terraform-provider-cloudflare/internal/services/token_validation_rules 28.480s === RUN TestAccCloudflarePerOperationSetting --- PASS: TestAccCloudflarePerOperationSetting (15.87s) PASS ok github.com/cloudflare/terraform-provider-cloudflare/internal/services/schema_validation_operation_settings 21.278s === RUN TestAccCloudflareSchemaValidationSchemas --- PASS: TestAccCloudflareSchemaValidationSchemas (13.31s) PASS ok github.com/cloudflare/terraform-provider-cloudflare/internal/services/schema_validation_schemas 16.719s === RUN TestAccCloudflareSchemaValidationZoneSettings --- PASS: TestAccCloudflareSchemaValidationZoneSettings (18.18s) PASS ok github.com/cloudflare/terraform-provider-cloudflare/internal/services/schema_validation_settings 22.567s ```
* Add mcp portals acceptance tests * Fix mcp portals acceptance tests * Fix mcp portals acceptance tests
Co-authored-by: cortlyons <[email protected]>
…lways returned to prevent update in place
f50cab7 to
4f5714b
Compare
|
@smakys I've reset your branch so your commit is back on top of mgirouard@sixteen:~/src/terraform-provider-cloudflare$ TF_ACC=1 go test -v ./internal/services/zone_subscription/...
go: downloading github.com/cloudflare/cloudflare-go/v6 v6.2.1-0.20251105113648-556f4c6627fe
=== RUN TestZoneSubscriptionDataSourceModelSchemaParity
=== PAUSE TestZoneSubscriptionDataSourceModelSchemaParity
=== RUN TestAccCloudflareZoneSubscriptionDataSource_Basic
data_source_test.go:17: error checking value for attribute at path: data.cloudflare_zone_subscription.hyhknhabqt.rate_plan.id, err: expected value cf_ent for StringExact check, got: enterprise
--- SKIP: TestAccCloudflareZoneSubscriptionDataSource_Basic (0.00s)
=== RUN TestZoneSubscriptionModelSchemaParity
=== PAUSE TestZoneSubscriptionModelSchemaParity
=== RUN TestAccCloudflareZoneSubscription_ImportNoChanges
--- PASS: TestAccCloudflareZoneSubscription_ImportNoChanges (7.58s)
=== RUN TestAccCloudflareZoneSubscription_Basic
--- PASS: TestAccCloudflareZoneSubscription_Basic (9.79s)
=== RUN TestAccCloudflareZoneSubscription_WithPlanChange
--- PASS: TestAccCloudflareZoneSubscription_WithPlanChange (22.74s)
=== RUN TestAccCloudflareZoneSubscription_WithPlanAndComputedOptionalRatePlanFields
--- PASS: TestAccCloudflareZoneSubscription_WithPlanAndComputedOptionalRatePlanFields (12.91s)
=== RUN TestAccCloudflareZoneSubscription_WithPlanThatReturnsNotApplicableFrequencyResultingInError
resource_test.go:194: Step 3/3 error running import: ImportStateVerify attributes not equivalent. Difference is shown below. The - symbol indicates attributes missing after import.
map[string]string{
- "rate_plan.public_name": "API Shield Website",
+ "rate_plan.public_name": "Enterprise",
}
--- FAIL: TestAccCloudflareZoneSubscription_WithPlanThatReturnsNotApplicableFrequencyResultingInError (12.77s)
=== CONT TestZoneSubscriptionDataSourceModelSchemaParity
=== CONT TestZoneSubscriptionModelSchemaParity
--- PASS: TestZoneSubscriptionDataSourceModelSchemaParity (0.00s)
=== NAME TestZoneSubscriptionModelSchemaParity
integrity.go:126: mismatch at "[email protected]": expected "computed_optional", received "frequency, computed_optional"
integrity.go:129: If you are implementing a custom solution, you can suppress these warning(s) by adding the following to the test, as an example:
+ errs.Ignore("[email protected]")
--- FAIL: TestZoneSubscriptionModelSchemaParity (0.00s)
FAIL
FAIL github.com/cloudflare/terraform-provider-cloudflare/internal/services/zone_subscription 65.800s
FAIL |
|
@smakys I looked more into the failure in Create Request: {
"frequency": "monthly",
"rate_plan": {
"id": "enterprise"
}
}Create Response: {
"errors": [],
"messages": [],
"result": {
"account_id": "12946570",
"cancel_at_period_end": false,
"client_secrets": null,
"component_values": [],
"created_date": "2024-08-15T09:00:55Z",
"currency": "USD",
"frequency": "not-applicable",
"handler": "stripe",
"id": "afcacda4178f4fc09ae93be3ffed0500",
"intent": "EMPLOYEE",
"price": 0,
"product": {
"billing": "",
"duration": 0,
"name": "api_shield",
"period": "",
"public_name": "API Shield Website"
},
"rate_plan": {
"currency": "USD",
"externally_managed": false,
"id": "api_shield_zone",
"is_contract": true,
"public_name": "API Shield Website",
"scope": "zone",
"sets": null
},
"state": "Paid",
"trial": null,
"zone": {
"id": "0da42c8d2132a9ddaf714f9e7c920711",
"internal_id": 140770369,
"name": "terraform.cfapi.net"
}
},
"success": true
}Read Response: {
"errors": [],
"messages": [],
"result": {
"cancel_at_period_end": false,
"client_secrets": null,
"component_values": [
{
"default": 1,
"name": "spectrum_bytes_transferred",
"value": 1
},
{
"name": "page_rules",
"value": 125
}
],
"created_date": "2024-08-15T09:00:55Z",
"currency": "USD",
"frequency": "not-applicable",
"handler": "stripe",
"id": "ae519a85da7140dfb99192abd9722e84",
"intent": "EMPLOYEE",
"price": 0,
"product": {
"billing": "",
"duration": 0,
"name": "prod_cloudflare",
"period": "",
"public_name": "CloudFlare Services"
},
"rate_plan": {
"currency": "USD",
"externally_managed": false,
"id": "enterprise",
"is_contract": true,
"public_name": "Enterprise",
"scope": "zone",
"sets": null
},
"state": "Paid",
"trial": null,
"zone": {
"id": "0da42c8d2132a9ddaf714f9e7c920711",
"name": "terraform.cfapi.net"
}
},
"success": true
} |
Fixes model/schema parity with `zone_subscription.frequency`. Struct tags can't have spaces between tokens.
8419486 to
d301974
Compare
4c8915d to
9cc9eee
Compare
After cloudflare_zone_subscription import. The terraform plan will still an "update in-place" status with changes to frequency and rate plan. This is because frequency and rate plan will always return a key/value even if not in the request body.
Updated various fields to be computed_optional
Provide acceptance test for various states
[x ] I understand that this repository is auto-generated and my pull request may not be merged
Changes being requested
#5971
Additional context & links