| 578 | } |
| 579 | |
| 580 | func TestCommand_Run_emitPatch(t *testing.T) { |
| 581 | // Setup the test upstream and local packages |
| 582 | g := &testutil.TestSetupManager{ |
| 583 | T: t, |
| 584 | UpstreamChanges: []testutil.Content{{Data: testutil.Dataset2}}, |
| 585 | } |
| 586 | defer g.Clean() |
| 587 | if !g.Init(testutil.Dataset1) { |
| 588 | return |
| 589 | } |
| 590 | |
| 591 | f, err := ioutil.TempFile("", "*.patch") |
| 592 | if !assert.NoError(t, err) { |
| 593 | return |
| 594 | } |
| 595 | defer os.RemoveAll(f.Name()) |
| 596 | |
| 597 | // Update the local package |
| 598 | b := &bytes.Buffer{} |
| 599 | err = Command{ |
| 600 | Path: g.UpstreamRepo.RepoName, |
| 601 | FullPackagePath: toAbsPath(t, g.UpstreamRepo.RepoName), |
| 602 | Strategy: AlphaGitPatch, |
| 603 | DryRun: true, |
| 604 | Output: b, |
| 605 | }.Run() |
| 606 | if !assert.NoError(t, err) { |
| 607 | return |
| 608 | } |
| 609 | |
| 610 | assert.Contains(t, b.String(), `- initialDelaySeconds: 30 |
| 611 | - periodSeconds: 10 |
| 612 | + initialDelaySeconds: 45 |
| 613 | + periodSeconds: 15 |
| 614 | timeoutSeconds: 5 |
| 615 | `) |
| 616 | } |
| 617 | |
| 618 | // TestCommand_Run_failInvalidPath verifies Run fails if the path is invalid |
| 619 | func TestCommand_Run_failInvalidPath(t *testing.T) { |