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

Function TestCommand_Run_subDir

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

Source from the content-addressed store, hash-verified

83}
84
85func TestCommand_Run_subDir(t *testing.T) {
86 for i := range updateStrategies {
87 strategy := updateStrategies[i]
88 t.Run(string(strategy), func(t *testing.T) {
89 // Setup the test upstream and local packages
90 g := &testutil.TestSetupManager{
91 T: t,
92 // Update upstream to Dataset2
93 UpstreamChanges: []testutil.Content{{Tag: "v1.2", Data: testutil.Dataset2}},
94 GetSubDirectory: "java",
95 }
96 defer g.Clean()
97 if !g.Init(testutil.Dataset1) {
98 return
99 }
100
101 // Update the local package
102 if !assert.NoError(t, Command{
103 Path: "java",
104 FullPackagePath: toAbsPath(t, "java"),
105 Ref: "v1.2",
106 Strategy: strategy,
107 }.Run()) {
108 return
109 }
110
111 // Expect the local package to have Dataset2
112 if !g.AssertLocalDataEquals(filepath.Join(testutil.Dataset2, "java")) {
113 return
114 }
115 commit, err := g.UpstreamRepo.GetCommit()
116 if !assert.NoError(t, err) {
117 return
118 }
119 if !g.AssertKptfile(g.GetSubDirectory, commit, "v1.2") {
120 return
121 }
122 })
123 }
124}
125
126func TestCommand_Run_noChanges(t *testing.T) {
127 updates := []struct {

Callers

nothing calls this directly

Calls 7

CleanMethod · 0.95
InitMethod · 0.95
AssertLocalDataEqualsMethod · 0.95
AssertKptfileMethod · 0.95
toAbsPathFunction · 0.85
GetCommitMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected