| 172 | } |
| 173 | |
| 174 | func TestGetConfig_RemoteTrustedHosts(t *testing.T) { //nolint:paralleltest // cannot run in parallel |
| 175 | _, _, localDir := setupDirs(t) |
| 176 | |
| 177 | // Test with single host |
| 178 | configYAML := ` |
| 179 | remote: |
| 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 = ` |
| 192 | remote: |
| 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 | |
| 206 | func 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 |