fix: Rename NewMemoryCoderd to NewWithServer (#1571)

This name felt invalid, because `New` was also in memory.
This commit is contained in:
Kyle Carberry
2022-05-18 15:49:46 -05:00
committed by GitHub
parent 2638c274cb
commit 97699e9704
2 changed files with 9 additions and 9 deletions

View File

@ -67,7 +67,14 @@ type Options struct {
// New constructs an in-memory coderd instance and returns
// the connected client.
func NewMemoryCoderd(t *testing.T, options *Options) (*httptest.Server, *codersdk.Client) {
func New(t *testing.T, options *Options) *codersdk.Client {
_, cli := NewWithServer(t, options)
return cli
}
// NewWithServer returns an in-memory coderd instance and
// the HTTP server it started with.
func NewWithServer(t *testing.T, options *Options) (*httptest.Server, *codersdk.Client) {
if options == nil {
options = &Options{}
}
@ -160,13 +167,6 @@ func NewMemoryCoderd(t *testing.T, options *Options) (*httptest.Server, *codersd
return srv, codersdk.New(serverURL)
}
// New constructs an in-memory coderd instance and returns
// the connected client.
func New(t *testing.T, options *Options) *codersdk.Client {
_, cli := NewMemoryCoderd(t, options)
return cli
}
// NewProvisionerDaemon launches a provisionerd instance configured to work
// well with coderd testing. It registers the "echo" provisioner for
// quick testing.