Skip to content

Commit b1805a2

Browse files
committed
fixup! disable wireguard on agent tests
1 parent ccd4217 commit b1805a2

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

cli/agent.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ import (
2727

2828
func workspaceAgent() *cobra.Command {
2929
var (
30-
auth string
31-
pprofEnabled bool
32-
pprofAddress string
33-
noReap bool
34-
disableWireguard bool
30+
auth string
31+
pprofEnabled bool
32+
pprofAddress string
33+
noReap bool
34+
wireguard bool
3535
)
3636
cmd := &cobra.Command{
3737
Use: "agent",
@@ -170,14 +170,16 @@ func workspaceAgent() *cobra.Command {
170170
return xerrors.Errorf("add executable to $PATH: %w", err)
171171
}
172172

173+
fmt.Println("enable wireguard", wireguard)
174+
173175
closer := agent.New(client.ListenWorkspaceAgent, &agent.Options{
174176
Logger: logger,
175177
EnvironmentVariables: map[string]string{
176178
// Override the "CODER_AGENT_TOKEN" variable in all
177179
// shells so "gitssh" works!
178180
"CODER_AGENT_TOKEN": client.SessionToken,
179181
},
180-
EnableWireguard: !disableWireguard,
182+
EnableWireguard: wireguard,
181183
PostPublicKeys: client.PostWorkspaceAgentKeys,
182184
ListenWireguardPeers: client.WireguardPeerListener,
183185
})
@@ -190,6 +192,6 @@ func workspaceAgent() *cobra.Command {
190192
cliflag.BoolVarP(cmd.Flags(), &pprofEnabled, "pprof-enable", "", "CODER_AGENT_PPROF_ENABLE", false, "Enable serving pprof metrics on the address defined by --pprof-address.")
191193
cliflag.BoolVarP(cmd.Flags(), &noReap, "no-reap", "", "", false, "Do not start a process reaper.")
192194
cliflag.StringVarP(cmd.Flags(), &pprofAddress, "pprof-address", "", "CODER_AGENT_PPROF_ADDRESS", "127.0.0.1:6060", "The address to serve pprof.")
193-
cliflag.BoolVarP(cmd.Flags(), &disableWireguard, "disable-wireguard", "", "", false, "Disable creating a wireguard interface.")
195+
cliflag.BoolVarP(cmd.Flags(), &wireguard, "wireguard", "", "CODER_AGENT_WIREGUARD", true, "Whether to start the Wireguard interface.")
194196
return cmd
195197
}

cli/agent_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestWorkspaceAgent(t *testing.T) {
4646
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
4747
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
4848

49-
cmd, _ := clitest.New(t, "agent", "--auth", "azure-instance-identity", "--agent-url", client.URL.String(), "--disable-wireguard")
49+
cmd, _ := clitest.New(t, "agent", "--auth", "azure-instance-identity", "--agent-url", client.URL.String(), "--wireguard=false")
5050
ctx, cancelFunc := context.WithCancel(context.Background())
5151
defer cancelFunc()
5252
errC := make(chan error)
@@ -101,7 +101,7 @@ func TestWorkspaceAgent(t *testing.T) {
101101
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
102102
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
103103

104-
cmd, _ := clitest.New(t, "agent", "--auth", "aws-instance-identity", "--agent-url", client.URL.String(), "--disable-wireguard")
104+
cmd, _ := clitest.New(t, "agent", "--auth", "aws-instance-identity", "--agent-url", client.URL.String(), "--wireguard=false")
105105
ctx, cancelFunc := context.WithCancel(context.Background())
106106
defer cancelFunc()
107107
errC := make(chan error)
@@ -156,7 +156,7 @@ func TestWorkspaceAgent(t *testing.T) {
156156
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
157157
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
158158

159-
cmd, _ := clitest.New(t, "agent", "--auth", "google-instance-identity", "--agent-url", client.URL.String(), "--disable-wireguard")
159+
cmd, _ := clitest.New(t, "agent", "--auth", "google-instance-identity", "--agent-url", client.URL.String(), "--wireguard=false")
160160
ctx, cancelFunc := context.WithCancel(context.Background())
161161
defer cancelFunc()
162162
errC := make(chan error)

0 commit comments

Comments
 (0)