瀏覽代碼

Merge pull request #4331 from dhiltgen/fix_unit

Fix envconfig unit test
Daniel Hiltgen 11 月之前
父節點
當前提交
c60a086635
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      server/envconfig/config_test.go

+ 4 - 4
server/envconfig/config_test.go

@@ -1,20 +1,20 @@
 package envconfig
 
 import (
-	"os"
 	"testing"
 
 	"github.com/stretchr/testify/require"
 )
 
 func TestConfig(t *testing.T) {
-	os.Setenv("OLLAMA_DEBUG", "")
+	Debug = false // Reset whatever was loaded in init()
+	t.Setenv("OLLAMA_DEBUG", "")
 	LoadConfig()
 	require.False(t, Debug)
-	os.Setenv("OLLAMA_DEBUG", "false")
+	t.Setenv("OLLAMA_DEBUG", "false")
 	LoadConfig()
 	require.False(t, Debug)
-	os.Setenv("OLLAMA_DEBUG", "1")
+	t.Setenv("OLLAMA_DEBUG", "1")
 	LoadConfig()
 	require.True(t, Debug)
 }