Unverified Commit 765fa374 authored by Clint Shryock's avatar Clint Shryock
Browse files

rename tests, fix error message check

parent 75e5092d
Showing with 6 additions and 14 deletions
+6 -14
......@@ -258,7 +258,7 @@ func (b *databaseBackend) pathRoleCreateUpdate() framework.OperationFunc {
frequency := data.Get("rotation_frequency")
if frequency == 0 && req.Operation == logical.CreateOperation {
return logical.ErrorResponse("rotation_frequency is a required to create static accounts"), nil
return logical.ErrorResponse("rotation_frequency is required to create static accounts"), nil
}
role.StaticAccount.RotationFrequency, err = parseutil.ParseDurationSecond(frequency)
......
......@@ -9,12 +9,11 @@ import (
"github.com/hashicorp/vault/helper/namespace"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
"github.com/y0ssar1an/q"
)
var dataKeys = []string{"username", "password", "last_vault_rotation", "rotation_frequency"}
func TestBackend_Static_Config(t *testing.T) {
func TestBackend_StaticRole_Config(t *testing.T) {
cluster, sys := getCluster(t)
defer cluster.Cleanup()
......@@ -76,7 +75,7 @@ func TestBackend_Static_Config(t *testing.T) {
account: map[string]interface{}{
"username": "statictest",
},
err: errors.New("rotation_frequency is a required field for static accounts"),
err: errors.New("rotation_frequency is required to create static accounts"),
},
"missing username frequency": {
account: map[string]interface{}{
......@@ -102,7 +101,6 @@ func TestBackend_Static_Config(t *testing.T) {
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
q.Q(">>>")
data := map[string]interface{}{
"name": "plugin-role-test",
"db_name": "plugin-test",
......@@ -201,16 +199,11 @@ func TestBackend_Static_Config(t *testing.T) {
if err != nil || (resp != nil && resp.IsError()) {
t.Fatalf("err:%s resp:%#v\n", err, resp)
}
q.Q("<<<")
q.Q("")
})
}
q.Q("")
q.Q(" ------")
q.Q("")
}
func TestBackend_Static_Config_Update(t *testing.T) {
func TestBackend_StaticRole_Config_Update(t *testing.T) {
cluster, sys := getCluster(t)
defer cluster.Cleanup()
......@@ -251,7 +244,6 @@ func TestBackend_Static_Config_Update(t *testing.T) {
t.Fatalf("err:%s resp:%#v\n", err, resp)
}
q.Q(">>>")
data = map[string]interface{}{
"name": "plugin-role-test",
"db_name": "plugin-test",
......
......@@ -13,7 +13,7 @@ import (
_ "github.com/lib/pq"
)
func TestBackend_Role_Rotate_Static(t *testing.T) {
func TestBackend_StaticRole_Rotate(t *testing.T) {
cluster, sys := getCluster(t)
defer cluster.Cleanup()
......@@ -140,7 +140,7 @@ func TestBackend_Role_Rotate_Static(t *testing.T) {
// sanity check to make sure we don't allow an attempt of rotating credentials
// for non-static accounts, which doesn't make sense anyway, but doesn't hurt to
// verify we return an error
func TestBackend_Role_Rotate_Normal(t *testing.T) {
func TestBackend_StaticRole_NonStaticError(t *testing.T) {
cluster, sys := getCluster(t)
defer cluster.Cleanup()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment