Closed andyb-elastic closed 3 years ago
Pinging @elastic/es-core-infra
@rjernst I think we can check off "Test installing elasticsearch as a service on Windows" right, does https://github.com/elastic/elasticsearch/pull/33729 cover all of that
Yes, #33729 covered basic windows service tests.
@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.
Existing BATS tests have all been migrated.
This issue is following the work from https://github.com/elastic/elasticsearch/issues/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: https://github.com/elastic/elasticsearch/issues/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 testselasticsearch-env
- We check for its existence and it's used bybin/elasticsearch
so I think coverage here is fineelasticsearch-plugin
- used in 25_tar_plugins.bats and 50_modules_and_plugins.batselasticsearch-keystore
- We test for keystore usage in the basic tests which have been portedelasticsearch-translog
- We check for its existence but there's no usageelasticsearch-cli
- We don't check for its existence nor is there any usagewindows-specific executables
elasticsearch-service.bat
- we check for its existence but no usageelasticsearch-service-mgr.exe
- we check for its existence but no usageelasticsearch-service-x64.exe
- we check for its existence but no usagedefault executables
elasticsearch-certgen
- used in 40_tar_certgen.bats and 45_package_certgen.batselasticsearch-certutil
- we check for existence but no usageelasticsearch-coneval
- used in x-pack's 10_basic.batselasticsearch-migrate
- we check for existence but no usageelasticsearch-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.batselasticsearch-sql-cli
- used in 20_tar_bootstrap_password.bats and 25_package_bootstrap_password.batselasticsearch-syskeygen
- we check for existence but no usageelasticsearch-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 herex-pack-security-env
- we check for existence and it's used by other x-pack executables so I think we have coverage herex-pack-watcher-env
- we check for existence and it's used by other x-pack executables so I think we have coverage hereOther major things to do
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 tosudo -u elasticsearch foo
). For example