Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed70004

Browse files
committed
add a comment to dissuade exposing API
1 parent 77e3844 commit ed70004

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
@@ -76,7 +76,7 @@ type Options struct {
7676

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

@@ -89,13 +89,18 @@ func NewWithProvisionerCloser(t *testing.T, options *Options) (*codersdk.Client,
8989
options = &Options{}
9090
}
9191
options.IncludeProvisionerD = true
92-
client, close := newWithAPI(t, options)
92+
client, close := newWithCloser(t, options)
9393
return client, close
9494
}
9595

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

0 commit comments

Comments
 (0)