-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into rculpepper/vault-28619
- Loading branch information
Showing
30 changed files
with
534 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @hashicorp/vault-ecosystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package testutil | ||
|
||
import ( | ||
"context" | ||
"database/sql" | ||
"testing" | ||
|
||
"github.com/hashicorp/vault/sdk/helper/dbtxn" | ||
|
||
_ "github.com/jackc/pgx/v4/stdlib" | ||
) | ||
|
||
func CreateTestPGUser(t *testing.T, connURL string, username, password, query string) { | ||
t.Helper() | ||
t.Logf("[TRACE] Creating test user") | ||
|
||
db, err := sql.Open("pgx", connURL) | ||
defer db.Close() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
// Start a transaction | ||
ctx := context.Background() | ||
tx, err := db.BeginTx(ctx, nil) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
defer func() { | ||
_ = tx.Rollback() | ||
}() | ||
|
||
m := map[string]string{ | ||
"name": username, | ||
"password": password, | ||
} | ||
if err := dbtxn.ExecuteTxQueryDirect(ctx, tx, m, query); err != nil { | ||
t.Fatal(err) | ||
} | ||
// Commit the transaction | ||
if err := tx.Commit(); err != nil { | ||
t.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.