Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test(scaletest/createworkspaces): fix ctx init in multiple tests#16177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 1 commit intomainfrommafredri/test-fix-scaletest-workspaces
Jan 17, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletionsscaletest/createworkspaces/run_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -52,9 +52,6 @@ func Test_Runner(t *testing.T) {
t.Run("OK", func(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()

client := coderdtest.New(t, &coderdtest.Options{
IncludeProvisionerDaemon: true,
})
Expand DownExpand Up@@ -109,6 +106,8 @@ func Test_Runner(t *testing.T) {
version = coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)

ctx := testutil.Context(t, testutil.WaitLong)

closerCh := goEventuallyStartFakeAgent(ctx, t, client, authToken)

const (
Expand DownExpand Up@@ -199,9 +198,6 @@ func Test_Runner(t *testing.T) {
t.Run("CleanupPendingBuild", func(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()

// need to include our own logger because the provisioner (rightly) drops error logs when we shut down the
// test with a build in progress.
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}).Leveled(slog.LevelDebug)
Expand DownExpand Up@@ -253,7 +249,9 @@ func Test_Runner(t *testing.T) {
},
})

ctx := testutil.Context(t, testutil.WaitLong)
cancelCtx, cancelFunc := context.WithCancel(ctx)

done := make(chan struct{})
logs := bytes.NewBuffer(nil)
go func() {
Expand DownExpand Up@@ -287,6 +285,8 @@ func Test_Runner(t *testing.T) {
cancelFunc()
<-done

ctx = testutil.Context(t, testutil.WaitLong) // Reset ctx to avoid timeouts.

// When we run the cleanup, it should be canceled
cleanupLogs := bytes.NewBuffer(nil)
cancelCtx, cancelFunc = context.WithCancel(ctx)
Expand DownExpand Up@@ -340,9 +340,6 @@ func Test_Runner(t *testing.T) {
t.Run("NoCleanup", func(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()

client := coderdtest.New(t, &coderdtest.Options{
IncludeProvisionerDaemon: true,
})
Expand DownExpand Up@@ -397,6 +394,7 @@ func Test_Runner(t *testing.T) {
version = coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)

ctx := testutil.Context(t, testutil.WaitLong)
closeCh := goEventuallyStartFakeAgent(ctx, t, client, authToken)

const (
Expand DownExpand Up@@ -484,9 +482,6 @@ func Test_Runner(t *testing.T) {
t.Run("FailedBuild", func(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()

logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
client := coderdtest.New(t, &coderdtest.Options{
IncludeProvisionerDaemon: true,
Expand DownExpand Up@@ -534,6 +529,8 @@ func Test_Runner(t *testing.T) {
},
})

ctx := testutil.Context(t, testutil.WaitLong)

logs := bytes.NewBuffer(nil)
err := runner.Run(ctx, "1", logs)
logsStr := logs.String()
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp