mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-17 16:51:45 +01:00
initial commit to fix empty consistency option issue
This commit is contained in:
parent
80281c16fc
commit
bc58e02fe8
@ -35,7 +35,7 @@ func TestBackend_roleCrud(t *testing.T) {
|
|||||||
Backend: b,
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepRole(t),
|
testAccStepRoleWithOptions(t),
|
||||||
testAccStepReadRole(t, "test", testRole),
|
testAccStepReadRole(t, "test", testRole),
|
||||||
testAccStepDeleteRole(t, "test"),
|
testAccStepDeleteRole(t, "test"),
|
||||||
testAccStepReadRole(t, "test", ""),
|
testAccStepReadRole(t, "test", ""),
|
||||||
@ -67,6 +67,17 @@ func testAccStepRole(t *testing.T) logicaltest.TestStep {
|
|||||||
Path: "roles/test",
|
Path: "roles/test",
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"creation_cql": testRole,
|
"creation_cql": testRole,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testAccStepRoleWithOptions(t *testing.T) logicaltest.TestStep {
|
||||||
|
return logicaltest.TestStep{
|
||||||
|
Operation: logical.UpdateOperation,
|
||||||
|
Path: "roles/test2",
|
||||||
|
Data: map[string]interface{}{
|
||||||
|
"creation_cql": testRole,
|
||||||
|
"lease": "30s",
|
||||||
"consistency": "All",
|
"consistency": "All",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,6 +131,9 @@ func (b *backend) pathRoleCreate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
consistencyStr := data.Get("consistency").(string)
|
consistencyStr := data.Get("consistency").(string)
|
||||||
|
if consistencyStr == "" {
|
||||||
|
consistencyStr = "Quorum"
|
||||||
|
}
|
||||||
_, err = gocql.ParseConsistencyWrapper(consistencyStr)
|
_, err = gocql.ParseConsistencyWrapper(consistencyStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return logical.ErrorResponse(fmt.Sprintf(
|
return logical.ErrorResponse(fmt.Sprintf(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user