From d0ebad4eb6f94a22c00bd5fee6a8e4e3b0a9babd Mon Sep 17 00:00:00 2001 From: aahel Date: Tue, 26 Sep 2023 10:40:21 +0530 Subject: [PATCH] added cas test --- consul/resource_consul_keys_test.go | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/consul/resource_consul_keys_test.go b/consul/resource_consul_keys_test.go index 432c5cd1..e07404ab 100644 --- a/consul/resource_consul_keys_test.go +++ b/consul/resource_consul_keys_test.go @@ -26,7 +26,7 @@ func TestAccConsulKeys_basic(t *testing.T) { testAccCheckConsulKeysValue("consul_keys.app", "enabled", "true"), testAccCheckConsulKeysValue("consul_keys.app", "set", "acceptance"), testAccCheckConsulKeysValue("consul_keys.app", "remove_one", "hello"), - resource.TestCheckResourceAttr("consul_keys.app", "key.4258512057.flags", "0"), + resource.TestCheckResourceAttr("consul_keys.app", "key.3606807749.flags", "0"), ), }, { @@ -42,6 +42,20 @@ func TestAccConsulKeys_basic(t *testing.T) { }) } +func TestTestAccConsulKeys_Cas(t *testing.T) { + providers, _ := startTestServer(t) + + resource.Test(t, resource.TestCase{ + Providers: providers, + Steps: []resource.TestStep{ + { + Config: testAccConsulKeysConfig_Cas, + Check: resource.TestCheckResourceAttr("consul_keys.app", "key.2637474718.cas", "0"), + }, + }, + }) +} + func TestAccConsulKeys_EmptyValue(t *testing.T) { providers, client := startTestServer(t) @@ -286,3 +300,14 @@ resource "consul_keys" "dc2" { } } ` + +const testAccConsulKeysConfig_Cas = ` +resource "consul_keys" "app" { + datacenter = "dc1" + key { + path = "test/testKey" + value = "testVal" + cas = 0 + } +} +`