Skip to content

Commit

Permalink
travis: Use non-default passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineco committed Feb 27, 2020
1 parent d743e6e commit 6307652
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ before_script:
# Build images
- docker-compose build

# Use built-in users
- sed -i 's/\(elasticsearch.username:\) elastic/\1 kibana/g' kibana/config/kibana.yml
- sed -i 's/\(xpack.monitoring.elasticsearch.username:\) elastic/\1 logstash_system/g' logstash/config/logstash.yml
# Use built-in users with passwords set by 'elasticsearch-setup-passwords.exp'
- sed -i -e 's/\(elasticsearch.username:\) elastic/\1 kibana/g' -e 's/\(elasticsearch.password:\) changeme/\1 testpasswd/g' kibana/config/kibana.yml
- sed -i -e 's/\(xpack.monitoring.elasticsearch.username:\) elastic/\1 logstash_system/g' -e 's/\(xpack.monitoring.elasticsearch.password:\) changeme/\1 testpasswd/g' logstash/config/logstash.yml
- sed -i 's/\(password =>\) "changeme"/\1 "testpasswd"/g' logstash/pipeline/logstash.conf

script:
# Compose
Expand Down
2 changes: 1 addition & 1 deletion .travis/elasticsearch-setup-passwords.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# List of expected users with dummy password
set user "(elastic|apm_system|kibana|logstash_system|beats_system|remote_monitoring_user)"
set password "changeme"
set password "testpasswd"

# Find elasticsearch container id
set MODE [lindex $argv 0]
Expand Down
14 changes: 7 additions & 7 deletions .travis/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ if [ "$#" -ge 1 ]; then
fi

log 'Waiting for Elasticsearch readiness'
poll_ready elasticsearch 'https://localhost:9200/' 'elastic:changeme'
poll_ready elasticsearch 'https://localhost:9200/' 'elastic:testpasswd'

log 'Waiting for Kibana readiness'
poll_ready kibana 'https://localhost:5601/api/status' 'kibana:changeme'
poll_ready kibana 'https://localhost:5601/api/status' 'kibana:testpasswd'

log 'Waiting for Logstash readiness'
poll_ready logstash 'https://localhost:9600/_node/pipelines/main?pretty'
Expand All @@ -72,11 +72,11 @@ curl -X POST -D- 'https://localhost:5601/api/saved_objects/index-pattern' \
-s -w '\n' \
-H 'Content-Type: application/json' \
-H "kbn-version: ${ELK_VERSION}" \
-u elastic:changeme \
-u elastic:testpasswd \
-d '{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'

log 'Searching index pattern via Kibana API'
response="$(curl 'https://localhost:5601/api/saved_objects/_find?type=index-pattern' -s -u elastic:changeme)"
response="$(curl 'https://localhost:5601/api/saved_objects/_find?type=index-pattern' -s -u elastic:testpasswd)"
echo "$response"
count="$(jq -rn --argjson data "${response}" '$data.total')"
if [[ $count -ne 1 ]]; then
Expand All @@ -85,14 +85,14 @@ if [[ $count -ne 1 ]]; then
fi

log 'Sending message to Logstash TCP input'
echo 'dockerelk' | nc localhost 5000
echo 'dockerelk' | nc -q0 localhost 5000

sleep 1
curl -X POST 'https://localhost:9200/_refresh' -u elastic:changeme \
curl -X POST 'https://localhost:9200/_refresh' -u elastic:testpasswd \
-s -w '\n'

log 'Searching message in Elasticsearch'
response="$(curl 'https://localhost:9200/_count?q=message:dockerelk&pretty' -s -u elastic:changeme)"
response="$(curl 'https://localhost:9200/_count?q=message:dockerelk&pretty' -s -u elastic:testpasswd)"
echo "$response"
count="$(jq -rn --argjson data "${response}" '$data.count')"
if [[ $count -ne 1 ]]; then
Expand Down

0 comments on commit 6307652

Please sign in to comment.