(t *testing.T)
| 130 | } |
| 131 | |
| 132 | func TestLoadConfigFromPath_ConfigFileUnreadable(t *testing.T) { |
| 133 | dir := testutil.TempDir(t) |
| 134 | configContent := `main: |
| 135 | ports: ["22"] |
| 136 | users: ["root"] |
| 137 | passwords: [] |
| 138 | keys: [] |
| 139 | ` |
| 140 | configPath := testutil.CreateTestConfigFile(t, dir, configContent) |
| 141 | knownHostsPath := filepath.Join(dir, "known_hosts") |
| 142 | |
| 143 | // Remove read permission |
| 144 | err := os.Chmod(configPath, 0000) |
| 145 | assert.NoError(t, err) |
| 146 | defer os.Chmod(configPath, 0644) |
| 147 | |
| 148 | conf, err := LoadConfigFromPath(configPath, knownHostsPath) |
| 149 | assert.Error(t, err) |
| 150 | assert.Nil(t, conf) |
| 151 | assert.Contains(t, err.Error(), "load failed") |
| 152 | } |
| 153 | |
| 154 | func TestUpdateConfigAtPath(t *testing.T) { |
| 155 | dir := testutil.TempDir(t) |
nothing calls this directly
no test coverage detected