Skip to content

Commit

Permalink
added cas test
Browse files Browse the repository at this point in the history
  • Loading branch information
aahel committed Sep 26, 2023
1 parent 7b4feec commit d0ebad4
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion consul/resource_consul_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
{
Expand All @@ -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)

Expand Down Expand Up @@ -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
}
}
`

0 comments on commit d0ebad4

Please sign in to comment.