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

Function TestCommand_ResourceMerge_NonKRMUpdates

internal/util/update/update_test.go:457–502  ·  view source on GitHub ↗

TestCommand_ResourceMerge_NonKRMUpdates tests if the local non KRM files are updated

(t *testing.T)

Source from the content-addressed store, hash-verified

455
456// TestCommand_ResourceMerge_NonKRMUpdates tests if the local non KRM files are updated
457func TestCommand_ResourceMerge_NonKRMUpdates(t *testing.T) {
458 strategies := []StrategyType{KResourceMerge}
459 for i := range strategies {
460 strategy := strategies[i]
461 t.Run(string(strategy), func(t *testing.T) {
462 // Setup the test upstream and local packages
463 g := &testutil.TestSetupManager{
464 T: t,
465 // Update upstream to Dataset5
466 UpstreamChanges: []testutil.Content{
467 {Data: testutil.Dataset5, Tag: "v1.0"},
468 },
469 }
470 defer g.Clean()
471 if !g.Init(testutil.Dataset1) {
472 t.FailNow()
473 }
474
475 // Update the local package
476 if !assert.NoError(t, Command{
477 Path: g.UpstreamRepo.RepoName,
478 FullPackagePath: toAbsPath(t, g.UpstreamRepo.RepoName),
479 Strategy: strategy,
480 Ref: "v1.0",
481 }.Run()) {
482 t.FailNow()
483 }
484
485 // Expect the local package to have Dataset5
486 if !g.AssertLocalDataEquals(testutil.Dataset5) {
487 t.FailNow()
488 }
489
490 if !assert.NoError(t, g.UpstreamRepo.CheckoutBranch("v1.0", false)) {
491 t.FailNow()
492 }
493 commit, err := g.UpstreamRepo.GetCommit()
494 if !assert.NoError(t, err) {
495 t.FailNow()
496 }
497 if !g.AssertKptfile(g.UpstreamRepo.RepoName, commit, "v1.0") {
498 t.FailNow()
499 }
500 })
501 }
502}
503
504// TestCommand_Run_toTagRef verifies the package contents are set to the contents of the tag
505// it was updated to with local values set to different values in upstream.

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected