Skip to content

Commit ed7e0e8

Browse files
committed
add a comment to dissuade exposing API
1 parent b198609 commit ed7e0e8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

coderd/coderdtest/coderdtest.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type Options struct {
7474

7575
// New constructs a codersdk client connected to an in-memory API instance.
7676
func New(t *testing.T, options *Options) *codersdk.Client {
77-
client, _ := newWithAPI(t, options)
77+
client, _ := newWithCloser(t, options)
7878
return client
7979
}
8080

@@ -87,13 +87,18 @@ func NewWithProvisionerCloser(t *testing.T, options *Options) (*codersdk.Client,
8787
options = &Options{}
8888
}
8989
options.IncludeProvisionerD = true
90-
client, close := newWithAPI(t, options)
90+
client, close := newWithCloser(t, options)
9191
return client, close
9292
}
9393

94-
// newWithAPI constructs a codersdk client connected to an in-memory API instance.
94+
// newWithCloser constructs a codersdk client connected to an in-memory API instance.
9595
// The returned closer closes a provisioner if it was provided
96-
func newWithAPI(t *testing.T, options *Options) (*codersdk.Client, io.Closer) {
96+
// The API is intentionally not returned here because coderd tests should not
97+
// require a handle to the API. Do not expose the API or wrath shall descend
98+
// upon thee. Even the io.Closer that is exposed here shouldn't be exposed
99+
// and is a temporary measure while the API to register provisioners is ironed
100+
// out.
101+
func newWithCloser(t *testing.T, options *Options) (*codersdk.Client, io.Closer) {
97102
if options == nil {
98103
options = &Options{}
99104
}

0 commit comments

Comments
 (0)