Migrate systemd packaging tests from bats to java#39954
Migrate systemd packaging tests from bats to java#39954pgomulka merged 18 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-core-infra |
80fb18a to
48bfbaf
Compare
|
This is now ready for a review. The systemd part has been migrated. |
|
@elasticmachine run elasticsearch-ci/packaging |
| stopElasticsearch(newShell()); | ||
| } | ||
|
|
||
| // TEST CASES FOR SYSTEMD ONLY |
There was a problem hiding this comment.
In the interest of keeping this class from growing, could we have a separate class fro the systemd tests ?
There was a problem hiding this comment.
There is 8 subclasses of this testcase now, if we separate systemd from sysv we will endup with 16. Most of the time we share the logic for testing between systemd and sysv. I think this is ok for now, but definitely we should consider restructuring the hierarchy once this grow too big.
| installation = install(distribution()); | ||
| assertInstalled(distribution()); | ||
|
|
||
| Shell sh = newShell(); |
There was a problem hiding this comment.
would it make sense to have this as a field set up in a @Before ?
There was a problem hiding this comment.
good idea, this is repeated all over the testcases
|
|
||
|
|
||
| public void test72TestRuntimeDirectory() throws IOException { | ||
| cleanup(); |
There was a problem hiding this comment.
could this be done in @After or @Before if you wish to avoid the repetitive calls and make sure we always start clean ? if we have tests that break with this now, I think that's something we need to fix as it makes the test hard to read if different tests depend on each-other even when run in sequence.
There was a problem hiding this comment.
right, I think not all tests are leaving the environment dirty. Might be better to keep cleanup in the test that is making the changes to environment in try-finally block
| public void test72TestRuntimeDirectory() throws IOException { | ||
| cleanup(); | ||
| installation = install(distribution()); | ||
| FileUtils.rm(installation.pidDir); |
There was a problem hiding this comment.
nit: static imports of the methods in FileUtils would make this slightly more readbale
| installation = install(distribution()); | ||
| startElasticsearch(newShell()); | ||
| // it can be gc.log or gc.log.0.current | ||
| assertThat(installation.logs, FileUtils.fileWithRegexExist("gc.log*")); |
There was a problem hiding this comment.
I think technically that's a glob not a regexp.
|
|
||
| waitForElasticsearch(); | ||
|
|
||
| // assertStatuses(); |
There was a problem hiding this comment.
is this intentionally commented out ?
There was a problem hiding this comment.
I had problems with running status after restart. Will have a second look but for time being will remove it.
| # Rather than restart the VM we just ask systemd if it plans on starting | ||
| # elasticsearch on restart. Not as strong as a restart but much much | ||
| # faster. | ||
| run systemctl is-enabled elasticsearch.service |
There was a problem hiding this comment.
Did we miss porting this check ?
There was a problem hiding this comment.
yes I missed this one. added
| systemctl start elasticsearch.service | ||
| wait_for_elasticsearch_status | ||
| assert_file_exist "/var/run/elasticsearch/elasticsearch.pid" | ||
| assert_file_exist "/var/log/elasticsearch/elasticsearch_server.json" |
There was a problem hiding this comment.
Do we check this in the java version ?
There was a problem hiding this comment.
good spot, it was not checked at all for packages tests
| result="$(journalctl _SYSTEMD_UNIT=elasticsearch.service --since "$since" --output cat | wc -l)" | ||
| [ "$result" -eq "0" ] || { | ||
| echo "Expected no entries in journalctl for the Elasticsearch service but found:" | ||
| journalctl _SYSTEMD_UNIT=elasticsearch.service --since "$since" |
There was a problem hiding this comment.
I think we are also missing this one.
There was a problem hiding this comment.
Added. I wrongly assumed that since start is already migrated that I didn't have to look into this step :)
| @test "[SYSTEMD] test runtime directory" { | ||
| clean_before_test | ||
| install_package | ||
| sudo rm -rf /var/run/elasticsearch |
There was a problem hiding this comment.
might be missing this one too ?
There was a problem hiding this comment.
should be now in test72TestRuntimeDirectory
|
The last packaging build was impacted by https://github.com/elastic/infra/issues/10287. @elasticmachine run elasticsearch-ci/packaging |
|
@pgomulka the PR doesn't have any version labels. I do think this should be back-ported to |
* master: (25 commits) [DOCS] Correct keystore commands for Email and Jira actions in Watcher (elastic#40417) [DOCS] Document common settings for snapshot repository plugins (elastic#40475) Remove with(out)-system-key tests (elastic#40547) Geo Point parse error fix (elastic#40447) Handle null retention leases in WaitForNoFollowersStep (elastic#40477) [DOCS] Adds anchors for ruby client (elastic#39867) Mute DataFrameAuditorIT#testAuditorWritesAudits Disable integTest when Docker is not available (elastic#40585) Add randomScore function in script_score query (elastic#40186) Test fixtures krb5 (elastic#40297) Correct ILM metadata minimum compatibility version (elastic#40569) SQL: Centralize SQL test dependencies version handling (elastic#40551) Mute testTracerLog Mute testHttpInput Include functions' aliases in the list of functions (elastic#40584) Optimise rejection of out-of-range `long` values (elastic#40325) Add docs for cluster.remote.*.proxy setting (elastic#40281) Migrate systemd packaging tests from bats to java (elastic#39954) Move top-level pipeline aggs out of QuerySearchResult (elastic#40319) Use openjdk 12 in packer cache script (elastic#40498) ...
) Migrating systemd bats tests from bats to java dsl. This also covers partially the sysv, but more must be added relates elastic#32143
) Migrating systemd bats tests from bats to java dsl. This also covers partially the sysv, but more must be added relates elastic#32143
|
@pgomulka I'm assuming there is nothing left to backport and removed the backport pending label. |
Migrating systemd bats tests from bats to java dsl. This also covers partially the sysv, but more must be added
relates #32143