88 "strings"
99 "testing"
1010
11+ "github.com/juanfont/headscale/cmd/headscale/cli"
1112 "github.com/spf13/viper"
1213 "gopkg.in/check.v1"
1314)
@@ -46,7 +47,7 @@ func (*Suite) TestPostgresConfigLoading(c *check.C) {
4647 }
4748
4849 // Load example config, it should load without validation errors
49- err = loadConfig (tmpDir )
50+ err = cli . LoadConfig (tmpDir )
5051 c .Assert (err , check .IsNil )
5152
5253 // Test that config file was interpreted correctly
@@ -78,7 +79,7 @@ func (*Suite) TestSqliteConfigLoading(c *check.C) {
7879 }
7980
8081 // Load example config, it should load without validation errors
81- err = loadConfig (tmpDir )
82+ err = cli . LoadConfig (tmpDir )
8283 c .Assert (err , check .IsNil )
8384
8485 // Test that config file was interpreted correctly
@@ -112,7 +113,7 @@ func (*Suite) TestTLSConfigValidation(c *check.C) {
112113 writeConfig (c , tmpDir , configYaml )
113114
114115 // Check configuration validation errors (1)
115- err = loadConfig (tmpDir )
116+ err = cli . LoadConfig (tmpDir )
116117 c .Assert (err , check .NotNil )
117118 // check.Matches can not handle multiline strings
118119 tmp := strings .ReplaceAll (err .Error (), "\n " , "***" )
@@ -124,7 +125,7 @@ func (*Suite) TestTLSConfigValidation(c *check.C) {
124125 // Check configuration validation errors (2)
125126 configYaml = []byte ("---\n server_url: \" http://127.0.0.1:8000\" \n tls_letsencrypt_hostname: \" example.com\" \n tls_letsencrypt_challenge_type: \" TLS-ALPN-01\" " )
126127 writeConfig (c , tmpDir , configYaml )
127- err = loadConfig (tmpDir )
128+ err = cli . LoadConfig (tmpDir )
128129 c .Assert (err , check .NotNil )
129130 c .Assert (err , check .ErrorMatches , "Fatal config error: when using tls_letsencrypt_hostname with TLS-ALPN-01 as challenge type, listen_addr must end in :443.*" )
130131}
0 commit comments