From f93e987153d0a0a32e8432168c33d6a401bb43a8 Mon Sep 17 00:00:00 2001 From: Sas Swart Date: Wed, 21 May 2025 07:59:42 +0000 Subject: [PATCH 1/2] make TestReinitializeAgent work on Windows --- enterprise/coderd/workspaceagents_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/enterprise/coderd/workspaceagents_test.go b/enterprise/coderd/workspaceagents_test.go index 44aba69b9ffaa..d6f00595ec20c 100644 --- a/enterprise/coderd/workspaceagents_test.go +++ b/enterprise/coderd/workspaceagents_test.go @@ -7,6 +7,7 @@ import ( "net/http" "os" "regexp" + "runtime" "testing" "time" @@ -89,6 +90,13 @@ func TestReinitializeAgent(t *testing.T) { t.Skip("dbmem cannot currently claim a workspace") } + var startupScript string + if runtime.GOOS == "windows" { + startupScript = fmt.Sprintf("cmd.exe /c set >> \"%s\" && echo --- >> \"%s\"", tempAgentLog.Name(), tempAgentLog.Name()) + } else { + startupScript = fmt.Sprintf("printenv >> %s; echo '---\n' >> %s", tempAgentLog.Name(), tempAgentLog.Name()) + } + db, ps := dbtestutil.NewDB(t) // GIVEN a live enterprise API with the prebuilds feature enabled client, user := coderdenttest.New(t, &coderdenttest.Options{ @@ -155,7 +163,7 @@ func TestReinitializeAgent(t *testing.T) { Scripts: []*proto.Script{ { RunOnStart: true, - Script: fmt.Sprintf("printenv >> %s; echo '---\n' >> %s", tempAgentLog.Name(), tempAgentLog.Name()), // Make reinitialization take long enough to assert that it happened + Script: startupScript, }, }, Auth: &proto.Agent_Token{ From 4433d6a309e259fdd7c532cb6d6a18233c7e5f2c Mon Sep 17 00:00:00 2001 From: Sas Swart Date: Wed, 21 May 2025 11:00:46 +0000 Subject: [PATCH 2/2] fix: skip TestReinitializeAgent until we can adapt the script for windows --- enterprise/coderd/workspaceagents_test.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/enterprise/coderd/workspaceagents_test.go b/enterprise/coderd/workspaceagents_test.go index d6f00595ec20c..f0c9b37f3b2a3 100644 --- a/enterprise/coderd/workspaceagents_test.go +++ b/enterprise/coderd/workspaceagents_test.go @@ -90,13 +90,12 @@ func TestReinitializeAgent(t *testing.T) { t.Skip("dbmem cannot currently claim a workspace") } - var startupScript string if runtime.GOOS == "windows" { - startupScript = fmt.Sprintf("cmd.exe /c set >> \"%s\" && echo --- >> \"%s\"", tempAgentLog.Name(), tempAgentLog.Name()) - } else { - startupScript = fmt.Sprintf("printenv >> %s; echo '---\n' >> %s", tempAgentLog.Name(), tempAgentLog.Name()) + t.Skip("test startup script is not supported on windows") } + startupScript := fmt.Sprintf("printenv >> %s; echo '---\n' >> %s", tempAgentLog.Name(), tempAgentLog.Name()) + db, ps := dbtestutil.NewDB(t) // GIVEN a live enterprise API with the prebuilds feature enabled client, user := coderdenttest.New(t, &coderdenttest.Options{ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy