mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Fix postgres backend test SQL for user priv checking
This commit is contained in:
@@ -105,7 +105,7 @@ func testAccStepReadCreds(t *testing.T, b logical.Backend, name string) logicalt
|
||||
|
||||
returnedRows := func() int {
|
||||
stmt, err := db.Prepare(fmt.Sprintf(
|
||||
"SELECT DISTINCT table_schema FROM information_schema.role_column_grants WHERE grantee='%s';",
|
||||
"SELECT DISTINCT schemaname FROM pg_tables WHERE has_table_privilege('%s', 'information_schema.role_column_grants', 'select');",
|
||||
d.Username))
|
||||
if err != nil {
|
||||
return -1
|
||||
@@ -126,7 +126,7 @@ func testAccStepReadCreds(t *testing.T, b logical.Backend, name string) logicalt
|
||||
}
|
||||
|
||||
userRows := returnedRows()
|
||||
if userRows != 1 {
|
||||
if userRows != 2 {
|
||||
t.Fatalf("did not get expected number of rows, got %d", userRows)
|
||||
}
|
||||
|
||||
@@ -149,7 +149,8 @@ func testAccStepReadCreds(t *testing.T, b logical.Backend, name string) logicalt
|
||||
}
|
||||
|
||||
userRows = returnedRows()
|
||||
if userRows != 0 {
|
||||
// User shouldn't exist so returnedRows() should encounter an error and exit with -1
|
||||
if userRows != -1 {
|
||||
t.Fatalf("did not get expected number of rows, got %d", userRows)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user