mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore: remove unnecessary redeclarations in for loops (#18440)
This commit is contained in:
@ -130,7 +130,6 @@ func TestAgent_Stats_SSH(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, port := range sshPorts {
|
||||
port := port
|
||||
t.Run(fmt.Sprintf("(:%d)", port), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -342,7 +341,6 @@ func TestAgent_SessionExec(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, port := range sshPorts {
|
||||
port := port
|
||||
t.Run(fmt.Sprintf("(:%d)", port), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -468,7 +466,6 @@ func TestAgent_SessionTTYShell(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, port := range sshPorts {
|
||||
port := port
|
||||
t.Run(fmt.Sprintf("(%d)", port), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -611,7 +608,6 @@ func TestAgent_Session_TTY_MOTD(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
session := setupSSHSession(t, test.manifest, test.banner, func(fs afero.Fs) {
|
||||
@ -688,8 +684,6 @@ func TestAgent_Session_TTY_MOTD_Update(t *testing.T) {
|
||||
|
||||
//nolint:paralleltest // These tests need to swap the banner func.
|
||||
for _, port := range sshPorts {
|
||||
port := port
|
||||
|
||||
sshClient, err := conn.SSHClientOnPort(ctx, port)
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() {
|
||||
@ -697,7 +691,6 @@ func TestAgent_Session_TTY_MOTD_Update(t *testing.T) {
|
||||
})
|
||||
|
||||
for i, test := range tests {
|
||||
test := test
|
||||
t.Run(fmt.Sprintf("(:%d)/%d", port, i), func(t *testing.T) {
|
||||
// Set new banner func and wait for the agent to call it to update the
|
||||
// banner.
|
||||
@ -1210,7 +1203,6 @@ func TestAgent_CoderEnvVars(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for _, key := range []string{"CODER", "CODER_WORKSPACE_NAME", "CODER_WORKSPACE_OWNER_NAME", "CODER_WORKSPACE_AGENT_NAME"} {
|
||||
key := key
|
||||
t.Run(key, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1233,7 +1225,6 @@ func TestAgent_SSHConnectionEnvVars(t *testing.T) {
|
||||
// For some reason this test produces a TTY locally and a non-TTY in CI
|
||||
// so we don't test for the absence of SSH_TTY.
|
||||
for _, key := range []string{"SSH_CONNECTION", "SSH_CLIENT"} {
|
||||
key := key
|
||||
t.Run(key, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1276,7 +1267,6 @@ func TestAgent_SSHConnectionLoginVars(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.key, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@ -1796,7 +1786,6 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
|
||||
t.Setenv("LANG", "C")
|
||||
|
||||
for _, backendType := range backends {
|
||||
backendType := backendType
|
||||
t.Run(backendType, func(t *testing.T) {
|
||||
if backendType == "Screen" {
|
||||
if runtime.GOOS != "linux" {
|
||||
@ -2496,7 +2485,6 @@ func TestAgent_Dial(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
c := c
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
Reference in New Issue
Block a user