Skip to content

Commit

Permalink
Merge pull request #41847 from Thevakumar-Luheerathan/fix-bal-cli-tes…
Browse files Browse the repository at this point in the history
…t-failures

Fix CLI  test failures on Windows
  • Loading branch information
azinneera authored Dec 14, 2023
2 parents 36b3135 + 5894698 commit 8133652
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void testPullCommandWithHelp() throws IOException {
}

@Test(description = "Pull a package from custom remote repository")
public void testPullCustom() throws SettingsTomlException {
public void testPullCustom() throws SettingsTomlException, IOException {

Path customrRepoPath = Paths.get("src", "test", "resources", "test-resources", "custom-repo",
"repositories", "repo-push-pull");
Expand All @@ -160,7 +160,7 @@ public void testPullCustom() throws SettingsTomlException {
try (MockedStatic<RepoUtils> repoUtils = Mockito.mockStatic(RepoUtils.class, Mockito.CALLS_REAL_METHODS)) {
repoUtils.when(RepoUtils::createAndGetHomeReposPath).thenReturn(mockBallerinaHome);
repoUtils.when(RepoUtils::readSettings).thenReturn(readMockSettings(settingsTomlPath,
customrRepoPath.toAbsolutePath().toString()));
customrRepoPath.toAbsolutePath().toString().replace("\\", "/")));
pullCommand.execute();
}
Path pulledCacheDir = mockBallerinaHome.resolve("repositories").resolve("repo-push-pull")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ public void testPushPackageCustom() throws IOException, SettingsTomlException {
new CommandLine(pushCommand).parse(args);
try (MockedStatic<RepoUtils> repoUtils = Mockito.mockStatic(RepoUtils.class, Mockito.CALLS_REAL_METHODS)) {
repoUtils.when(RepoUtils::readSettings).thenReturn(readSettings(testResources.resolve("custom-repo")
.resolve("Settings.toml"), mockRepo.toAbsolutePath().toString()));
.resolve("Settings.toml"), mockRepo.toAbsolutePath().toString()
.replace("\\", "/")));
pushCommand.execute();
}
String buildLog = readOutput(true);
String actual = buildLog.replaceAll("\r", "");
Assert.assertEquals(actual, expected);
Assert.assertEquals(actual.replace("\\", "/"), expected);
String artifact = packageName + "-" + version + BALA_EXTENSION;
String pomFile = packageName + "-" + version + POM_EXTENSION;
String pushPullPath = mockRepo.resolve(org).resolve(packageName).resolve(version).toAbsolutePath().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ digraph "Initial" {
node [shape=record]
"foo/package_a" [label="<0.1.0> foo/package_a:0.1.0"];
"foo/package_b" [label="<0.1.0> foo/package_b:0.1.0"];
"foo/package_c" [label="<0.1.0> foo/package_c:0.1.0"];
"foo/package_c" [unresolved="true",color="grey",label="<0.1.0> foo/package_c:0.1.0"];

// Edges
"foo/package_a":"0.1.0" -> "foo/package_b":"0.1.0";
Expand Down Expand Up @@ -51,7 +51,7 @@ digraph "Initial" {
node [shape=record]
"foo/package_a" [label="<0.1.0> foo/package_a:0.1.0"];
"foo/package_b" [label="<0.1.0> foo/package_b:0.1.0"];
"foo/package_c" [label="<0.1.0> foo/package_c:0.1.0"];
"foo/package_c" [unresolved="true",color="grey",label="<0.1.0> foo/package_c:0.1.0"];

// Edges
"foo/package_a":"0.1.0" -> "foo/package_b":"0.1.0";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ digraph "foo/package_a:0.1.0" {
// Edges
"foo/package_a":"0.1.0" -> "foo/package_b":"0.1.0";
"foo/package_b":"0.1.0" -> "foo/package_c":"0.1.0";
}
}
No tests found

0 comments on commit 8133652

Please sign in to comment.