Rename root, api and sdk module paths (imports, go.mod, go_package, ldflags, build scripts, buf configs) and regenerate protobuf/gateway code with the project's pinned toolchain. Wire identifiers unchanged. api gets a local replace for sdk; root/api/sdk require v0.1.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
// Copyright IBM Corp. 2020, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package target_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
atar "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/alias/target"
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/db"
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/iam"
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/target/tcp"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTestAlias(t *testing.T) {
|
|
conn, _ := db.TestSetup(t, "postgres")
|
|
rw := db.New(conn)
|
|
wrapper := db.TestWrapper(t)
|
|
iamRepo := iam.TestRepo(t, conn, wrapper)
|
|
_, proj := iam.TestScopes(t, iamRepo)
|
|
tar := tcp.TestTarget(context.Background(), t, conn, proj.GetPublicId(), "test target")
|
|
|
|
a := atar.TestAlias(t, rw, "example.alias",
|
|
atar.WithDescription("description"),
|
|
atar.WithName("name"),
|
|
atar.WithDestinationId(tar.GetPublicId()),
|
|
atar.WithHostId("hst_1234567890"))
|
|
|
|
assert.Equal(t, "example.alias", a.GetValue())
|
|
assert.Equal(t, "description", a.GetDescription())
|
|
assert.Equal(t, "name", a.GetName())
|
|
assert.Equal(t, tar.GetPublicId(), a.GetDestinationId())
|
|
assert.Equal(t, "hst_1234567890", a.GetHostId())
|
|
assert.Equal(t, "global", a.GetScopeId())
|
|
assert.NotEmpty(t, a.GetPublicId())
|
|
}
|