MCPcopy Index your code
hub / github.com/go-task/task / TestGetConfig_RemoteTrustedHosts

Function TestGetConfig_RemoteTrustedHosts

taskrc/taskrc_test.go:174–204  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

172}
173
174func TestGetConfig_RemoteTrustedHosts(t *testing.T) { //nolint:paralleltest // cannot run in parallel
175 _, _, localDir := setupDirs(t)
176
177 // Test with single host
178 configYAML := `
179remote:
180 trusted-hosts:
181 - github.com
182`
183 writeFile(t, localDir, ".taskrc.yml", configYAML)
184
185 cfg, err := GetConfig(localDir)
186 assert.NoError(t, err)
187 assert.NotNil(t, cfg)
188 assert.Equal(t, []string{"github.com"}, cfg.Remote.TrustedHosts)
189
190 // Test with multiple hosts
191 configYAML = `
192remote:
193 trusted-hosts:
194 - github.com
195 - gitlab.com
196 - example.com:8080
197`
198 writeFile(t, localDir, ".taskrc.yml", configYAML)
199
200 cfg, err = GetConfig(localDir)
201 assert.NoError(t, err)
202 assert.NotNil(t, cfg)
203 assert.Equal(t, []string{"github.com", "gitlab.com", "example.com:8080"}, cfg.Remote.TrustedHosts)
204}
205
206func TestGetConfig_RemoteTrustedHostsMerge(t *testing.T) { //nolint:paralleltest // cannot run in parallel
207 t.Run("file-based merge precedence", func(t *testing.T) { //nolint:paralleltest // parent test cannot run in parallel

Callers

nothing calls this directly

Calls 3

setupDirsFunction · 0.85
GetConfigFunction · 0.85
writeFileFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…