Skip to content
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

feat: Add provisionerd service #127

Merged
merged 3 commits into from
Feb 1, 2022
Merged

feat: Add provisionerd service #127

merged 3 commits into from
Feb 1, 2022

Conversation

kylecarbs
Copy link
Member

This brings an async service that parses and
provisions to life! It's separated from coderd
intentionally to allow for simpler testing.

Integration with coderd will come in another PR!

@kylecarbs kylecarbs self-assigned this Feb 1, 2022
@codecov
Copy link

codecov bot commented Feb 1, 2022

Codecov Report

Merging #127 (ec865bb) into main (38867b0) will decrease coverage by 0.16%.
The diff coverage is 72.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #127      +/-   ##
==========================================
- Coverage   72.09%   71.92%   -0.17%     
==========================================
  Files          91       92       +1     
  Lines        3773     4168     +395     
  Branches       59       59              
==========================================
+ Hits         2720     2998     +278     
- Misses        832      927      +95     
- Partials      221      243      +22     
Flag Coverage Δ
unittest-go-macos-latest 68.25% <72.57%> (+0.25%) ⬆️
unittest-go-ubuntu-latest 70.09% <68.79%> (+0.12%) ⬆️
unittest-go-windows-latest 67.73% <71.86%> (+0.53%) ⬆️
unittest-js 74.72% <ø> (ø)
Impacted Files Coverage Δ
provisionersdk/serve.go 35.13% <13.33%> (-28.20%) ⬇️
provisionersdk/transport.go 52.77% <52.77%> (-19.45%) ⬇️
provisionerd/provisionerd.go 76.75% <76.75%> (ø)
peerbroker/listen.go 84.80% <100.00%> (ø)
peer/channel.go 84.75% <0.00%> (-2.44%) ⬇️
peer/conn.go 77.34% <0.00%> (-0.53%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 38867b0...ec865bb. Read the comment docs.

@kylecarbs kylecarbs force-pushed the provisionerd branch 3 times, most recently from fa0df57 to 0886db4 Compare February 1, 2022 15:34
This brings an async service that parses and
provisions to life! It's separated from coderd
intentionally to allow for simpler testing.

Integration with coderd will come in another PR!
completeChan := make(chan struct{})
closer := createProvisionerd(t, func(ctx context.Context) (proto.DRPCProvisionerDaemonClient, error) {
acquireJobAttempt := 0
return createProvisionerDaemonClient(t, provisionerDaemonTestServer{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that it is so easy to create testing dialers to control the acquire/create/update/cancel job behavior 👍

Comment on lines +87 to +89
var closer io.Closer
var closerMutex sync.Mutex
closerMutex.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that isn't obvious to me - why does this test require a mutex to protect the io.Closer?

It's not clear to me why we need to call closer.Close in both the provisioner and at the end of the test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The go data race was triggering on this, because technically in a perfect scenario it could call closer before it completed being defined.

Obviously the scheduler would make this essentially impossible, but the race detector is strict!

acquireJob: func(ctx context.Context, _ *proto.Empty) (*proto.AcquiredJob, error) {
return &proto.AcquiredJob{
JobId: "test",
Provisioner: "someprovisioner",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool that we can test actually sending stuff to a testing provisioner 👍

Copy link
Contributor

@bryphe-coder bryphe-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small question about one of the tests but otherwise looks good to me! Another big step forward for black triangle

@kylecarbs kylecarbs merged commit 3ba8242 into main Feb 1, 2022
@kylecarbs kylecarbs deleted the provisionerd branch February 1, 2022 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants