fix(cli)!: protect client Logger and refactor cli scaletest tests (#8317)

- (breaking) Protects Logger and LogBodies fields of codersdk.Client with its mutex. This addresses a data race in cli/scaletest.
- Fillets the existing cli/createworkspaces unit test and moves the testing logic there into the tests under scaletest/createworkspaces.
- Adds testutil.RaceEnabled bool const and conditionaly skips previously-skipped tests under scaletest/ if the race detector is enabled. This is unfortunate and sad, but I would prefer to have these tests at least running without the race detector than not running at all.
- Adds IgnoreErrors option to fake in-memory agent loggers; having the agents fail the test immediately when they encounter any sort of error isn't really helpful.
This commit is contained in:
Cian Johnston
2023-07-06 09:43:39 +01:00
committed by GitHub
parent 1d746b901b
commit 7fcf319e01
20 changed files with 309 additions and 254 deletions

View File

@ -8,6 +8,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/google/uuid"
"github.com/coder/coder/cli/clibase"
"github.com/coder/coder/coderd/coderdtest"
"github.com/coder/coder/codersdk"
@ -17,7 +19,6 @@ import (
"github.com/coder/coder/enterprise/coderd/license"
"github.com/coder/coder/provisioner/echo"
"github.com/coder/coder/testutil"
"github.com/google/uuid"
)
func TestServiceBanners(t *testing.T) {