-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#1349] Clone test repositories only once when testing #1478
Conversation
The test repositories are cloned for every test that performs cloning, which results in tests taking a long time to complete as a significant amount of time is spent cloning the same repository for every test. Let's prevent the deletion of the cloned test repositories until we are sure that all tests have completed, thus allowing the test repositories to be cloned only once during each test run.
|
||
if (!SystemUtil.isTestEnvironment()) { | ||
FileUtil.deleteDirectory(outputFolderPath.toString()); | ||
Files.createDirectories(rootPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that you can add a test to cover this branch here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, as this branch can only run if it is a non-test environment. The test environment is defined in an environment variable and it won't be easy to modify it just for one test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One doubt.
Path repoPath = Paths.get(FileUtil.REPOS_ADDRESS, config.getRepoFolderName(), config.getRepoName()); | ||
|
||
if (SystemUtil.isTestEnvironment() && Files.exists(repoPath)) { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this mean that the repo is already cloned? Then why are we returning true for wait
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the repo is already cloned at this stage. The true
is to indicate that the function is successful, otherwise it will return false
if an exception has occurred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tejas2805 Ping
@Tejas2805 You input is needed |
@Tejas2805 Ping again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Sorry for the late reply.
Will try to merge it asap. |
@fzdy1914 Will this be merged soon? |
Can you help check why the deployment fail? @dcshzj |
Fixes #1349.
Tests and system tests are treated separately, as they represent different commands within Gradle.
Additional information
The following table represents the comparison in build times before and after this change is implemented:
test
)systemTest
)