Some testing fixes (#2193)
This commit is contained in:
5 files changed
+158
-60
No files matched your search
@@ -107,7 +107,7 @@ func TestStatus(t *testing.T) {
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &servers.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetWorkerReportedName(),
|
||||
Name: worker1.GetName(),
|
||||
Address: worker1.CanonicalAddress(),
|
||||
},
|
||||
},
|
||||
@@ -127,7 +127,7 @@ func TestStatus(t *testing.T) {
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &servers.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetWorkerReportedName(),
|
||||
Name: worker1.GetName(),
|
||||
Address: worker1.CanonicalAddress(),
|
||||
},
|
||||
Jobs: []*pbs.JobStatus{
|
||||
@@ -169,7 +169,7 @@ func TestStatus(t *testing.T) {
|
||||
Address: worker1.CanonicalAddress(),
|
||||
},
|
||||
},
|
||||
wantErrMsg: status.Error(codes.InvalidArgument, "Name and keyId are not set in the request; at least one is required.").Error(),
|
||||
wantErrMsg: status.Error(codes.InvalidArgument, "Name and keyId are not set in the request; one is required.").Error(),
|
||||
},
|
||||
{
|
||||
name: "No Address",
|
||||
@@ -177,7 +177,7 @@ func TestStatus(t *testing.T) {
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &servers.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetWorkerReportedName(),
|
||||
Name: worker1.GetName(),
|
||||
},
|
||||
},
|
||||
wantErrMsg: status.Error(codes.InvalidArgument, "Address is not set but is required.").Error(),
|
||||
@@ -310,7 +310,7 @@ func TestStatusSessionClosed(t *testing.T) {
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &servers.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetWorkerReportedName(),
|
||||
Name: worker1.GetName(),
|
||||
Address: worker1.CanonicalAddress(),
|
||||
},
|
||||
Jobs: []*pbs.JobStatus{
|
||||
@@ -477,7 +477,7 @@ func TestStatusDeadConnection(t *testing.T) {
|
||||
req := &pbs.StatusRequest{
|
||||
WorkerStatus: &servers.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetWorkerReportedName(),
|
||||
Name: worker1.GetName(),
|
||||
Address: worker1.CanonicalAddress(),
|
||||
},
|
||||
Jobs: []*pbs.JobStatus{
|
||||
@@ -578,7 +578,7 @@ func TestStatusWorkerWithKeyId(t *testing.T) {
|
||||
target.WithSessionConnectionLimit(-1),
|
||||
)
|
||||
|
||||
worker1 := servers.TestKmsWorker(t, conn, wrapper)
|
||||
worker1 := servers.TestPkiWorker(t, conn, wrapper)
|
||||
|
||||
rootStorage, err := servers.NewRepositoryStorage(ctx, rw, rw, kms)
|
||||
require.NoError(t, err)
|
||||
@@ -636,8 +636,7 @@ func TestStatusWorkerWithKeyId(t *testing.T) {
|
||||
wantErr: false,
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &servers.ServerWorkerStatus{
|
||||
Name: worker1.GetWorkerReportedName(),
|
||||
Address: worker1.CanonicalAddress(),
|
||||
Address: "someaddress",
|
||||
KeyId: nodeInfo.Id,
|
||||
},
|
||||
},
|
||||
@@ -657,8 +656,7 @@ func TestStatusWorkerWithKeyId(t *testing.T) {
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &servers.ServerWorkerStatus{
|
||||
KeyId: nodeInfo.Id,
|
||||
Name: worker1.GetWorkerReportedName(),
|
||||
Address: worker1.CanonicalAddress(),
|
||||
Address: "someaddress",
|
||||
},
|
||||
Jobs: []*pbs.JobStatus{
|
||||
{
|
||||
@@ -703,6 +701,7 @@ func TestStatusWorkerWithKeyId(t *testing.T) {
|
||||
assert.Equal(tc.wantErrMsg, err.Error())
|
||||
return
|
||||
}
|
||||
require.NoError(err)
|
||||
assert.Empty(
|
||||
cmp.Diff(
|
||||
tc.want,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/db"
|
||||
"github.com/hashicorp/boundary/internal/servers"
|
||||
"github.com/hashicorp/boundary/internal/types/scope"
|
||||
pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/targets"
|
||||
@@ -32,18 +33,20 @@ func TestWorkerList_Addresses(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWorkerList_Filter(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
wrapper := db.TestWrapper(t)
|
||||
var workers []*servers.Worker
|
||||
for i := 0; i < 5; i++ {
|
||||
switch {
|
||||
case i%2 == 0:
|
||||
workers = append(workers, servers.NewWorker(scope.Global.String(),
|
||||
workers = append(workers, servers.TestKmsWorker(t, conn, wrapper,
|
||||
servers.WithName(fmt.Sprintf("test_worker_%d", i)),
|
||||
servers.WithWorkerTags(&servers.Tag{
|
||||
Key: fmt.Sprintf("key%d", i),
|
||||
Value: fmt.Sprintf("value%d", i),
|
||||
})))
|
||||
default:
|
||||
workers = append(workers, servers.NewWorkerForStatus(scope.Global.String(),
|
||||
workers = append(workers, servers.TestPkiWorker(t, conn, wrapper,
|
||||
servers.WithName(fmt.Sprintf("test_worker_%d", i)),
|
||||
servers.WithWorkerTags(&servers.Tag{
|
||||
Key: "key",
|
||||
|
||||
Reference in new issue
Block a user