TestCommand_Run_failInvalidRef verifies Run fails if the ref is invalid
(t *testing.T)
| 635 | |
| 636 | // TestCommand_Run_failInvalidRef verifies Run fails if the ref is invalid |
| 637 | func TestCommand_Run_failInvalidRef(t *testing.T) { |
| 638 | for i := range updateStrategies { |
| 639 | strategy := updateStrategies[i] |
| 640 | t.Run(string(strategy), func(t *testing.T) { |
| 641 | g := &testutil.TestSetupManager{ |
| 642 | T: t, |
| 643 | // Update upstream to Dataset2 |
| 644 | UpstreamChanges: []testutil.Content{{Data: testutil.Dataset2}}, |
| 645 | } |
| 646 | defer g.Clean() |
| 647 | if !g.Init(testutil.Dataset1) { |
| 648 | return |
| 649 | } |
| 650 | |
| 651 | err := Command{ |
| 652 | Path: g.UpstreamRepo.RepoName, |
| 653 | FullPackagePath: toAbsPath(t, g.UpstreamRepo.RepoName), |
| 654 | Ref: "exp", |
| 655 | Strategy: strategy, |
| 656 | }.Run() |
| 657 | if !assert.Error(t, err) { |
| 658 | return |
| 659 | } |
| 660 | assert.Contains(t, err.Error(), "failed to clone git repo") |
| 661 | |
| 662 | if !g.AssertLocalDataEquals(testutil.Dataset1) { |
| 663 | return |
| 664 | } |
| 665 | }) |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | func TestCommand_Run_badStrategy(t *testing.T) { |
| 670 | strategy := StrategyType("foo") |