Move generated pb.go file in to the internal/gen directory (#2225)
This commit is contained in:
8 files changed
+52
-64
No files matched your search
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/authtoken"
|
||||
"github.com/hashicorp/boundary/internal/daemon/cluster/handlers"
|
||||
"github.com/hashicorp/boundary/internal/db"
|
||||
pb "github.com/hashicorp/boundary/internal/gen/controller/servers"
|
||||
pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
|
||||
"github.com/hashicorp/boundary/internal/host/static"
|
||||
"github.com/hashicorp/boundary/internal/iam"
|
||||
@@ -105,7 +106,7 @@ func TestStatus(t *testing.T) {
|
||||
name: "No Sessions",
|
||||
wantErr: false,
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetName(),
|
||||
Address: worker1.GetAddress(),
|
||||
@@ -125,7 +126,7 @@ func TestStatus(t *testing.T) {
|
||||
name: "Still Active",
|
||||
wantErr: false,
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetName(),
|
||||
Address: worker1.GetAddress(),
|
||||
@@ -164,7 +165,7 @@ func TestStatus(t *testing.T) {
|
||||
name: "No Name or keyId",
|
||||
wantErr: true,
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Address: worker1.GetAddress(),
|
||||
},
|
||||
@@ -175,7 +176,7 @@ func TestStatus(t *testing.T) {
|
||||
name: "No Address",
|
||||
wantErr: true,
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetName(),
|
||||
},
|
||||
@@ -201,7 +202,7 @@ func TestStatus(t *testing.T) {
|
||||
got,
|
||||
cmpopts.IgnoreUnexported(
|
||||
pbs.StatusResponse{},
|
||||
server.ServerWorkerStatus{},
|
||||
pb.ServerWorkerStatus{},
|
||||
pbs.UpstreamServer{},
|
||||
pbs.JobChangeRequest{},
|
||||
pbs.Job{},
|
||||
@@ -209,7 +210,7 @@ func TestStatus(t *testing.T) {
|
||||
pbs.SessionJobInfo{},
|
||||
pbs.Connection{},
|
||||
),
|
||||
cmpopts.IgnoreFields(server.ServerWorkerStatus{}, "Tags"),
|
||||
cmpopts.IgnoreFields(pb.ServerWorkerStatus{}, "Tags"),
|
||||
),
|
||||
)
|
||||
})
|
||||
@@ -308,7 +309,7 @@ func TestStatusSessionClosed(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
},
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetName(),
|
||||
Address: worker1.GetAddress(),
|
||||
@@ -379,7 +380,7 @@ func TestStatusSessionClosed(t *testing.T) {
|
||||
got,
|
||||
cmpopts.IgnoreUnexported(
|
||||
pbs.StatusResponse{},
|
||||
server.ServerWorkerStatus{},
|
||||
pb.ServerWorkerStatus{},
|
||||
pbs.UpstreamServer{},
|
||||
pbs.JobChangeRequest{},
|
||||
pbs.Job{},
|
||||
@@ -387,7 +388,7 @@ func TestStatusSessionClosed(t *testing.T) {
|
||||
pbs.SessionJobInfo{},
|
||||
pbs.Connection{},
|
||||
),
|
||||
cmpopts.IgnoreFields(server.ServerWorkerStatus{}, "Tags"),
|
||||
cmpopts.IgnoreFields(pb.ServerWorkerStatus{}, "Tags"),
|
||||
),
|
||||
)
|
||||
})
|
||||
@@ -475,7 +476,7 @@ func TestStatusDeadConnection(t *testing.T) {
|
||||
require.NotEqual(t, deadConn.PublicId, connection.PublicId)
|
||||
|
||||
req := &pbs.StatusRequest{
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
PublicId: worker1.GetPublicId(),
|
||||
Name: worker1.GetName(),
|
||||
Address: worker1.GetAddress(),
|
||||
@@ -517,7 +518,7 @@ func TestStatusDeadConnection(t *testing.T) {
|
||||
got,
|
||||
cmpopts.IgnoreUnexported(
|
||||
pbs.StatusResponse{},
|
||||
server.ServerWorkerStatus{},
|
||||
pb.ServerWorkerStatus{},
|
||||
pbs.UpstreamServer{},
|
||||
pbs.JobChangeRequest{},
|
||||
pbs.Job{},
|
||||
@@ -525,7 +526,7 @@ func TestStatusDeadConnection(t *testing.T) {
|
||||
pbs.SessionJobInfo{},
|
||||
pbs.Connection{},
|
||||
),
|
||||
cmpopts.IgnoreFields(server.ServerWorkerStatus{}, "Tags"),
|
||||
cmpopts.IgnoreFields(pb.ServerWorkerStatus{}, "Tags"),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -635,7 +636,7 @@ func TestStatusWorkerWithKeyId(t *testing.T) {
|
||||
name: "Identify workerID based on keyId in status",
|
||||
wantErr: false,
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
Address: "someaddress",
|
||||
KeyId: nodeInfo.Id,
|
||||
},
|
||||
@@ -654,7 +655,7 @@ func TestStatusWorkerWithKeyId(t *testing.T) {
|
||||
name: "Active keyId Worker",
|
||||
wantErr: false,
|
||||
req: &pbs.StatusRequest{
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
KeyId: nodeInfo.Id,
|
||||
Address: "someaddress",
|
||||
},
|
||||
@@ -708,7 +709,7 @@ func TestStatusWorkerWithKeyId(t *testing.T) {
|
||||
got,
|
||||
cmpopts.IgnoreUnexported(
|
||||
pbs.StatusResponse{},
|
||||
server.ServerWorkerStatus{},
|
||||
pb.ServerWorkerStatus{},
|
||||
pbs.UpstreamServer{},
|
||||
pbs.JobChangeRequest{},
|
||||
pbs.Job{},
|
||||
@@ -716,7 +717,7 @@ func TestStatusWorkerWithKeyId(t *testing.T) {
|
||||
pbs.SessionJobInfo{},
|
||||
pbs.Connection{},
|
||||
),
|
||||
cmpopts.IgnoreFields(server.ServerWorkerStatus{}, "Tags"),
|
||||
cmpopts.IgnoreFields(pb.ServerWorkerStatus{}, "Tags"),
|
||||
),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"fmt"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
@@ -16,7 +15,6 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/credential"
|
||||
credstatic "github.com/hashicorp/boundary/internal/credential/static"
|
||||
"github.com/hashicorp/boundary/internal/credential/vault"
|
||||
cluster "github.com/hashicorp/boundary/internal/daemon/cluster/handlers"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/auth"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/handlers"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/handlers/credentiallibraries"
|
||||
@@ -25,7 +23,6 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/db"
|
||||
pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services"
|
||||
authpb "github.com/hashicorp/boundary/internal/gen/controller/auth"
|
||||
spbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
|
||||
"github.com/hashicorp/boundary/internal/host/plugin"
|
||||
"github.com/hashicorp/boundary/internal/host/static"
|
||||
"github.com/hashicorp/boundary/internal/iam"
|
||||
@@ -34,7 +31,6 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/requests"
|
||||
"github.com/hashicorp/boundary/internal/scheduler"
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
spb "github.com/hashicorp/boundary/internal/server"
|
||||
"github.com/hashicorp/boundary/internal/session"
|
||||
"github.com/hashicorp/boundary/internal/target"
|
||||
"github.com/hashicorp/boundary/internal/target/tcp"
|
||||
@@ -2937,9 +2933,6 @@ func TestAuthorizeSession_Errors(t *testing.T) {
|
||||
sessionRepoFn := func() (*session.Repository, error) {
|
||||
return session.NewRepository(rw, rw, kms)
|
||||
}
|
||||
connectionRepoFn := func() (*session.ConnectionRepository, error) {
|
||||
return session.NewConnectionRepository(ctx, rw, rw, kms)
|
||||
}
|
||||
staticHostRepoFn := func() (*static.Repository, error) {
|
||||
return static.NewRepository(rw, rw, kms)
|
||||
}
|
||||
@@ -2982,15 +2975,7 @@ func TestAuthorizeSession_Errors(t *testing.T) {
|
||||
store := vault.TestCredentialStore(t, conn, wrapper, proj.GetPublicId(), v.Addr, tok, sec.Auth.Accessor)
|
||||
|
||||
workerExists := func(tar target.Target) (version uint32) {
|
||||
workerService := cluster.NewWorkerServiceServer(serversRepoFn, sessionRepoFn, connectionRepoFn, &sync.Map{}, kms)
|
||||
_, err := workerService.Status(context.Background(), &spbs.StatusRequest{
|
||||
WorkerStatus: &spb.ServerWorkerStatus{
|
||||
PublicId: "w_1234567890",
|
||||
Name: "w_1234567890",
|
||||
Address: "localhost:123",
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
server.TestKmsWorker(t, conn, wrapper)
|
||||
return tar.GetVersion()
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
pb "github.com/hashicorp/boundary/internal/gen/controller/servers"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/daemon/worker/common"
|
||||
"github.com/hashicorp/boundary/internal/daemon/worker/session"
|
||||
@@ -139,11 +139,11 @@ func (w *Worker) sendWorkerStatus(cancelCtx context.Context) {
|
||||
|
||||
// Send status information
|
||||
client := w.controllerStatusConn.Load().(pbs.ServerCoordinationServiceClient)
|
||||
var tags []*server.TagPair
|
||||
var tags []*pb.TagPair
|
||||
// If we're not going to request a tag update, no reason to have these
|
||||
// marshaled on every status call.
|
||||
if w.updateTags.Load() {
|
||||
tags = w.tags.Load().([]*server.TagPair)
|
||||
tags = w.tags.Load().([]*pb.TagPair)
|
||||
}
|
||||
statusCtx, statusCancel := context.WithTimeout(cancelCtx, common.StatusTimeout)
|
||||
defer statusCancel()
|
||||
@@ -157,7 +157,7 @@ func (w *Worker) sendWorkerStatus(cancelCtx context.Context) {
|
||||
|
||||
result, err := client.Status(statusCtx, &pbs.StatusRequest{
|
||||
Jobs: activeJobs,
|
||||
WorkerStatus: &server.ServerWorkerStatus{
|
||||
WorkerStatus: &pb.ServerWorkerStatus{
|
||||
Name: w.conf.RawConfig.Worker.Name,
|
||||
Description: w.conf.RawConfig.Worker.Description,
|
||||
Address: w.conf.RawConfig.Worker.PublicAddr,
|
||||
|
||||
@@ -14,7 +14,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
pb "github.com/hashicorp/boundary/internal/gen/controller/servers"
|
||||
|
||||
"github.com/hashicorp/nodeenrollment"
|
||||
"github.com/mr-tron/base58"
|
||||
|
||||
@@ -388,13 +389,13 @@ func (w *Worker) Resolver() *manual.Resolver {
|
||||
|
||||
func (w *Worker) ParseAndStoreTags(incoming map[string][]string) {
|
||||
if len(incoming) == 0 {
|
||||
w.tags.Store([]*server.TagPair{})
|
||||
w.tags.Store([]*pb.TagPair{})
|
||||
return
|
||||
}
|
||||
tags := []*server.TagPair{}
|
||||
tags := []*pb.TagPair{}
|
||||
for k, vals := range incoming {
|
||||
for _, v := range vals {
|
||||
tags = append(tags, &server.TagPair{
|
||||
tags = append(tags, &pb.TagPair{
|
||||
Key: k,
|
||||
Value: v,
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user