TestCmd_execute tests that get is correctly invoked.
(t *testing.T)
| 32 | |
| 33 | // TestCmd_execute tests that get is correctly invoked. |
| 34 | func TestCmd_execute(t *testing.T) { |
| 35 | g, w, clean := testutil.SetupDefaultRepoAndWorkspace(t, testutil.Dataset1) |
| 36 | defer clean() |
| 37 | dest := filepath.Join(w.WorkspaceDirectory, g.RepoName) |
| 38 | |
| 39 | r := cmdget.NewRunner("kpt") |
| 40 | r.Command.SetArgs([]string{"file://" + g.RepoDirectory + ".git/", "./"}) |
| 41 | err := r.Command.Execute() |
| 42 | |
| 43 | assert.NoError(t, err) |
| 44 | g.AssertEqual(t, filepath.Join(g.DatasetDirectory, testutil.Dataset1), dest) |
| 45 | |
| 46 | commit, err := g.GetCommit() |
| 47 | assert.NoError(t, err) |
| 48 | g.AssertKptfile(t, dest, kptfile.KptFile{ |
| 49 | ResourceMeta: yaml.ResourceMeta{ |
| 50 | ObjectMeta: yaml.ObjectMeta{ |
| 51 | NameMeta: yaml.NameMeta{ |
| 52 | Name: g.RepoName, |
| 53 | }, |
| 54 | }, |
| 55 | TypeMeta: yaml.TypeMeta{ |
| 56 | APIVersion: kptfile.TypeMeta.APIVersion, |
| 57 | Kind: kptfile.TypeMeta.Kind}, |
| 58 | }, |
| 59 | PackageMeta: kptfile.PackageMeta{}, |
| 60 | Upstream: kptfile.Upstream{ |
| 61 | Type: "git", |
| 62 | Git: kptfile.Git{ |
| 63 | Directory: "/", |
| 64 | Repo: "file://" + g.RepoDirectory, |
| 65 | Ref: "master", |
| 66 | Commit: commit, // verify the commit matches the repo |
| 67 | }, |
| 68 | }, |
| 69 | }) |
| 70 | } |
| 71 | |
| 72 | // TestCmdMainBranch_execute tests that get is correctly invoked if default branch |
| 73 | // is main and master branch doesn't exist |
nothing calls this directly
no test coverage detected