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

Enable TTY password OS tests, plus refactoring (#57759) #58200

Conversation

williamrandolph
Copy link
Contributor

Two keystore tests were unintentionally ignored when the
password-protected keystore work was merged. I've reënabled those tests
here.

I've also refactored the test methods a little bit to reduce the API
surface: instead of having a "startElasticsearchTtyPassword" method and
a "startElasticsearchStandardInputPassword" method, I've made a single
"startElasticsearch" method with a "useTty" boolean argument.

Two keystore tests were unintentionally ignored when the
password-protected keystore work was merged. I've reënabled those tests
here.

I've also refactored the test methods a little bit to reduce the API
surface: instead of having a "startElasticsearchTtyPassword" method and
a "startElasticsearchStandardInputPassword" method, I've made a single
"startElasticsearch" method with a "useTty" boolean argument.
@williamrandolph williamrandolph added >test Issues or PRs that are addressing/adding tests :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts backport v7.9.0 labels Jun 16, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Packaging)

@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jun 16, 2020
Centos 6 uses a version of expect that kills the elasticsearch process
when it tries to daemonize. I will fix this in future work but for now
I'm replacing it with a todo.
@@ -244,9 +244,10 @@ private static void verifyDefaultInstallation(Installation es, Distribution dist
// requires the "expect" utility to be installed
List<String> command = new ArrayList<>();
command.add("sudo -E -u %s %s -p %s");
if (daemonize) {
command.add("-d");
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we should be removing daemonize here, since the method still takes in the flag. Wouldn't this cause any tests using tty but not expecting failure to fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's going on here is that I want spawn -ignore HUP to let the process keep running in the background after the expect program ends. This is how it works on centos 7, and that's why the tests are passing after this change: it's as if a keyboard user is running without daemonization.

On centos 6, it seems that when expect terminates, it's terminating Elasticsearch too when the -d flag is added.

But I agree that the code shouldn't be merged in this state. I think I can improve it in a couple of ways, including not taking and disregarding a boolean flag in this method.

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've restored the "daemonize" block, but put a TODO/ignore on the test that would cause the problem. Hopefully the specific issue will be clear to anyone who works on the code. I'm hoping to find a different workaround after more investigation.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

@williamrandolph williamrandolph merged commit 958b21d into elastic:7.x Jun 25, 2020
@mark-vieira mark-vieira added Team:Delivery Meta label for Delivery team and removed Team:Core/Infra Meta label for core/infra team labels Nov 11, 2020
@williamrandolph williamrandolph deleted the backport/7.x/enable-tty-tests-and-refactor branch May 23, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team >test Issues or PRs that are addressing/adding tests v7.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants