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

Commite2c9ab1

Browse files
committed
208 problems left...
* More stdio wiring
1 parentfe8830f commite2c9ab1

33 files changed

+162
-162
lines changed

‎cli/cliui/agent_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestAgent(t *testing.T) {
4646
},
4747
}
4848
cmd.SetOutput(ptty.Output())
49-
cmd.SetIn(ptty.Input())
49+
cmd.Stdin=ptty.Input()
5050
done:=make(chanstruct{})
5151
gofunc() {
5252
deferclose(done)
@@ -93,7 +93,7 @@ func TestAgent_TimeoutWithTroubleshootingURL(t *testing.T) {
9393
}
9494
ptty:=ptytest.New(t)
9595
cmd.SetOutput(ptty.Output())
96-
cmd.SetIn(ptty.Input())
96+
cmd.Stdin=ptty.Input()
9797
done:=make(chanerror,1)
9898
gofunc() {
9999
done<-cmd.WithContext(ctx).Run()
@@ -146,7 +146,7 @@ func TestAgent_StartupTimeout(t *testing.T) {
146146

147147
ptty:=ptytest.New(t)
148148
cmd.SetOutput(ptty.Output())
149-
cmd.SetIn(ptty.Input())
149+
cmd.Stdin=ptty.Input()
150150
done:=make(chanerror,1)
151151
gofunc() {
152152
done<-cmd.WithContext(ctx).Run()
@@ -204,7 +204,7 @@ func TestAgent_StartErrorExit(t *testing.T) {
204204

205205
ptty:=ptytest.New(t)
206206
cmd.SetOutput(ptty.Output())
207-
cmd.SetIn(ptty.Input())
207+
cmd.Stdin=ptty.Input()
208208
done:=make(chanerror,1)
209209
gofunc() {
210210
done<-cmd.WithContext(ctx).Run()
@@ -259,7 +259,7 @@ func TestAgent_NoWait(t *testing.T) {
259259

260260
ptty:=ptytest.New(t)
261261
cmd.SetOutput(ptty.Output())
262-
cmd.SetIn(ptty.Input())
262+
cmd.Stdin=ptty.Input()
263263
done:=make(chanerror,1)
264264
gofunc() {
265265
done<-cmd.WithContext(ctx).Run()
@@ -328,7 +328,7 @@ func TestAgent_LoginBeforeReadyEnabled(t *testing.T) {
328328

329329
ptty:=ptytest.New(t)
330330
cmd.SetOutput(ptty.Output())
331-
cmd.SetIn(ptty.Input())
331+
cmd.Stdin=ptty.Input()
332332
done:=make(chanerror,1)
333333
gofunc() {
334334
done<-cmd.WithContext(ctx).Run()

‎cli/cliui/gitauth_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestGitAuth(t *testing.T) {
4141
},
4242
}
4343
cmd.SetOutput(ptty.Output())
44-
cmd.SetIn(ptty.Input())
44+
cmd.Stdin=ptty.Input()
4545
done:=make(chanstruct{})
4646
gofunc() {
4747
deferclose(done)

‎cli/cliui/prompt_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ func newPrompt(ptty *ptytest.PTY, opts cliui.PromptOptions, cmdOpt func(cmd *cob
158158
ifcmdOpt!=nil {
159159
cmdOpt(cmd)
160160
}
161-
cmd.SetOut(ptty.Output())
162-
cmd.SetErr(ptty.Output())
163-
cmd.SetIn(ptty.Input())
161+
cmd.Stdout=ptty.Output()
162+
cmd.Stderr=ptty.Output()
163+
cmd.Stdin=ptty.Input()
164164
returnvalue,cmd.RunContext(context.Background())
165165
}
166166

‎cli/cliui/provisionerjob_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func newProvisionerJob(t *testing.T) provisionerJobTest {
147147
}
148148
ptty:=ptytest.New(t)
149149
cmd.SetOutput(ptty.Output())
150-
cmd.SetIn(ptty.Input())
150+
cmd.Stdin=ptty.Input()
151151
done:=make(chanstruct{})
152152
gofunc() {
153153
deferclose(done)

‎cli/cliui/select_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func newSelect(ptty *ptytest.PTY, opts cliui.SelectOptions) (string, error) {
4040
},
4141
}
4242
cmd.SetOutput(ptty.Output())
43-
cmd.SetIn(ptty.Input())
43+
cmd.Stdin=ptty.Input()
4444
returnvalue,cmd.RunContext(context.Background())
4545
}
4646

@@ -83,6 +83,6 @@ func newRichSelect(ptty *ptytest.PTY, opts cliui.RichSelectOptions) (string, err
8383
},
8484
}
8585
cmd.SetOutput(ptty.Output())
86-
cmd.SetIn(ptty.Input())
86+
cmd.Stdin=ptty.Input()
8787
returnvalue,cmd.RunContext(context.Background())
8888
}

‎cli/delete_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestDelete(t *testing.T) {
5959
pty:=ptytest.New(t)
6060
cmd.Stdin=pty.Input()
6161
cmd.Stdout=pty.Output()
62-
cmd.SetErr(pty.Output())
62+
cmd.Stderr=pty.Output()
6363
gofunc() {
6464
deferclose(doneChan)
6565
err:=cmd.Run()

‎cli/gitssh_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func TestGitSSH(t *testing.T) {
230230
// Test authentication via local private key.
231231
cmd,_:=clitest.New(t,cmdArgs...)
232232
cmd.Stdout=pty.Output()
233-
cmd.SetErr(pty.Output())
233+
cmd.Stderr=pty.Output()
234234
err=cmd.WithContext(ctx).Run()
235235
require.NoError(t,err)
236236
select {
@@ -247,7 +247,7 @@ func TestGitSSH(t *testing.T) {
247247
// With the local file deleted, the coder key should be used.
248248
cmd,_=clitest.New(t,cmdArgs...)
249249
cmd.Stdout=pty.Output()
250-
cmd.SetErr(pty.Output())
250+
cmd.Stderr=pty.Output()
251251
err=cmd.WithContext(ctx).Run()
252252
require.NoError(t,err)
253253
select {

‎cli/list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestList(t *testing.T) {
6464
defercancelFunc()
6565

6666
out:=bytes.NewBuffer(nil)
67-
cmd.SetOut(out)
67+
cmd.Stdout=out
6868
err:=cmd.WithContext(ctx).Run()
6969
require.NoError(t,err)
7070

‎cli/login_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ func TestLogin(t *testing.T) {
2020
t.Parallel()
2121
client:=coderdtest.New(t,nil)
2222
root,_:=clitest.New(t,"login",client.URL.String())
23-
err:=root.Execute()
23+
err:=root.Run()
2424
require.Error(t,err)
2525
})
2626

2727
t.Run("InitialUserBadLoginURL",func(t*testing.T) {
2828
t.Parallel()
2929
badLoginURL:="https://fcca2077f06e68aaf9"
3030
root,_:=clitest.New(t,"login",badLoginURL)
31-
err:=root.Execute()
31+
err:=root.Run()
3232
errMsg:=fmt.Sprintf("Failed to check server %q for first user, is the URL correct and is coder accessible from your browser?",badLoginURL)
3333
require.ErrorContains(t,err,errMsg)
3434
})
@@ -42,11 +42,11 @@ func TestLogin(t *testing.T) {
4242
doneChan:=make(chanstruct{})
4343
root,_:=clitest.New(t,"login","--force-tty",client.URL.String())
4444
pty:=ptytest.New(t)
45-
root.SetIn(pty.Input())
46-
root.SetOut(pty.Output())
45+
root.Stdin=pty.Input()
46+
root.Stdout=pty.Output()
4747
gofunc() {
4848
deferclose(doneChan)
49-
err:=root.Execute()
49+
err:=root.Run()
5050
assert.NoError(t,err)
5151
}()
5252

@@ -77,11 +77,11 @@ func TestLogin(t *testing.T) {
7777
doneChan:=make(chanstruct{})
7878
root,_:=clitest.New(t,"--url",client.URL.String(),"login","--force-tty")
7979
pty:=ptytest.New(t)
80-
root.SetIn(pty.Input())
81-
root.SetOut(pty.Output())
80+
root.Stdin=pty.Input()
81+
root.Stdout=pty.Output()
8282
gofunc() {
8383
deferclose(doneChan)
84-
err:=root.Execute()
84+
err:=root.Run()
8585
assert.NoError(t,err)
8686
}()
8787

@@ -109,11 +109,11 @@ func TestLogin(t *testing.T) {
109109
doneChan:=make(chanstruct{})
110110
root,_:=clitest.New(t,"login",client.URL.String(),"--first-user-username","testuser","--first-user-email","user@coder.com","--first-user-password","SomeSecurePassword!","--first-user-trial")
111111
pty:=ptytest.New(t)
112-
root.SetIn(pty.Input())
113-
root.SetOut(pty.Output())
112+
root.Stdin=pty.Input()
113+
root.Stdout=pty.Output()
114114
gofunc() {
115115
deferclose(doneChan)
116-
err:=root.Execute()
116+
err:=root.Run()
117117
assert.NoError(t,err)
118118
}()
119119
pty.ExpectMatch("Welcome to Coder")
@@ -131,11 +131,11 @@ func TestLogin(t *testing.T) {
131131
doneChan:=make(chanstruct{})
132132
root,_:=clitest.New(t,"login","--force-tty",client.URL.String())
133133
pty:=ptytest.New(t)
134-
root.SetIn(pty.Input())
135-
root.SetOut(pty.Output())
134+
root.Stdin=pty.Input()
135+
root.Stdout=pty.Output()
136136
gofunc() {
137137
deferclose(doneChan)
138-
err:=root.ExecuteContext(ctx)
138+
err:=root.WithContext(ctx).Run()
139139
assert.NoError(t,err)
140140
}()
141141

@@ -174,11 +174,11 @@ func TestLogin(t *testing.T) {
174174
doneChan:=make(chanstruct{})
175175
root,_:=clitest.New(t,"login","--force-tty",client.URL.String(),"--no-open")
176176
pty:=ptytest.New(t)
177-
root.SetIn(pty.Input())
178-
root.SetOut(pty.Output())
177+
root.Stdin=pty.Input()
178+
root.Stdout=pty.Output()
179179
gofunc() {
180180
deferclose(doneChan)
181-
err:=root.Execute()
181+
err:=root.Run()
182182
assert.NoError(t,err)
183183
}()
184184

@@ -198,11 +198,11 @@ func TestLogin(t *testing.T) {
198198
doneChan:=make(chanstruct{})
199199
root,_:=clitest.New(t,"login",client.URL.String(),"--no-open")
200200
pty:=ptytest.New(t)
201-
root.SetIn(pty.Input())
202-
root.SetOut(pty.Output())
201+
root.Stdin=pty.Input()
202+
root.Stdout=pty.Output()
203203
gofunc() {
204204
deferclose(doneChan)
205-
err:=root.ExecuteContext(ctx)
205+
err:=root.WithContext(ctx).Run()
206206
// An error is expected in this case, since the login wasn't successful:
207207
assert.Error(t,err)
208208
}()
@@ -219,7 +219,7 @@ func TestLogin(t *testing.T) {
219219
client:=coderdtest.New(t,nil)
220220
coderdtest.CreateFirstUser(t,client)
221221
root,cfg:=clitest.New(t,"login",client.URL.String(),"--token",client.SessionToken())
222-
err:=root.Execute()
222+
err:=root.Run()
223223
require.NoError(t,err)
224224
sessionFile,err:=cfg.Session().Read()
225225
require.NoError(t,err)

‎cli/logout_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ func TestLogout(t *testing.T) {
3030

3131
logoutChan:=make(chanstruct{})
3232
logout,_:=clitest.New(t,"logout","--global-config",string(config))
33-
logout.SetIn(pty.Input())
34-
logout.SetOut(pty.Output())
33+
logout.Stdin=pty.Input()
34+
logout.Stdout=pty.Output()
3535

3636
gofunc() {
3737
deferclose(logoutChan)
38-
err:=logout.Execute()
38+
err:=logout.Run()
3939
assert.NoError(t,err)
4040
assert.NoFileExists(t,string(config.URL()))
4141
assert.NoFileExists(t,string(config.Session()))
@@ -58,12 +58,12 @@ func TestLogout(t *testing.T) {
5858

5959
logoutChan:=make(chanstruct{})
6060
logout,_:=clitest.New(t,"logout","--global-config",string(config),"-y")
61-
logout.SetIn(pty.Input())
62-
logout.SetOut(pty.Output())
61+
logout.Stdin=pty.Input()
62+
logout.Stdout=pty.Output()
6363

6464
gofunc() {
6565
deferclose(logoutChan)
66-
err:=logout.Execute()
66+
err:=logout.Run()
6767
assert.NoError(t,err)
6868
assert.NoFileExists(t,string(config.URL()))
6969
assert.NoFileExists(t,string(config.Session()))
@@ -88,12 +88,12 @@ func TestLogout(t *testing.T) {
8888
logoutChan:=make(chanstruct{})
8989
logout,_:=clitest.New(t,"logout","--global-config",string(config))
9090

91-
logout.SetIn(pty.Input())
92-
logout.SetOut(pty.Output())
91+
logout.Stdin=pty.Input()
92+
logout.Stdout=pty.Output()
9393

9494
gofunc() {
9595
deferclose(logoutChan)
96-
err:=logout.Execute()
96+
err:=logout.Run()
9797
assert.EqualError(t,err,"You are not logged in. Try logging in using 'coder login <url>'.")
9898
}()
9999

@@ -115,12 +115,12 @@ func TestLogout(t *testing.T) {
115115
logoutChan:=make(chanstruct{})
116116
logout,_:=clitest.New(t,"logout","--global-config",string(config))
117117

118-
logout.SetIn(pty.Input())
119-
logout.SetOut(pty.Output())
118+
logout.Stdin=pty.Input()
119+
logout.Stdout=pty.Output()
120120

121121
gofunc() {
122122
deferclose(logoutChan)
123-
err=logout.Execute()
123+
err=logout.Run()
124124
assert.EqualError(t,err,"You are not logged in. Try logging in using 'coder login <url>'.")
125125
}()
126126

@@ -169,12 +169,12 @@ func TestLogout(t *testing.T) {
169169
logoutChan:=make(chanstruct{})
170170
logout,_:=clitest.New(t,"logout","--global-config",string(config))
171171

172-
logout.SetIn(pty.Input())
173-
logout.SetOut(pty.Output())
172+
logout.Stdin=pty.Input()
173+
logout.Stdout=pty.Output()
174174

175175
gofunc() {
176176
deferclose(logoutChan)
177-
err:=logout.Execute()
177+
err:=logout.Run()
178178
assert.NotNil(t,err)
179179
varerrorMessagestring
180180
ifruntime.GOOS=="windows" {
@@ -200,11 +200,11 @@ func login(t *testing.T, pty *ptytest.PTY) config.Root {
200200

201201
doneChan:=make(chanstruct{})
202202
root,cfg:=clitest.New(t,"login","--force-tty",client.URL.String(),"--no-open")
203-
root.SetIn(pty.Input())
204-
root.SetOut(pty.Output())
203+
root.Stdin=pty.Input()
204+
root.Stdout=pty.Output()
205205
gofunc() {
206206
deferclose(doneChan)
207-
err:=root.Execute()
207+
err:=root.Run()
208208
assert.NoError(t,err)
209209
}()
210210

‎cli/ping_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestPing(t *testing.T) {
2626
clitest.SetupConfig(t,client,root)
2727
pty:=ptytest.New(t)
2828
cmd.Stdin=pty.Input()
29-
cmd.SetErr(pty.Output())
29+
cmd.Stderr=pty.Output()
3030
cmd.Stdout=pty.Output()
3131

3232
agentClient:=agentsdk.New(client.URL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp