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

Function TestCommand_Run_noAdd

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

Source from the content-addressed store, hash-verified

216}
217
218func TestCommand_Run_noAdd(t *testing.T) {
219 strategies := append([]StrategyType{Default}, updateStrategies...)
220 for i := range strategies {
221 strategy := strategies[i]
222 t.Run(string(strategy), func(t *testing.T) {
223 // Setup the test upstream and local packages
224 g := &testutil.TestSetupManager{
225 T: t,
226 }
227 defer g.Clean()
228 if !g.Init(testutil.Dataset1) {
229 return
230 }
231
232 // don't add the data
233 err := ioutil.WriteFile(
234 filepath.Join(g.LocalWorkspace.WorkspaceDirectory, g.UpstreamRepo.RepoName, "java", "added-file"), []byte(`hello`),
235 0600)
236 if !assert.NoError(t, err) {
237 return
238 }
239
240 // Update the local package
241 err = Command{
242 Path: g.UpstreamRepo.RepoName,
243 FullPackagePath: toAbsPath(t, g.UpstreamRepo.RepoName),
244 Strategy: strategy,
245 }.Run()
246 if !assert.Error(t, err) {
247 return
248 }
249 assert.Contains(t, err.Error(), "must commit package")
250 })
251 }
252}
253
254// TestCommand_Run_localPackageChanges updates a package that has been locally modified
255// - Get a package using a branch ref

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected