Skip to content
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

GEODE-8637: Give each test worker a unique working dir #5649

Merged

Conversation

demery-pivotal
Copy link
Contributor

@demery-pivotal demery-pivotal commented Oct 21, 2020

Before running a test task, wrap its TestFramework in a wrapper that creates a unique working dir for each new test worker.

The affected test tasks are:

  • acceptanceTest
  • distributedTest
  • integrationTest
  • uiTest
  • upgradeTest
  • All repeat*Test tasks

Path workerWorkingDir = taskWorkingDir.resolve(workerWorkingDirName);

createWorkingDir(workerWorkingDir);
copyGemFirePropertiesFile(taskWorkingDir, workerWorkingDir);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need/want this gemfire.properties file anymore? As far as I'm concerned tests shouldn't be running with a gemfire.properties file lying around anyway?

I see we have TestPropertiesWriter that creates a properties file. But all it has is log-level=config, which is the default anyway...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just today I noticed that the non-repeat forms of these tasks don't write as properties file. If it's not needed, it would probably be better to delete the code that writes it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gemfire.properties files, in all its incarnations, has been a thorn to me, because the writing of it causes a repack of geode-core.jar, which triggers all kinds of downstream effects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a reason to believe it's still needed? If you're not sure, I can do a run without it and see what explodes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is? The one thing maybe it might do is prevent us from looking for a gemfire.properties file in other places (the classpath?, the user's homedir?). Could be worth a run if we can get rid of some code.

BTW, @rhoughton-pivot - I think maybe you are talking about writing the default properties file? That's different code I believe. But yeah, still seems like in that case maybe we could just check in a file or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. If the point of that file is to prevent looking in other places… removing it might change behavior on developers' machines, if they have a ~/gemfire.properties file. And a run in CI would not notice the problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am probably thinking of the gemfireVersion.properties :(

public Action<WorkerProcessBuilder> getWorkerConfigurationAction() {
return workerProcessBuilder -> {
delegate.getWorkerConfigurationAction().execute(workerProcessBuilder);
JavaExecHandleBuilder javaCommand = workerProcessBuilder.getJavaCommand();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I wonder if you could do something like javaCommand.setExecutable("docker") ... to run the workers in a docker container ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really interesting idea!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it's not as simple as that, given that the Gradle client process needs to interact with the test worker process.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm sure it's a bit more complicated. But maybe all of the gradle internal APIs that we would need to use are already in use in this PR?

Anyway, I wasn't being that serious with this comment, mostly just teasing you since I know you're trying to get rid of docker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got the tease, but maybe you didn't know: We're not trying to get rid of docker per se. We're trying to get rid of dependence on an old, unmaintained dockerizer plugin that's holding us back. Now that I'm turning my attention back port conflicts, I find your not-serious idea unreasonably tempting! I'm not hopeful, but I will look into it.

Copy link
Member

@rhoughton-pivot rhoughton-pivot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The protected useTestFramework() call is a worry, but that can be future work! Great job on this.

Path workerWorkingDir = taskWorkingDir.resolve(workerWorkingDirName);

createWorkingDir(workerWorkingDir);
copyGemFirePropertiesFile(taskWorkingDir, workerWorkingDir);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gemfire.properties files, in all its incarnations, has been a thorn to me, because the writing of it causes a repack of geode-core.jar, which triggers all kinds of downstream effects.

private void copyGemFirePropertiesFile(Path taskWorkingDir, Path workerWorkingDir) {
Path taskPropertiesFile = taskWorkingDir.resolve(GEMFIRE_PROPERTIES);
if (!Files.exists(taskPropertiesFile)) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If taskPropertiesFile does not exist, will it affect javaCommand.setWorkingDir(workerWorkingDir); (line 78)? Or will it have some unexpected behavior when running tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the file is missing, that doesn't indicate a problem. It's deliberate. Our Gradle build puts that file there for some test tasks (e.g. distributedTest) but not for others (e.g. repeatDistributedTest). I don't know why our Gradle build writes the file for some tasks and not others, but that's the current behavior.

The if statement accounts for Gradle writing the file for some tasks and not for others.

The effect is that if the file was in the test JVM's common working directory before this PR, it will be in the JVM's unique working directory after. And if the file was absent from the test JVM's working directory before the PR, it will be absent after.

@onichols-pivotal onichols-pivotal added the windows add this label to get Windows JDK11 PR checks too label Oct 26, 2020
@demery-pivotal demery-pivotal force-pushed the geode-8637/unique-working-dir branch 3 times, most recently from 0f6994d to 485f5dc Compare October 26, 2020 21:03
Before running a test task, wrap its TestFramework in a wrapper that
creates a unique working dir for each new test worker.
@demery-pivotal demery-pivotal merged commit e65f579 into apache:develop Oct 27, 2020
@demery-pivotal demery-pivotal deleted the geode-8637/unique-working-dir branch December 1, 2020 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows add this label to get Windows JDK11 PR checks too
Projects
None yet
6 participants