Linter fixes PR 3 (#4415)
* Linter fixes * fix(bsr): update test to register TEST protocol once --------- Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
This commit is contained in:
1 parent
e95eda7ca2
commit
35cef97bd4
119 files changed
+365
-300
No files matched your search
@@ -26,7 +26,7 @@ type CommandResult struct {
|
||||
// to be used directly, but instead option arguments are built from the
|
||||
// functions in this package. WithX options set a value to that given in the
|
||||
// argument; DefaultX options indicate that the value should be set to its
|
||||
// default. When an API call is made options are processed in ther order they
|
||||
// default. When an API call is made options are processed in the order they
|
||||
// appear in the function call, so for a given argument X, a succession of WithX
|
||||
// or DefaultX calls will result in the last call taking effect.
|
||||
type Option func(*options)
|
||||
|
||||
@@ -71,7 +71,7 @@ func TestUserIsLoggedOutWhenAuthTokenIsDeletedCli(t *testing.T) {
|
||||
),
|
||||
)
|
||||
require.NoError(t, output.Err, string(output.Stderr))
|
||||
t.Logf("Sucessfully deleted user auth-token: %s", userAuthTokenID)
|
||||
t.Logf("Successfully deleted user auth-token: %s", userAuthTokenID)
|
||||
|
||||
// As the user, try to execute the command requiring to be logged in again
|
||||
output = e2e.RunCommand(ctx, "boundary",
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestCliAuthenticatePrimary(t *testing.T) {
|
||||
|
||||
// Get last line from output (authentication response)
|
||||
var buf bytes.Buffer
|
||||
io.Copy(&buf, f)
|
||||
_, _ = io.Copy(&buf, f)
|
||||
parts := strings.Split(strings.TrimSpace(buf.String()), "\r\n")
|
||||
response := parts[len(parts)-1]
|
||||
|
||||
|
||||
@@ -192,7 +192,8 @@ func TestApiCreateGroup(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
uClient := users.NewClient(client)
|
||||
uClient.SetAccounts(ctx, newUserId, 0, []string{newAcctId})
|
||||
_, err = uClient.SetAccounts(ctx, newUserId, 0, []string{newAcctId}, users.WithAutomaticVersioning(true))
|
||||
require.NoError(t, err)
|
||||
|
||||
gClient := groups.NewClient(client)
|
||||
newGroupResult, err := gClient.Create(ctx, "global")
|
||||
|
||||
@@ -187,7 +187,8 @@ func TestApiCreateUser(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
uClient := users.NewClient(client)
|
||||
uClient.SetAccounts(ctx, newUserId, 0, []string{newAcctId})
|
||||
_, err = uClient.SetAccounts(ctx, newUserId, 0, []string{newAcctId}, users.WithAutomaticVersioning(true))
|
||||
require.NoError(t, err)
|
||||
|
||||
rClient := roles.NewClient(client)
|
||||
newRoleResult, err := rClient.Create(ctx, newProjectId)
|
||||
|
||||
@@ -69,7 +69,8 @@ func TestCliTcpTargetConnectTargetAndScp(t *testing.T) {
|
||||
fileSource := fmt.Sprintf("%s/%s_src.txt", testDir, t.Name())
|
||||
f, err := os.Create(fileSource)
|
||||
require.NoError(t, err)
|
||||
io.CopyN(f, rand.Reader, 256000)
|
||||
_, err = io.CopyN(f, rand.Reader, 256000)
|
||||
require.NoError(t, err)
|
||||
|
||||
fi, err := f.Stat()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
)
|
||||
|
||||
// TestCliTcpTargetConnectTargetWithSshRemoteCommand uses the boundary cli to
|
||||
// connect to a target using `connect ssh -remote-commmand`
|
||||
// connect to a target using `connect ssh -remote-command`
|
||||
func TestCliTcpTargetConnectTargetWithSshRemoteCommand(t *testing.T) {
|
||||
e2e.MaybeSkipTest(t)
|
||||
c, err := loadTestConfig()
|
||||
|
||||
@@ -66,10 +66,14 @@ func TestCliTcpTargetConnectPostgres(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
f.Write([]byte("\\pset pager off\n")) // disables pagination in output
|
||||
f.Write([]byte("\\dt\n")) // list all tables
|
||||
f.Write([]byte("\\q\n")) // exit psql session
|
||||
f.Write([]byte{4}) // EOT (End of Transmission - marks end of file stream)
|
||||
_, err = f.Write([]byte("\\pset pager off\n")) // disables pagination in output
|
||||
require.NoError(t, err)
|
||||
_, err = f.Write([]byte("\\dt\n")) // list all tables
|
||||
require.NoError(t, err)
|
||||
_, err = f.Write([]byte("\\q\n")) // exit psql session
|
||||
require.NoError(t, err)
|
||||
_, err = f.Write([]byte{4}) // EOT (End of Transmission - marks end of file stream)
|
||||
require.NoError(t, err)
|
||||
|
||||
var buf bytes.Buffer
|
||||
io.Copy(&buf, f)
|
||||
|
||||
@@ -92,7 +92,9 @@ func setupEnvironment(t testing.TB, ctx context.Context, c *config, boundaryRepo
|
||||
// Start Vault
|
||||
v, vaultToken := infra.StartVault(t, pool, network, "hashicorp/vault", "latest")
|
||||
t.Cleanup(func() {
|
||||
pool.Purge(v.Resource)
|
||||
if err := pool.Purge(v.Resource); err != nil {
|
||||
t.Logf("error purging pool: %v", err)
|
||||
}
|
||||
})
|
||||
os.Setenv("VAULT_ADDR", v.UriLocalhost)
|
||||
os.Setenv("VAULT_TOKEN", vaultToken)
|
||||
@@ -115,7 +117,9 @@ func setupEnvironment(t testing.TB, ctx context.Context, c *config, boundaryRepo
|
||||
// Start a Boundary database and wait until it's ready
|
||||
db := infra.StartBoundaryDatabase(t, pool, network, "library/postgres", "latest")
|
||||
t.Cleanup(func() {
|
||||
pool.Purge(db.Resource)
|
||||
if err := pool.Purge(db.Resource); err != nil {
|
||||
t.Logf("error purging pool: %v", err)
|
||||
}
|
||||
})
|
||||
t.Log("Waiting for database to load...")
|
||||
err = pool.Retry(func() error {
|
||||
@@ -138,7 +142,9 @@ func setupEnvironment(t testing.TB, ctx context.Context, c *config, boundaryRepo
|
||||
c.TargetSshKeyPath,
|
||||
)
|
||||
t.Cleanup(func() {
|
||||
pool.Purge(target.Resource)
|
||||
if err := pool.Purge(target.Resource); err != nil {
|
||||
t.Logf("error purging pool: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
// Initialize the database and extract resulting information
|
||||
@@ -151,7 +157,9 @@ func setupEnvironment(t testing.TB, ctx context.Context, c *config, boundaryRepo
|
||||
db.UriNetwork,
|
||||
)
|
||||
t.Cleanup(func() {
|
||||
pool.Purge(dbInit.Resource)
|
||||
if err := pool.Purge(dbInit.Resource); err != nil {
|
||||
t.Logf("error purging pool: %v", err)
|
||||
}
|
||||
})
|
||||
dbInitInfo := infra.GetDbInitInfoFromContainer(t, pool, dbInit)
|
||||
|
||||
@@ -371,7 +379,9 @@ func populateBoundaryDatabase(t testing.TB, ctx context.Context, c *config, te T
|
||||
newTargetId,
|
||||
)
|
||||
t.Cleanup(func() {
|
||||
te.Pool.Purge(connectTarget.Resource)
|
||||
if err := te.Pool.Purge(connectTarget.Resource); err != nil {
|
||||
t.Logf("error purging pool: %v", err)
|
||||
}
|
||||
})
|
||||
_, err = te.Pool.Client.WaitContainer(connectTarget.Resource.Container.ID)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in new issue
Block a user