2022-12-06 12:28:55 -08:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-02-02 17:15:17 -08:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
|
|
2021-09-29 13:13:49 -04:00
|
|
|
package tcp
|
|
|
|
|
|
2022-12-06 12:28:55 -08:00
|
|
|
import (
|
2023-06-06 17:09:08 -04:00
|
|
|
"context"
|
|
|
|
|
|
2022-12-06 12:28:55 -08:00
|
|
|
"github.com/hashicorp/boundary/internal/target"
|
|
|
|
|
"github.com/hashicorp/boundary/internal/target/store"
|
|
|
|
|
)
|
2021-09-29 13:13:49 -04:00
|
|
|
|
|
|
|
|
// Expose functions and variables for tests.
|
|
|
|
|
var (
|
|
|
|
|
TestId = testId
|
|
|
|
|
TestTargetName = testTargetName
|
|
|
|
|
DefaultTableName = defaultTableName
|
|
|
|
|
)
|
|
|
|
|
|
2022-07-20 16:24:46 -07:00
|
|
|
// NewTestTarget is a test helper that bypasses the projectId checks
|
2021-09-29 13:13:49 -04:00
|
|
|
// performed by NewTarget, allowing tests to create Targets with
|
2022-07-20 16:24:46 -07:00
|
|
|
// nil projectIds for more robust testing.
|
2023-06-06 17:09:08 -04:00
|
|
|
func NewTestTarget(ctx context.Context, projectId string, opt ...target.Option) target.Target {
|
|
|
|
|
t, _ := targetHooks{}.NewTarget(ctx, "testScope", opt...)
|
2022-07-20 16:24:46 -07:00
|
|
|
t.SetProjectId(projectId)
|
2021-09-29 13:13:49 -04:00
|
|
|
return t
|
|
|
|
|
}
|
2022-12-06 12:28:55 -08:00
|
|
|
|
|
|
|
|
// NewTestAddress is a test helper that bypasses the targetId & address checks
|
|
|
|
|
// performed by NewAddress, allowing tests to create a target Address with
|
|
|
|
|
// nil fields for more robust testing.
|
|
|
|
|
func NewTestAddress() *target.Address {
|
|
|
|
|
return &target.Address{
|
|
|
|
|
TargetAddress: &store.TargetAddress{},
|
|
|
|
|
}
|
|
|
|
|
}
|