Search in sources :

Example 1 with ModuleSet

use of com.google.copybara.ModuleSet in project copybara by google.

the class GitOriginTest method checkPartialFetchGitRepoName.

@Test
public void checkPartialFetchGitRepoName() throws Exception {
    String migrationName = "test_name";
    ModuleSet moduleSet = skylark.createModuleSet();
    for (Object module : moduleSet.getModules().values()) {
        // We mutate the module per file loaded. Not ideal but it is the best we can do.
        if (module instanceof LabelsAwareModule) {
            LabelsAwareModule m = (LabelsAwareModule) module;
            m.setWorkflowName(migrationName);
        }
    }
    origin = skylark.evalWithModuleSet("result", "result = git.origin(\n" + "    url = 'https://my-server.org/copybara',\n" + "    partial_fetch = True" + ")", moduleSet);
    Path gitDir = origin.getRepository().getGitDir();
    assertThat(gitDir.getFileName().toString()).isEqualTo("copy%2Ebara%2Esky%3A" + migrationName + "https%3A%2F%2Fmy-server%2Eorg%2Fcopybara");
}
Also used : Path(java.nio.file.Path) FileSubjects.assertThatPath(com.google.copybara.testing.FileSubjects.assertThatPath) ModuleSet(com.google.copybara.ModuleSet) LabelsAwareModule(com.google.copybara.config.LabelsAwareModule) Test(org.junit.Test)

Aggregations

ModuleSet (com.google.copybara.ModuleSet)1 LabelsAwareModule (com.google.copybara.config.LabelsAwareModule)1 FileSubjects.assertThatPath (com.google.copybara.testing.FileSubjects.assertThatPath)1 Path (java.nio.file.Path)1 Test (org.junit.Test)1