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

Commit5830a76

Browse files
authored
Merge branch 'main' into kacpersaw/scaletest-smtp-mock-server
2 parentsae14c5d +6c5b741 commit5830a76

File tree

19 files changed

+391
-14
lines changed

19 files changed

+391
-14
lines changed

‎agent/agent_test.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1807,11 +1807,12 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
18071807

18081808
//nolint:dogsled
18091809
conn,agentClient,_,_,_:=setupAgent(t, agentsdk.Manifest{},0)
1810+
idConnectionReport:=uuid.New()
18101811
id:=uuid.New()
18111812

18121813
// Test that the connection is reported. This must be tested in the
18131814
// first connection because we care about verifying all of these.
1814-
netConn0,err:=conn.ReconnectingPTY(ctx,id,80,80,"bash --norc")
1815+
netConn0,err:=conn.ReconnectingPTY(ctx,idConnectionReport,80,80,"bash --norc")
18151816
require.NoError(t,err)
18161817
_=netConn0.Close()
18171818
assertConnectionReport(t,agentClient,proto.Connection_RECONNECTING_PTY,0,"")

‎agent/reconnectingpty/screen.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
// screenReconnectingPTY provides a reconnectable PTY via `screen`.
2727
typescreenReconnectingPTYstruct {
28+
logger slog.Logger
2829
execer agentexec.Execer
2930
command*pty.Cmd
3031

@@ -62,6 +63,7 @@ type screenReconnectingPTY struct {
6263
// own which causes it to spawn with the specified size.
6364
funcnewScreen(ctx context.Context,logger slog.Logger,execer agentexec.Execer,cmd*pty.Cmd,options*Options)*screenReconnectingPTY {
6465
rpty:=&screenReconnectingPTY{
66+
logger:logger,
6567
execer:execer,
6668
command:cmd,
6769
metrics:options.Metrics,
@@ -173,6 +175,7 @@ func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn ne
173175

174176
ptty,process,err:=rpty.doAttach(ctx,conn,height,width,logger)
175177
iferr!=nil {
178+
logger.Debug(ctx,"unable to attach to screen reconnecting pty",slog.Error(err))
176179
iferrors.Is(err,context.Canceled) {
177180
// Likely the process was too short-lived and canceled the version command.
178181
// TODO: Is it worth distinguishing between that and a cancel from the
@@ -182,6 +185,7 @@ func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn ne
182185
}
183186
returnerr
184187
}
188+
logger.Debug(ctx,"attached to screen reconnecting pty")
185189

186190
deferfunc() {
187191
// Log only for debugging since the process might have already exited on its
@@ -403,6 +407,7 @@ func (rpty *screenReconnectingPTY) Wait() {
403407
}
404408

405409
func (rpty*screenReconnectingPTY)Close(errerror) {
410+
rpty.logger.Debug(context.Background(),"closing screen reconnecting pty",slog.Error(err))
406411
// The closing state change will be handled by the lifecycle.
407412
rpty.state.setState(StateClosing,err)
408413
}

‎cli/exp_task_create.go‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@ func (r *RootCmd) taskCreate() *serpent.Command {
2929
cmd:=&serpent.Command{
3030
Use:"create [input]",
3131
Short:"Create an experimental task",
32+
Long:FormatExamples(
33+
Example{
34+
Description:"Create a task with direct input",
35+
Command:"coder exp task create\"Add authentication to the user service\"",
36+
},
37+
Example{
38+
Description:"Create a task with stdin input",
39+
Command:"echo\"Add authentication to the user service\" | coder exp task create",
40+
},
41+
Example{
42+
Description:"Create a task with a specific name",
43+
Command:"coder exp task create --name task1\"Add authentication to the user service\"",
44+
},
45+
Example{
46+
Description:"Create a task from a specific template / preset",
47+
Command:"coder exp task create --template backend-dev --preset\"My Preset\"\"Add authentication to the user service\"",
48+
},
49+
Example{
50+
Description:"Create a task for another user (requires appropriate permissions)",
51+
Command:"coder exp task create --owner user@example.com\"Add authentication to the user service\"",
52+
},
53+
),
3254
Middleware:serpent.Chain(
3355
serpent.RequireRangeArgs(0,1),
3456
),

‎cli/exp_task_delete.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ func (r *RootCmd) taskDelete() *serpent.Command {
1919
cmd:=&serpent.Command{
2020
Use:"delete <task> [<task> ...]",
2121
Short:"Delete experimental tasks",
22+
Long:FormatExamples(
23+
Example{
24+
Description:"Delete a single task.",
25+
Command:"$ coder exp task delete task1",
26+
},
27+
Example{
28+
Description:"Delete multiple tasks.",
29+
Command:"$ coder exp task delete task1 task2 task3",
30+
},
31+
Example{
32+
Description:"Delete a task without confirmation.",
33+
Command:"$ coder exp task delete task4 --yes",
34+
},
35+
),
2236
Middleware:serpent.Chain(
2337
serpent.RequireRangeArgs(1,-1),
2438
),

‎cli/exp_task_list.go‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,30 @@ func (r *RootCmd) taskList() *serpent.Command {
6767
)
6868

6969
cmd:=&serpent.Command{
70-
Use:"list",
71-
Short:"List experimental tasks",
70+
Use:"list",
71+
Short:"List experimental tasks",
72+
Long:FormatExamples(
73+
Example{
74+
Description:"List tasks for the current user.",
75+
Command:"coder exp task list",
76+
},
77+
Example{
78+
Description:"List tasks for a specific user.",
79+
Command:"coder exp task list --user someone-else",
80+
},
81+
Example{
82+
Description:"List all tasks you can view.",
83+
Command:"coder exp task list --all",
84+
},
85+
Example{
86+
Description:"List all your running tasks.",
87+
Command:"coder exp task list --status running",
88+
},
89+
Example{
90+
Description:"As above, but only show IDs.",
91+
Command:"coder exp task list --status running --quiet",
92+
},
93+
),
7294
Aliases: []string{"ls"},
7395
Middleware:serpent.Chain(
7496
serpent.RequireNArgs(0),

‎cli/exp_task_logs.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func (r *RootCmd) taskLogs() *serpent.Command {
2626
cmd:=&serpent.Command{
2727
Use:"logs <task>",
2828
Short:"Show a task's logs",
29+
Long:FormatExamples(
30+
Example{
31+
Description:"Show logs for a given task.",
32+
Command:"coder exp task logs task1",
33+
}),
2934
Middleware:serpent.Chain(
3035
serpent.RequireNArgs(1),
3136
),

‎cli/exp_task_send.go‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ func (r *RootCmd) taskSend() *serpent.Command {
1414
varstdinbool
1515

1616
cmd:=&serpent.Command{
17-
Use:"send <task> [<input> | --stdin]",
18-
Short:"Send input to a task",
17+
Use:"send <task> [<input> | --stdin]",
18+
Short:"Send input to a task",
19+
Long:FormatExamples(Example{
20+
Description:"Send direct input to a task.",
21+
Command:"coder exp task send task1\"Please also add unit tests\"",
22+
},Example{
23+
Description:"Send input from stdin to a task.",
24+
Command:"echo\"Please also add unit tests\" | coder exp task send task1 --stdin",
25+
}),
1926
Middleware:serpent.RequireRangeArgs(1,2),
2027
Options: serpent.OptionSet{
2128
{

‎cli/exp_task_status.go‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,17 @@ func (r *RootCmd) taskStatus() *serpent.Command {
4444
watchIntervalArg time.Duration
4545
)
4646
cmd:=&serpent.Command{
47-
Short:"Show the status of a task.",
47+
Short:"Show the status of a task.",
48+
Long:FormatExamples(
49+
Example{
50+
Description:"Show the status of a given task.",
51+
Command:"coder exp task status task1",
52+
},
53+
Example{
54+
Description:"Watch the status of a given task until it completes (idle or stopped).",
55+
Command:"coder exp task status task1 --watch",
56+
},
57+
),
4858
Use:"status",
4959
Aliases: []string{"stat"},
5060
Options: serpent.OptionSet{

‎coderd/database/dbtestutil/broker.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (b *Broker) init(t TBSubset) error {
150150
b.uuid=uuid.New()
151151
ctx,cancel:=context.WithTimeout(context.Background(),20*time.Second)
152152
defercancel()
153-
b.cleanerFD,err=startCleaner(ctx,b.uuid,coderTestingParams.DSN())
153+
b.cleanerFD,err=startCleaner(ctx,t,b.uuid,coderTestingParams.DSN())
154154
iferr!=nil {
155155
returnxerrors.Errorf("start test db cleaner: %w",err)
156156
}

‎coderd/database/dbtestutil/cleaner.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"io"
88
"os"
9-
"os/exec"
109
"os/signal"
1110
"time"
1211

@@ -39,8 +38,8 @@ func init() {
3938

4039
// startCleaner starts the cleaner in a subprocess. holdThis is an opaque reference that needs to be kept from being
4140
// garbage collected until we are done with all test databases (e.g. the end of the process).
42-
funcstartCleaner(ctx context.Context,parentUUID uuid.UUID,dsnstring) (holdThisany,errerror) {
43-
cmd:=exec.Command("go","run","github.com/coder/coder/v2/coderd/database/dbtestutil/cleanercmd")
41+
funcstartCleaner(ctx context.Context,tTBSubset,parentUUID uuid.UUID,dsnstring) (holdThisany,errerror) {
42+
cmd:=cleanerCmd(t)
4443
cmd.Env=append(os.Environ(),
4544
fmt.Sprintf("%s=%s",envCleanerParentUUID,parentUUID.String()),
4645
fmt.Sprintf("%s=%s",envCleanerDSN,dsn),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp