@@ -2,6 +2,9 @@ package argo_smart_routing_test
2
2
3
3
import (
4
4
"fmt"
5
+ "github.com/hashicorp/terraform-plugin-testing/knownvalue"
6
+ "github.com/hashicorp/terraform-plugin-testing/plancheck"
7
+ "github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
5
8
"os"
6
9
"regexp"
7
10
"testing"
@@ -31,13 +34,33 @@ func TestAccCloudflareArgoSmartRouting_Basic(t *testing.T) {
31
34
resource .TestCheckResourceAttr (name , "value" , "on" ),
32
35
),
33
36
},
37
+ {
38
+ Config : testAccCheckCloudflareArgoSmartRoutingEnable (zoneID , rnd ),
39
+ Check : resource .ComposeTestCheckFunc (
40
+ resource .TestCheckResourceAttr (name , "id" , zoneID ),
41
+ resource .TestCheckResourceAttr (name , "zone_id" , zoneID ),
42
+ resource .TestCheckResourceAttr (name , "value" , "on" ),
43
+ ),
44
+ PlanOnly : true ,
45
+ ExpectNonEmptyPlan : false ,
46
+ },
34
47
{
35
48
Config : testAccCheckCloudflareArgoSmartRoutingDisable (zoneID , rnd ),
36
49
Check : resource .ComposeTestCheckFunc (
37
50
resource .TestCheckResourceAttr (name , "id" , zoneID ),
38
51
resource .TestCheckResourceAttr (name , "zone_id" , zoneID ),
39
52
resource .TestCheckResourceAttr (name , "value" , "off" ),
40
53
),
54
+ ConfigPlanChecks : resource.ConfigPlanChecks {
55
+ PreApply : []plancheck.PlanCheck {
56
+ plancheck .ExpectResourceAction (name , plancheck .ResourceActionUpdate ),
57
+ plancheck .ExpectKnownValue (
58
+ name ,
59
+ tfjsonpath .New ("value" ),
60
+ knownvalue .StringExact ("off" ),
61
+ ),
62
+ },
63
+ },
41
64
},
42
65
{
43
66
ResourceName : name ,
0 commit comments