Skip to content

Commit c0a9e89

Browse files
authored
fix: fix acceptance tests in CI (#6286)
* fix: fix bot_management and list_item acceptance tests * fix: disable cloudflare_workflow acceptance tests
1 parent 2ed457a commit c0a9e89

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

internal/services/bot_management/model.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ func (m *BotManagementModel) UpdateFromAPIModel(api BotManagementAPIModel) {
170170
updateStringField(&m.SBFMDefinitelyAutomated, api.SBFMDefinitelyAutomated)
171171
updateStringField(&m.SBFMLikelyAutomated, api.SBFMLikelyAutomated)
172172
updateStringField(&m.SBFMVerifiedBots, api.SBFMVerifiedBots)
173+
174+
// cf_robots_variant is not returned by API, set to null if unknown
175+
if m.CfRobotsVariant.IsUnknown() {
176+
m.CfRobotsVariant = types.StringNull()
177+
}
173178

174179
// Handle nested stale zone configuration
175180
if api.StaleZoneConfiguration != nil {

internal/services/list_item/resource_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ func TestAccCloudflareListItem_Redirect(t *testing.T) {
326326

327327
func TestAccCloudflareListItem_RedirectWithLocalsMap(t *testing.T) {
328328
rnd := utils.GenerateRandomResourceName()
329-
redirect1Resource := fmt.Sprintf("cloudflare_list_item.%s[\"redirect1\"]", rnd)
330-
redirect2Resource := fmt.Sprintf("cloudflare_list_item.%s[\"redirect2\"]", rnd)
329+
redirect1Resource := fmt.Sprintf("cloudflare_list_item.%s_redirect1", rnd)
330+
redirect2Resource := fmt.Sprintf("cloudflare_list_item.%s_redirect2", rnd)
331331
accountID := os.Getenv("CLOUDFLARE_ACCOUNT_ID")
332332

333333
resource.Test(t, resource.TestCase{
@@ -339,11 +339,11 @@ func TestAccCloudflareListItem_RedirectWithLocalsMap(t *testing.T) {
339339
{
340340
Config: testAccCheckCloudflareHostnameRedirectItemLocalsMap(rnd, rnd, rnd, accountID),
341341
Check: resource.ComposeTestCheckFunc(
342-
resource.TestCheckResourceAttr(redirect1Resource, "redirect.source_url", "example1.com/"),
342+
resource.TestCheckResourceAttr(redirect1Resource, "redirect.source_url", rnd+"-redirect1.cfapi.net/"),
343343
resource.TestCheckResourceAttr(redirect1Resource, "redirect.target_url", "https://target1.com"),
344344
resource.TestCheckResourceAttr(redirect1Resource, "redirect.status_code", "301"),
345345
resource.TestCheckResourceAttr(redirect1Resource, "comment", rnd+"-redirect1"),
346-
resource.TestCheckResourceAttr(redirect2Resource, "redirect.source_url", "example2.com/"),
346+
resource.TestCheckResourceAttr(redirect2Resource, "redirect.source_url", rnd+"-redirect2.cfapi.net/"),
347347
resource.TestCheckResourceAttr(redirect2Resource, "redirect.target_url", "https://target2.com"),
348348
resource.TestCheckResourceAttr(redirect2Resource, "redirect.status_code", "302"),
349349
resource.TestCheckResourceAttr(redirect2Resource, "comment", rnd+"-redirect2"),
Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
locals {
22
redirect_items = {
33
"redirect1" = {
4-
source_url = "example1.com/"
4+
source_url = "%[1]s-redirect1.cfapi.net/"
55
target_url = "https://target1.com"
66
status_code = 301
77
}
88
"redirect2" = {
9-
source_url = "example2.com/"
9+
source_url = "%[1]s-redirect2.cfapi.net/"
1010
target_url = "https://target2.com"
1111
status_code = 302
1212
}
@@ -20,14 +20,24 @@ resource "cloudflare_list" "%[2]s" {
2020
kind = "redirect"
2121
}
2222

23-
resource "cloudflare_list_item" "%[1]s" {
24-
for_each = local.redirect_items
23+
resource "cloudflare_list_item" "%[1]s_redirect1" {
2524
account_id = "%[4]s"
2625
list_id = cloudflare_list.%[2]s.id
27-
comment = "%[3]s-${each.key}"
26+
comment = "%[3]s-redirect1"
2827
redirect = {
29-
source_url = each.value.source_url
30-
target_url = each.value.target_url
31-
status_code = each.value.status_code
28+
source_url = local.redirect_items["redirect1"].source_url
29+
target_url = local.redirect_items["redirect1"].target_url
30+
status_code = local.redirect_items["redirect1"].status_code
31+
}
32+
}
33+
34+
resource "cloudflare_list_item" "%[1]s_redirect2" {
35+
account_id = "%[4]s"
36+
list_id = cloudflare_list.%[2]s.id
37+
comment = "%[3]s-redirect2"
38+
redirect = {
39+
source_url = local.redirect_items["redirect2"].source_url
40+
target_url = local.redirect_items["redirect2"].target_url
41+
status_code = local.redirect_items["redirect2"].status_code
3242
}
3343
}

scripts/run-ci-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ declare -a ALL_SERVICES=(
109109
"resource=./internal/services/workers_kv_namespace"
110110
"resource=./internal/services/workers_route"
111111
"resource=./internal/services/workers_script"
112-
"resource=./internal/services/workflow"
112+
# "resource=./internal/services/workflow"
113113
"resource=./internal/services/zero_trust_access_application"
114114
"resource=./internal/services/zero_trust_access_custom_page"
115115
"resource=./internal/services/zero_trust_access_group"

0 commit comments

Comments
 (0)