OpenSearch/buildSrc
William Brafford ff7fd9b9e2
Pass COMPUTERNAME env var to elasticsearch.bat (#45763)
* Pass COMPUTERNAME env var to elasticsearch.bat

When we run bin/elasticsearch with bash, we get a $HOSTNAME builtin that
contains the hostname of the machine the script is running on. When
there's no provided nodename, Elasticsearch uses the HOSTNAME to create
a nodename. On Windows, Powershell provides a $COMPUTERNAME variable for
the same purpose. CMD.EXE provides the same thing, except it's called
%COMPUTERNAME%. bin/elasticsearch.bat sets $HOSTNAME to the value of
$COMPUTERNAME. However, when testclusters invokes bin/elasticsearch.bat,
the COMPUTERNAME variable doesn't get passed in, leaving HOSTNAME null
and breaking an integration test on Windows.

This commit sets COMPUTERNAME in the environment so that our tests get
the value that Elasticsearch would have when bin/elasticsearch.bat is
invoked from the shell.

* Add null check to protect in non-Windows case

What good is it a developer to gain the whole Windows if they forfeit
their Unix? The value that fixes things on Windows is null on
Linux/Darwin, so let's null-check it.

* Override system hostnames for testclusters

Rather than relying on variable system behavior, let's just override
HOSTNAME and COMPUTERNAME and test for correct values in the integration
test that was originally failing.

* Rename constants for clarity

Since we are setting HOSTNAME and COMPUTERNAME regardless of whether the
tests are running on Windows or Linux, we shouldn't imply that constants
are only used in one case or the other.
2019-08-26 11:44:31 -04:00
..
reaper Fix backwards compatibility with pre-Java11 build-tools users (#45633) 2019-08-15 18:39:11 -07:00
src Pass COMPUTERNAME env var to elasticsearch.bat (#45763) 2019-08-26 11:44:31 -04:00
.gitignore Build: Add fake project to include buildSrc as normal project 2016-05-06 22:26:15 -07:00
build.gradle Fix backwards compatibility with pre-Java11 build-tools users (#45633) 2019-08-15 18:39:11 -07:00
settings.gradle Use reaper process instead of shutdown hooks for testclusters (#44927) 2019-08-02 18:58:04 -07:00
version.properties Update joda to 2.10.3 (#45495) 2019-08-23 10:39:39 +02:00