Skip to content

Commit

Permalink
Merge pull request #348 from udda1996/fix-pull-all
Browse files Browse the repository at this point in the history
Fix tests for 'bal dist remove' command
  • Loading branch information
keizer619 authored Mar 3, 2024
2 parents b8a53aa + 278eea0 commit 43ba013
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,11 @@ test {
systemProperty "swan-lake-latest-version", project.properties['swan-lake-latest-version']
systemProperty "swan-lake-spec-version", project.properties['swan-lake-spec-version']
systemProperty "swan-lake-latest-spec-version", project.properties['swan-lake-latest-spec-version']
systemProperty "swan-lake-latest-dependency-version", project.properties['swan-lake-latest-dependency-version']
systemProperty "1-x-channel-version", project.properties['1-x-channel-version']
systemProperty "1-x-channel-spec-version", project.properties['1-x-channel-spec-version']
systemProperty "1-x-channel-latest-version", project.properties['1-x-channel-latest-version']
systemProperty "1-x-channel-dependency-version", project.properties['1-x-channel-dependency-version']

useTestNG() {
suites 'src/test/resources/testng.xml'
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jreVersion=11.0.18+10
# For test purpose
swan-lake-version=2201.2.0
swan-lake-spec-version=2022R3
swan-lake-latest-version=2201.8.4
swan-lake-latest-version=2201.8.5
swan-lake-latest-spec-version=2023R1
swan-lake-latest-dependency-version=jdk-17.0.7+7-jre
1-x-channel-version=1.2.0
1-x-channel-dependency-version=jdk8u202-b08-jre
1-x-channel-spec-version=2020R1
1-x-channel-latest-version=1.2.48
1-x-channel-latest-version=1.2.49
7 changes: 2 additions & 5 deletions src/test/java/org/ballerinalang/distribution/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ private static void copyFiles() {
try {
Files.createDirectory(TEST_DIR);
Files.createDirectory(DIST_PATH);
Files.createDirectory(DEPENDENCY_PATH);
Files.copy(RESOURCES_DIR.resolve("ballerina-version"), DIST_PATH.resolve("ballerina-version"));
Files.copy(RESOURCES_DIR.resolve("installer-version"), DIST_PATH.resolve("installer-version"));
} catch (IOException e) {
Expand Down Expand Up @@ -300,11 +301,7 @@ public static Path getDistPath (String version) {
* @return returns dependency path for available distributions
*/
public static Path getDependencyPath (String version) {
try {
return DEPENDENCY_PATH.resolve(version);
} catch (Exception e) {
return null;
}
return DEPENDENCY_PATH.resolve(version);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public void testRemoveCommand() throws IOException, InterruptedException {
output = TestUtils.executeCommand(args);
Assert.assertTrue(output.contains("successfully removed"));
Assert.assertFalse(Files.exists(TestUtils.getDistPath(previousChannelVersion)));
Assert.assertNull(TestUtils.getDependencyPath(previousChannelDependencyVersion));
Assert.assertFalse(Files.exists(TestUtils.getDependencyPath(previousChannelDependencyVersion)));

args.add("arg1");
output = TestUtils.executeCommand(args);
Expand All @@ -302,7 +302,7 @@ public void testRemoveCommand() throws IOException, InterruptedException {
Assert.assertTrue(Files.exists(TestUtils.getDistPath(swanLakeLatestVersion)));
Assert.assertFalse(Files.exists(TestUtils.getDistPath(swanLakeVersion)));
Assert.assertFalse(Files.exists(TestUtils.getDistPath(previousChanneLatestVersion)));
Assert.assertNull(TestUtils.getDependencyPath(swanLakeLatestVersionDependency));
Assert.assertTrue(Files.exists(TestUtils.getDependencyPath(swanLakeLatestVersionDependency)));
Assert.assertEquals(Files.list(TestUtils.getDependencyPath(swanLakeLatestVersionDependency).getParent()).count()
, 1);

Expand Down

0 comments on commit 43ba013

Please sign in to comment.