test(coderd): close metricscache and avoid background context (#7996)

This commit is contained in:
Mathias Fredriksson
2023-06-13 20:18:31 +03:00
committed by GitHub
parent 2e7e99b135
commit 51226c55ab
6 changed files with 33 additions and 7 deletions

View File

@ -12,7 +12,6 @@ import (
"github.com/golang-jwt/jwt/v4"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/coder/coder/coderd/coderdtest"
@ -58,6 +57,8 @@ func New(t *testing.T, options *Options) *codersdk.Client {
}
func NewWithAPI(t *testing.T, options *Options) (*codersdk.Client, io.Closer, *coderd.API) {
t.Helper()
if options == nil {
options = &Options{}
}
@ -77,7 +78,7 @@ func NewWithAPI(t *testing.T, options *Options) (*codersdk.Client, io.Closer, *c
Keys: Keys,
ProxyHealthInterval: options.ProxyHealthInterval,
})
assert.NoError(t, err)
require.NoError(t, err)
setHandler(coderAPI.AGPL.RootHandler)
var provisionerCloser io.Closer = nopcloser{}
if options.IncludeProvisionerDaemon {