| 216 | } |
| 217 | |
| 218 | func TestCommand_Run_noAdd(t *testing.T) { |
| 219 | strategies := append([]StrategyType{Default}, updateStrategies...) |
| 220 | for i := range strategies { |
| 221 | strategy := strategies[i] |
| 222 | t.Run(string(strategy), func(t *testing.T) { |
| 223 | // Setup the test upstream and local packages |
| 224 | g := &testutil.TestSetupManager{ |
| 225 | T: t, |
| 226 | } |
| 227 | defer g.Clean() |
| 228 | if !g.Init(testutil.Dataset1) { |
| 229 | return |
| 230 | } |
| 231 | |
| 232 | // don't add the data |
| 233 | err := ioutil.WriteFile( |
| 234 | filepath.Join(g.LocalWorkspace.WorkspaceDirectory, g.UpstreamRepo.RepoName, "java", "added-file"), []byte(`hello`), |
| 235 | 0600) |
| 236 | if !assert.NoError(t, err) { |
| 237 | return |
| 238 | } |
| 239 | |
| 240 | // Update the local package |
| 241 | err = Command{ |
| 242 | Path: g.UpstreamRepo.RepoName, |
| 243 | FullPackagePath: toAbsPath(t, g.UpstreamRepo.RepoName), |
| 244 | Strategy: strategy, |
| 245 | }.Run() |
| 246 | if !assert.Error(t, err) { |
| 247 | return |
| 248 | } |
| 249 | assert.Contains(t, err.Error(), "must commit package") |
| 250 | }) |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | // TestCommand_Run_localPackageChanges updates a package that has been locally modified |
| 255 | // - Get a package using a branch ref |