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

Commite162ec9

Browse files
committed
fix test
1 parent55cda77 commite162ec9

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

‎cli/cliui/agent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,11 @@ func (d ConnDiags) splitDiagnostics() (general, client, agent []string) {
441441
}
442442
}
443443

444-
iftrue {
444+
ifd.ClientIPIsAWS {
445445
client=append(client,"Client IP address is within an AWS range (AWS uses hard NAT)")
446446
}
447447

448-
iftrue {
448+
ifd.AgentIPIsAWS {
449449
agent=append(agent,"Agent IP address is within an AWS range (AWS uses hard NAT)")
450450
}
451451
returngeneral,client,agent

‎cli/ping.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ func (r *RootCmd) ping() *serpent.Command {
148148
break
149149
}
150150
}
151-
ctx,cancel=context.WithTimeout(inv.Context(),30*time.Second)
152-
defercancel()
151+
diagCtx,diagCancel:=context.WithTimeout(inv.Context(),30*time.Second)
152+
deferdiagCancel()
153153
diags:=conn.GetPeerDiagnostics()
154154
cliui.PeerDiagnostics(inv.Stdout,diags)
155155

@@ -161,14 +161,14 @@ func (r *RootCmd) ping() *serpent.Command {
161161
Verbose:r.verbose,
162162
}
163163

164-
awsRanges,err:=cliutil.FetchAWSIPRanges(ctx,cliutil.AWSIPRangesURL)
164+
awsRanges,err:=cliutil.FetchAWSIPRanges(diagCtx,cliutil.AWSIPRangesURL)
165165
iferr!=nil {
166166
opts.Logger.Debug(inv.Context(),"failed to retrieve AWS IP ranges",slog.Error(err))
167167
}
168168

169169
connDiags.ClientIPIsAWS=isAWSIP(awsRanges,ni)
170170

171-
connInfo,err:=client.AgentConnectionInfoGeneric(ctx)
171+
connInfo,err:=client.AgentConnectionInfoGeneric(diagCtx)
172172
iferr!=nil||connInfo.DERPMap==nil {
173173
returnxerrors.Errorf("Failed to retrieve connection info from server: %v\n",err)
174174
}
@@ -180,7 +180,7 @@ func (r *RootCmd) ping() *serpent.Command {
180180
_,_=fmt.Fprintf(inv.Stdout,"Failed to retrieve local interfaces report: %v\n",err)
181181
}
182182

183-
agentNetcheck,err:=conn.Netcheck(ctx)
183+
agentNetcheck,err:=conn.Netcheck(diagCtx)
184184
iferr==nil {
185185
connDiags.AgentNetcheck=&agentNetcheck
186186
connDiags.AgentIPIsAWS=isAWSIP(awsRanges,agentNetcheck.NetInfo)

‎cli/ping_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func TestPing(t *testing.T) {
3939
})
4040

4141
pty.ExpectMatch("pong from "+workspace.Name)
42-
cancel()
4342
<-cmdDone
4443
})
4544

@@ -67,7 +66,6 @@ func TestPing(t *testing.T) {
6766

6867
pty.ExpectMatch("pong from "+workspace.Name)
6968
pty.ExpectMatch("✔ received remote agent data from Coder networking coordinator")
70-
cancel()
7169
<-cmdDone
7270
})
7371
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp