refactor to use servers.ServerType in place of string

pull/347/head
Jim Lambert 6 years ago
parent 128ece6db8
commit 1d87510e89

@ -7,6 +7,7 @@ import (
"strings"
"github.com/hashicorp/boundary/internal/db"
"github.com/hashicorp/boundary/internal/servers"
"github.com/hashicorp/boundary/internal/session/store"
"google.golang.org/protobuf/proto"
)
@ -19,7 +20,7 @@ type ComposedOf struct {
UserId string
HostId string
ServerId string
ServerType string
ServerType servers.ServerType
TargetId string
HostSetId string
AuthTokenId string
@ -43,7 +44,7 @@ func New(c ComposedOf, opt ...Option) (*Session, error) {
UserId: c.UserId,
HostId: c.HostId,
ServerId: c.ServerId,
ServerType: c.ServerType,
ServerType: c.ServerType.String(),
TargetId: c.TargetId,
SetId: c.HostSetId,
AuthTokenId: c.AuthTokenId,

@ -43,7 +43,7 @@ func TestSession_Create(t *testing.T) {
UserId: composedOf.UserId,
HostId: composedOf.HostId,
ServerId: composedOf.ServerId,
ServerType: composedOf.ServerType,
ServerType: composedOf.ServerType.String(),
TargetId: composedOf.TargetId,
SetId: composedOf.HostSetId,
AuthTokenId: composedOf.AuthTokenId,

@ -12,7 +12,6 @@ import (
"github.com/hashicorp/boundary/internal/kms"
"github.com/hashicorp/boundary/internal/servers"
"github.com/hashicorp/boundary/internal/target"
"github.com/hashicorp/boundary/internal/types/resource"
wrapping "github.com/hashicorp/go-kms-wrapping"
"github.com/hashicorp/go-uuid"
"github.com/jinzhu/gorm"
@ -89,7 +88,7 @@ func TestSessionParams(t *testing.T, conn *gorm.DB, wrapper wrapping.Wrapper, ia
worker := &servers.Server{
PrivateId: "test-session-worker-" + id,
Name: "test-session-worker-" + id,
Type: resource.Worker.String(),
Type: servers.ServerTypeWorker.String(),
Description: "Test Session Worker",
Address: "127.0.0.1",
}
@ -100,7 +99,7 @@ func TestSessionParams(t *testing.T, conn *gorm.DB, wrapper wrapping.Wrapper, ia
UserId: user.PublicId,
HostId: hosts[0].PublicId,
ServerId: worker.PrivateId,
ServerType: worker.Type,
ServerType: servers.ServerTypeWorker,
TargetId: tcpTarget.PublicId,
HostSetId: sets[0].PublicId,
AuthTokenId: at.PublicId,

Loading…
Cancel
Save