From 6766704687cb55e232836f0ea897061423495160 Mon Sep 17 00:00:00 2001 From: Todd Knight Date: Thu, 24 Jun 2021 09:39:41 -0400 Subject: [PATCH] Move setting worker as active closer to AuthorizeSession in the hopes that the liveness period doesn't pass before the AuthorizeSession can be called. (#1348) --- .../handlers/targets/target_service_test.go | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/servers/controller/handlers/targets/target_service_test.go b/internal/servers/controller/handlers/targets/target_service_test.go index 422986935f..5790148e64 100644 --- a/internal/servers/controller/handlers/targets/target_service_test.go +++ b/internal/servers/controller/handlers/targets/target_service_test.go @@ -1826,16 +1826,6 @@ func TestAuthorizeSession(t *testing.T) { }) require.NoError(t, err) - // Tell our DB that there is a worker ready to serve the data - workerService := workers.NewWorkerServiceServer(hclog.Default(), serversRepoFn, sessionRepoFn, &sync.Map{}, kms) - _, err = workerService.Status(ctx, &spbs.StatusRequest{ - Worker: &spb.Server{ - PrivateId: "testworker", - Address: "localhost:8457", - }, - }) - require.NoError(t, err) - v := vault.NewTestVaultServer(t) v.MountPKI(t) sec, tok := v.CreateToken(t, vault.WithPolicies([]string{"default", "boundary-controller", "pki"})) @@ -1863,6 +1853,16 @@ func TestAuthorizeSession(t *testing.T) { }) require.NoError(t, err) + // Tell our DB that there is a worker ready to serve the data + workerService := workers.NewWorkerServiceServer(hclog.Default(), serversRepoFn, sessionRepoFn, &sync.Map{}, kms) + _, err = workerService.Status(ctx, &spbs.StatusRequest{ + Worker: &spb.Server{ + PrivateId: "testworker", + Address: "localhost:8457", + }, + }) + require.NoError(t, err) + asRes1, err := s.AuthorizeSession(ctx, &pbs.AuthorizeSessionRequest{ Id: tar.GetPublicId(), })