TestCommand_Run_destination verifies Command clones the repo to a destination with a specific name rather than using the name of the source repo.
(t *testing.T)
| 134 | // TestCommand_Run_destination verifies Command clones the repo to a destination with a specific name rather |
| 135 | // than using the name of the source repo. |
| 136 | func TestCommand_Run_destination(t *testing.T) { |
| 137 | dest := "my-dataset" |
| 138 | g, w, clean := testutil.SetupDefaultRepoAndWorkspace(t, testutil.Dataset1) |
| 139 | defer clean() |
| 140 | |
| 141 | err := Command{Git: kptfile.Git{Repo: g.RepoDirectory, Ref: "master", Directory: "/"}, Destination: dest}.Run() |
| 142 | assert.NoError(t, err) |
| 143 | |
| 144 | // verify the cloned contents matches the repository |
| 145 | r := filepath.Join(w.WorkspaceDirectory, dest) |
| 146 | g.AssertEqual(t, filepath.Join(g.DatasetDirectory, testutil.Dataset1), r) |
| 147 | |
| 148 | // verify the KptFile contains the expected values |
| 149 | commit, err := g.GetCommit() |
| 150 | assert.NoError(t, err) |
| 151 | g.AssertKptfile(t, r, kptfile.KptFile{ |
| 152 | ResourceMeta: yaml.ResourceMeta{ |
| 153 | ObjectMeta: yaml.ObjectMeta{ |
| 154 | NameMeta: yaml.NameMeta{ |
| 155 | Name: dest, |
| 156 | }, |
| 157 | }, |
| 158 | TypeMeta: yaml.TypeMeta{ |
| 159 | APIVersion: kptfile.TypeMeta.APIVersion, |
| 160 | Kind: kptfile.TypeMeta.Kind}, |
| 161 | }, |
| 162 | PackageMeta: kptfile.PackageMeta{}, |
| 163 | Upstream: kptfile.Upstream{ |
| 164 | Type: "git", |
| 165 | Git: kptfile.Git{ |
| 166 | Directory: "/", |
| 167 | Repo: g.RepoDirectory, |
| 168 | Ref: "master", |
| 169 | Commit: commit, |
| 170 | }, |
| 171 | }, |
| 172 | }) |
| 173 | } |
| 174 | |
| 175 | // TestCommand_Run_subdirAndDestination verifies that Command will copy a subdirectory of a repo to a |
| 176 | // specific destination. |
nothing calls this directly
no test coverage detected