Files
threshold/internal/target/tcp/exports_test.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.0 KiB
Go
Raw Normal View History

// 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
import (
"context"
"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.
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
}
// 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{},
}
}