mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-22 05:36:15 +01:00
test: update tests that use os.Setenv to t.Setenv
This commit is contained in:
@@ -898,12 +898,8 @@ func TestAgentWebSocketIntegration(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Set up environment variables for the agent
|
||||
os.Setenv("BESZEL_AGENT_HUB_URL", ts.URL)
|
||||
os.Setenv("BESZEL_AGENT_TOKEN", tc.agentToken)
|
||||
defer func() {
|
||||
os.Unsetenv("BESZEL_AGENT_HUB_URL")
|
||||
os.Unsetenv("BESZEL_AGENT_TOKEN")
|
||||
}()
|
||||
t.Setenv("BESZEL_AGENT_HUB_URL", ts.URL)
|
||||
t.Setenv("BESZEL_AGENT_TOKEN", tc.agentToken)
|
||||
|
||||
// Start agent in background
|
||||
done := make(chan error, 1)
|
||||
@@ -1081,12 +1077,8 @@ func TestMultipleSystemsWithSameUniversalToken(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Set up environment variables for the agent
|
||||
os.Setenv("BESZEL_AGENT_HUB_URL", ts.URL)
|
||||
os.Setenv("BESZEL_AGENT_TOKEN", universalToken)
|
||||
defer func() {
|
||||
os.Unsetenv("BESZEL_AGENT_HUB_URL")
|
||||
os.Unsetenv("BESZEL_AGENT_TOKEN")
|
||||
}()
|
||||
t.Setenv("BESZEL_AGENT_HUB_URL", ts.URL)
|
||||
t.Setenv("BESZEL_AGENT_TOKEN", universalToken)
|
||||
|
||||
// Count systems before connection
|
||||
systemsBefore, err := testApp.FindRecordsByFilter("systems", "users ~ {:userId}", "", -1, 0, map[string]any{"userId": userRecord.Id})
|
||||
@@ -1244,12 +1236,8 @@ func TestPermanentUniversalTokenFromDB(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Set up environment variables for the agent
|
||||
os.Setenv("BESZEL_AGENT_HUB_URL", ts.URL)
|
||||
os.Setenv("BESZEL_AGENT_TOKEN", universalToken)
|
||||
defer func() {
|
||||
os.Unsetenv("BESZEL_AGENT_HUB_URL")
|
||||
os.Unsetenv("BESZEL_AGENT_TOKEN")
|
||||
}()
|
||||
t.Setenv("BESZEL_AGENT_HUB_URL", ts.URL)
|
||||
t.Setenv("BESZEL_AGENT_TOKEN", universalToken)
|
||||
|
||||
// Start agent in background
|
||||
done := make(chan error, 1)
|
||||
|
||||
Reference in New Issue
Block a user