Skip to content

feat: integrate Acquirer for provisioner jobs #9717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' of https://github.com/coder/coder into spike/9428…
…-pt2-integrate-acquirer
  • Loading branch information
spikecurtis committed Sep 19, 2023
commit 27162b7f58b1e3976521d268792609946fa771f3
28 changes: 5 additions & 23 deletions provisionerd/provisionerd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestProvisionerd(t *testing.T) {
close(done)
})
closer := createProvisionerd(t, func(ctx context.Context) (proto.DRPCProvisionerDaemonClient, error) {
return createProvisionerDaemonClient(ctx, t, done, provisionerDaemonTestServer{}), nil
return createProvisionerDaemonClient(t, done, provisionerDaemonTestServer{}), nil
}, provisionerd.LocalProvisioners{})
require.NoError(t, closer.Close())
})
Expand Down Expand Up @@ -1086,7 +1086,7 @@ func createProvisionerd(t *testing.T, dialer provisionerd.Dialer, connector prov

// Creates a provisionerd protobuf client that's connected
// to the server implementation provided.
func createProvisionerDaemonClient(ctx context.Context, t *testing.T, done <-chan struct{}, server provisionerDaemonTestServer) proto.DRPCProvisionerDaemonClient {
func createProvisionerDaemonClient(t *testing.T, done <-chan struct{}, server provisionerDaemonTestServer) proto.DRPCProvisionerDaemonClient {
t.Helper()
if server.failJob == nil {
// Default to asserting the error from the failure, otherwise
Expand All @@ -1105,7 +1105,7 @@ func createProvisionerDaemonClient(ctx context.Context, t *testing.T, done <-cha
err := proto.DRPCRegisterProvisionerDaemon(mux, &server)
require.NoError(t, err)
srv := drpcserver.New(mux)
ctx, cancelFunc := context.WithCancel(ctx)
ctx, cancelFunc := context.WithCancel(context.Background())
closed := make(chan struct{})
go func() {
defer close(closed)
Expand All @@ -1116,31 +1116,13 @@ func createProvisionerDaemonClient(ctx context.Context, t *testing.T, done <-cha
<-closed
select {
case <-done:
// It's possible to get unlucky since the dialer is run in a retry in a goroutine.
// The following can occur:
// 1. The provisionerd.connect goroutine checks if we're closed prior to attempting to establish a connection
// with coderd, sees that we're not.
// 2. A test closes the server.
// 3. The provisionerd.connect goroutine calls the dialer to establish a connection. This
// function detects that someone has tried to create a client after the test finishes.
if ctx.Err() == nil {
t.Error("createProvisionerDaemonClient cleanup after test was done!")
}
t.Error("createProvisionerDaemonClient cleanup after test was done!")
default:
}
})
select {
case <-done:
// It's possible to get unlucky since the dialer is run in a retry in a goroutine.
// The following can occur:
// 1. The provisionerd.connect goroutine checks if we're closed prior to attempting to establish a connection
// with coderd, sees that we're not.
// 2. A test closes the server.
// 3. The provisionerd.connect goroutine calls the dialer to establish a connection. This
// function detects that someone has tried to create a client after the test finishes.
if ctx.Err() == nil {
t.Error("createProvisionerDaemonClient cleanup after test was done!")
}
t.Error("called createProvisionerDaemonClient after test was done!")
default:
}
return proto.NewDRPCProvisionerDaemonClient(clientPipe)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.