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

java packaging tests #32143

Closed
12 of 24 tasks
andyb-elastic opened this issue Jul 17, 2018 · 5 comments
Closed
12 of 24 tasks

java packaging tests #32143

andyb-elastic opened this issue Jul 17, 2018 · 5 comments
Labels
:Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Meta >refactoring Team:Delivery Meta label for Delivery team >test Issues or PRs that are addressing/adding tests v8.0.0-alpha1

Comments

@andyb-elastic
Copy link
Contributor

andyb-elastic commented Jul 17, 2018

This issue is following the work from #26741 and tracks what tests from the old bats project need to be ported to the new java project, as well as what new test coverage needs to be added

See here for info about how the java tests are structured (this may be a little out of date as some things have changed)

See here for instructions about how to run these tests, particularly this section about iterating more quickly which will save you a lot of time developing these tests

porting bats tests

Bats migration has been spun off into a separate issue: #46005

executable coverage

We currently don't have coverage for all executables that ship with the distributions. Note that the ones marked checked may only have coverage in a bats test that has not yet been ported

oss executables

  • elasticsearch - Used in most tests
  • elasticsearch-env - We check for its existence and it's used by bin/elasticsearch so I think coverage here is fine
  • elasticsearch-plugin - used in 25_tar_plugins.bats and 50_modules_and_plugins.bats
  • elasticsearch-keystore - We test for keystore usage in the basic tests which have been ported
  • elasticsearch-translog - We check for its existence but there's no usage
  • elasticsearch-cli - We don't check for its existence nor is there any usage

windows-specific executables

  • elasticsearch-service.bat - we check for its existence but no usage
  • elasticsearch-service-mgr.exe - we check for its existence but no usage
  • elasticsearch-service-x64.exe - we check for its existence but no usage

default executables

  • elasticsearch-certgen - used in 40_tar_certgen.bats and 45_package_certgen.bats
  • elasticsearch-certutil - we check for existence but no usage
  • elasticsearch-coneval - used in x-pack's 10_basic.bats
  • elasticsearch-migrate - we check for existence but no usage
  • elasticsearch-saml-metadata - we check for existence but no usage (@jkakavas)
  • elasticsearch-setup-passwords - used in 30_tar_setup_password.bats and 35_package_setup_password.bats
  • elasticsearch-sql-cli - used in 20_tar_bootstrap_password.bats and 25_package_bootstrap_password.bats
  • elasticsearch-syskeygen - we check for existence but no usage
  • elasticsearch-users - we check for existence but not run (@jkakavas)
  • x-pack-env - we check for existence and it's used by other x-pack executables so I think we have coverage here
  • x-pack-security-env - we check for existence and it's used by other x-pack executables so I think we have coverage here
  • x-pack-watcher-env - we check for existence and it's used by other x-pack executables so I think we have coverage here

Other major things to do

  • Collecting logging so we can debug these tests when they fail. Most of them are transient and not reproducible, so what we currently do is collect the logs from the installed distribution and dump them to the console ([TEST] packaging: function to collect debug info #28608). We can port this by adding a junit test rule to the packaging test classes that does the same when a test method fails, which will have the added benefit of applying to every test (in the bash tests we would need to manually add a function call for it)

  • Test installing elasticsearch as a service on Windows - using the elasticsearch-service.bat executable

  • On Windows we should run the server as a role user because it works around some issues with how we're using windows powershell remoting (and because it's what we recommend). The remote shell runs as administrator, so to avoid running e.g. the server as administrator we have to "impersonate" the vagrant user to run commands not as-administrator. There's some more details about this here and here.

    An example of one way to handle local windows users in powershell is in this feature branch. The relevant cmdlets are New-LocalUser, Get-LocalUser, and Remove-LocalUser. The server 2012r2 box may need an upgraded version of powershell and WMF to use these.

    When running other powershell commands as a role user, (e.g. elasticsearch-keystore, not the server) it's probably best to use Invoke-Command (roughly equivalent to sudo -u elasticsearch foo). For example

    # here the elasticsearch user's password is 'elasticsearch' - you'll have to change some local security policies to actually be able to use that
    $password = ConvertTo-SecureString 'elasticsearch' -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential 'elasticsearch', $password
    Invoke-Command -ComputerName localhost -Credential $credential -ScriptBlock { <your command goes here }
    
@andyb-elastic andyb-elastic added >test Issues or PRs that are addressing/adding tests :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts v7.0.0 labels Jul 17, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@andyb-elastic
Copy link
Contributor Author

@rjernst I think we can check off "Test installing elasticsearch as a service on Windows" right, does #33729 cover all of that

@rjernst
Copy link
Member

rjernst commented Jan 8, 2019

Yes, #33729 covered basic windows service tests.

@jasontedor jasontedor added v8.0.0 and removed v7.0.0 labels Feb 6, 2019
pgomulka added a commit to pgomulka/elasticsearch that referenced this issue Apr 3, 2019
)

Migrating systemd bats tests from bats to java dsl. This also covers
partially the sysv, but more must be added

relates elastic#32143
pgomulka added a commit that referenced this issue Apr 4, 2019
…40763)

Migrating systemd bats tests from bats to java dsl. This also covers
partially the sysv, but more must be added

relates #32143
backport #39954
pgomulka added a commit to pgomulka/elasticsearch that referenced this issue Apr 4, 2019
)

Migrating systemd bats tests from bats to java dsl. This also covers
partially the sysv, but more must be added

relates elastic#32143
@jaymode
Copy link
Member

jaymode commented Apr 15, 2019

@elastic/es-security there are security executables listed above that do not have test coverage in our packaging tests, so I'd like to ask for your help in adding coverage for these tests.

@rjernst rjernst added the Team:Core/Infra Meta label for core/infra team label May 4, 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
@pgomulka pgomulka removed their assignment Nov 26, 2020
@mark-vieira
Copy link
Contributor

Existing BATS tests have all been migrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Meta >refactoring Team:Delivery Meta label for Delivery team >test Issues or PRs that are addressing/adding tests v8.0.0-alpha1
Projects
None yet
Development

No branches or pull requests

9 participants