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

Function TestCommand_Run_failInvalidRef

internal/util/update/update_test.go:637–667  ·  view source on GitHub ↗

TestCommand_Run_failInvalidRef verifies Run fails if the ref is invalid

(t *testing.T)

Source from the content-addressed store, hash-verified

635
636// TestCommand_Run_failInvalidRef verifies Run fails if the ref is invalid
637func 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
669func TestCommand_Run_badStrategy(t *testing.T) {
670 strategy := StrategyType("foo")

Callers

nothing calls this directly

Calls 6

CleanMethod · 0.95
InitMethod · 0.95
AssertLocalDataEqualsMethod · 0.95
toAbsPathFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected