MCPcopy
hub / github.com/kptdev/kpt / TestCommand_Run_emitPatch

Function TestCommand_Run_emitPatch

internal/util/update/update_test.go:580–616  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

578}
579
580func 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
619func TestCommand_Run_failInvalidPath(t *testing.T) {

Callers

nothing calls this directly

Calls 7

CleanMethod · 0.95
InitMethod · 0.95
toAbsPathFunction · 0.85
NameMethod · 0.80
RemoveAllMethod · 0.45
RunMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected