feat: Add support for correlationId
This commit is contained in:
1 parent
f2c2a774c6
commit
c376d06355
31 files changed
+726
-57
No files matched your search
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/target/tcp"
|
||||
wrapping "github.com/hashicorp/go-kms-wrapping/v2"
|
||||
"github.com/hashicorp/go-secure-stdlib/base62"
|
||||
"github.com/hashicorp/go-uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
@@ -105,6 +106,11 @@ func TestSession(t testing.TB, conn *db.DB, rootWrapper wrapping.Wrapper, c Comp
|
||||
future := timestamppb.New(time.Now().Add(time.Hour))
|
||||
c.ExpirationTime = ×tamp.Timestamp{Timestamp: future}
|
||||
}
|
||||
if c.CorrelationId == "" {
|
||||
correlationId, err := uuid.GenerateUUID()
|
||||
require.NoError(err)
|
||||
c.CorrelationId = correlationId
|
||||
}
|
||||
rw := db.New(conn)
|
||||
s, err := New(ctx, c, opt...)
|
||||
require.NoError(err)
|
||||
@@ -191,6 +197,8 @@ func TestSessionTargetAddressParams(t testing.TB, conn *db.DB, wrapper wrapping.
|
||||
|
||||
expTime := timestamppb.Now()
|
||||
expTime.Seconds += int64(tcpTarget.GetSessionMaxSeconds())
|
||||
correlationId, err := uuid.GenerateUUID()
|
||||
require.NoError(err)
|
||||
return ComposedOf{
|
||||
UserId: user.PublicId,
|
||||
TargetId: tcpTarget.GetPublicId(),
|
||||
@@ -199,6 +207,7 @@ func TestSessionTargetAddressParams(t testing.TB, conn *db.DB, wrapper wrapping.
|
||||
Endpoint: "tcp://127.0.0.1:22",
|
||||
ExpirationTime: ×tamp.Timestamp{Timestamp: expTime},
|
||||
ConnectionLimit: tcpTarget.GetSessionConnectionLimit(),
|
||||
CorrelationId: correlationId,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,6 +254,8 @@ func TestSessionParams(t testing.TB, conn *db.DB, wrapper wrapping.Wrapper, iamR
|
||||
|
||||
expTime := timestamppb.Now()
|
||||
expTime.Seconds += int64(tcpTarget.GetSessionMaxSeconds())
|
||||
correlationId, err := uuid.GenerateUUID()
|
||||
require.NoError(err)
|
||||
return ComposedOf{
|
||||
UserId: user.PublicId,
|
||||
HostId: hosts[0].PublicId,
|
||||
@@ -255,6 +266,7 @@ func TestSessionParams(t testing.TB, conn *db.DB, wrapper wrapping.Wrapper, iamR
|
||||
Endpoint: "tcp://127.0.0.1:22",
|
||||
ExpirationTime: ×tamp.Timestamp{Timestamp: expTime},
|
||||
ConnectionLimit: tcpTarget.GetSessionConnectionLimit(),
|
||||
CorrelationId: correlationId,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user