TestCommand_Run_toBranchRef verifies the package contents are set to the contents of the branch it was updated to.
(t *testing.T)
| 358 | // TestCommand_Run_toBranchRef verifies the package contents are set to the contents of the branch |
| 359 | // it was updated to. |
| 360 | func TestCommand_Run_toBranchRef(t *testing.T) { |
| 361 | for i := range updateStrategies { |
| 362 | strategy := updateStrategies[i] |
| 363 | t.Run(string(strategy), func(t *testing.T) { |
| 364 | // Setup the test upstream and local packages |
| 365 | g := &testutil.TestSetupManager{ |
| 366 | T: t, |
| 367 | // Update upstream to Dataset2 |
| 368 | UpstreamChanges: []testutil.Content{ |
| 369 | {Data: testutil.Dataset2, Branch: "exp", CreateBranch: true}, |
| 370 | {Data: testutil.Dataset3, Branch: "master"}, |
| 371 | }, |
| 372 | } |
| 373 | defer g.Clean() |
| 374 | if !g.Init(testutil.Dataset1) { |
| 375 | return |
| 376 | } |
| 377 | |
| 378 | // Update the local package |
| 379 | if !assert.NoError(t, Command{ |
| 380 | Path: g.UpstreamRepo.RepoName, |
| 381 | FullPackagePath: toAbsPath(t, g.UpstreamRepo.RepoName), |
| 382 | Strategy: strategy, |
| 383 | Ref: "exp", |
| 384 | }.Run()) { |
| 385 | return |
| 386 | } |
| 387 | |
| 388 | // Expect the local package to have Dataset2 |
| 389 | if !g.AssertLocalDataEquals(testutil.Dataset2) { |
| 390 | return |
| 391 | } |
| 392 | |
| 393 | if !assert.NoError(t, g.UpstreamRepo.CheckoutBranch("exp", false)) { |
| 394 | return |
| 395 | } |
| 396 | commit, err := g.UpstreamRepo.GetCommit() |
| 397 | if !assert.NoError(t, err) { |
| 398 | return |
| 399 | } |
| 400 | if !g.AssertKptfile(g.UpstreamRepo.RepoName, commit, "exp") { |
| 401 | return |
| 402 | } |
| 403 | }) |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | // TestCommand_Run_toTagRef verifies the package contents are set to the contents of the tag |
| 408 | // it was updated to. |
nothing calls this directly
no test coverage detected