Skip to content

Commit 97699e9

Browse files
authored
fix: Rename NewMemoryCoderd to NewWithServer (#1571)
This name felt invalid, because `New` was also in memory.
1 parent 2638c27 commit 97699e9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

coderd/coderd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
3535
t.Parallel()
3636

3737
authorizer := &fakeAuthorizer{}
38-
srv, client := coderdtest.NewMemoryCoderd(t, &coderdtest.Options{
38+
srv, client := coderdtest.NewWithServer(t, &coderdtest.Options{
3939
Authorizer: authorizer,
4040
})
4141
admin := coderdtest.CreateFirstUser(t, client)

coderd/coderdtest/coderdtest.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ type Options struct {
6767

6868
// New constructs an in-memory coderd instance and returns
6969
// the connected client.
70-
func NewMemoryCoderd(t *testing.T, options *Options) (*httptest.Server, *codersdk.Client) {
70+
func New(t *testing.T, options *Options) *codersdk.Client {
71+
_, cli := NewWithServer(t, options)
72+
return cli
73+
}
74+
75+
// NewWithServer returns an in-memory coderd instance and
76+
// the HTTP server it started with.
77+
func NewWithServer(t *testing.T, options *Options) (*httptest.Server, *codersdk.Client) {
7178
if options == nil {
7279
options = &Options{}
7380
}
@@ -160,13 +167,6 @@ func NewMemoryCoderd(t *testing.T, options *Options) (*httptest.Server, *codersd
160167
return srv, codersdk.New(serverURL)
161168
}
162169

163-
// New constructs an in-memory coderd instance and returns
164-
// the connected client.
165-
func New(t *testing.T, options *Options) *codersdk.Client {
166-
_, cli := NewMemoryCoderd(t, options)
167-
return cli
168-
}
169-
170170
// NewProvisionerDaemon launches a provisionerd instance configured to work
171171
// well with coderd testing. It registers the "echo" provisioner for
172172
// quick testing.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy