Skip to content

[TEST] test command line options #18437

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

Closed
wants to merge 2 commits into from

Conversation

brwe
Copy link
Contributor

@brwe brwe commented May 18, 2016

This commit adds a test for command line options -p, --version and --help

closes #16129

This commit adds a test for command line options -p, --version and --help

closes elastic#16129
@brwe brwe added >test Issues or PRs that are addressing/adding tests v5.0.0-alpha2 v5.0.0-alpha3 review labels May 18, 2016
delete node.homeDir
delete node.cwd
doLast {
node.cwd.mkdirs()
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a strange thing to do in a clean task.

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 copied that part from here: https://github.com/elastic/elasticsearch/blob/master/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy#L149 I figured the directory has to be created somewhere and did not want to add an additional task for it. But I can totally add that somewhere else. Have a suggestion where a good place would be?

@nik9000
Copy link
Member

nik9000 commented May 18, 2016

I started looking at this this morning before going out for the morning and I'm just getting back to it. I get that testing these in groovy makes sense because we have all the dependencies, but I think this is usually something we want to do in junit tests, right? I mean, should we do it there? Do we just do it in groovy because it is easier there? I'm pretty ok with that but I want to be sure I'm not missing something.

@rjernst
Copy link
Member

rjernst commented May 18, 2016

This is a lot of duplication of existing infrastructure just to test output (which should be done in unit tests). In fact, we already have the ability, and do, test these in unit tests. And our integration tests start elasticsearch (and the plugin cli), so I'm not seeing the benefit of this added complexity to the build?

@nik9000
Copy link
Member

nik9000 commented May 18, 2016

And our integration tests start elasticsearch (and the plugin cli), so I'm not seeing the benefit of this added complexity to the build?

Right. They use the pidfile pretty extensively irrc. We probably don't need to test that again? Is it that we aren't confident that the unit tests will catch errors with stuff like --version and --help? We have the vagrant tests for lots of that kind of thing but you are right that they don't cover windows at all.

@rjernst
Copy link
Member

rjernst commented May 18, 2016

you are right that they don't cover windows at all.

Can't we have windows vagrant images?

@nik9000
Copy link
Member

nik9000 commented May 18, 2016

Can't we have windows vagrant images?

Maybe? I don't understand the licensing and I'm afraid to ask. Even if we did we'd have to jump through a zillion hoops because bats is, well, bash.

@rjernst
Copy link
Member

rjernst commented May 18, 2016

bats is, well, bash.

I think we could restructure the vagrant test infra to allow running something other than bash. Really it is just "ssh to the vagrant image and run something".

@nik9000
Copy link
Member

nik9000 commented May 18, 2016

Sure! But maybe we're making the perfect the enemy of the good? I mean, if we have time to solve the windows vm problem now then we should do it, but maybe testing these parameters at all in windows is important and maybe something like this is the way to go until we do have the time? Or maybe just running the build with its use of -p on windows machines is good enough and we don't need to do any of this?

@brwe
Copy link
Contributor Author

brwe commented May 19, 2016

I barely understand the discussion but will try to answer anyway.

In fact, we already have the ability, and do, test these in unit tests.

I added this test to check that the startup scripts elasticsearch.bat and elasticsearch work when we add --help -p pid etc. and that they do not mess up parameter order, see #15320 Sorry, I was not aware that we have unit test for the startup scripts. Can you point me to them?

And our integration tests start elasticsearch (and the plugin cli), so I'm not seeing the benefit of this added complexity to the build?

We do not seem to use the -p option there. Instead we write that in the config if I understand correctly.

Or maybe just running the build with its use of -p on windows machines is good enough and we don't need to do any of this?

That is what I did on 2.x via hacking the various ant scripts. But I never liked it because then these options are just tested implicitly. I would have preferred a dedicated test on 2.x already but thought at least on master I make it right.

I mean, if we have time to solve the windows vm problem now then we should do it

Definitely! I will try and find out where we are with the windows vms. I know there was some discussion about that. Will come back with an update. If that is possible I'd rather have a vagrant test.

Again, if I was just missing some smarter unit test option let me know.

@brwe
Copy link
Contributor Author

brwe commented May 19, 2016

We discussed and came to the conclusion it would be better to invest in a proper vagrant test like we do with other systems and then move this test to vagrant tests. It would make more sense because issues on windows pop up every now and then and this test is just one of many we need to implement anyway and we probably don't want to do all with gradle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>test Issues or PRs that are addressing/adding tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

port fix for windows command line options to master
4 participants