File tree Expand file tree Collapse file tree 7 files changed +130
-5
lines changed
Expand file tree Collapse file tree 7 files changed +130
-5
lines changed Original file line number Diff line number Diff line change 1+ BASHUNIT_DEFAULT_PATH=test/elastic
2+ BASHUNIT_BOOTSTRAP="${BASHUNIT_DEFAULT_PATH}/bootstrap.sh"
Original file line number Diff line number Diff line change 1+ name : Elastic Demo Tests
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize, reopened]
6+ push :
7+ paths-ignore :
8+ - ' .githubREADME.md'
9+
10+ jobs :
11+ test :
12+ name : Test
13+ runs-on : ubuntu-latest
14+
15+ strategy :
16+ fail-fast : false
17+
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@v4
21+
22+ - name : Install bashunit
23+ run : |
24+ curl -s https://bashunit.typeddevs.com/install.sh | bash
25+
26+ - name : Run the tests
27+ run : |
28+ ./lib/bashunit --env .env.bashunit
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e -o pipefail
4+
5+ source " ${CURRENT_DIR} /test/elastic/utils.sh"
6+
7+
8+ function set_up_before_script() {
9+ start_local_elastic_stack
10+ }
11+
12+ function tear_down_after_script() {
13+ uninstall_local_elastic_stack
14+ }
15+
16+ function test_launch_demo_docker() {
17+ result=$( launch_demo " cloud-hosted" " docker" )
18+ assert_false " $result "
19+ }
20+
21+ function test_destroy_demo_docker() {
22+ result=$( destroy_demo " docker" )
23+ assert_false " $result "
24+ }
25+
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e -o pipefail
4+
5+ source " ${CURRENT_DIR} /test/elastic/utils.sh"
6+
7+
8+ function set_up_before_script() {
9+ start_local_elastic_stack
10+ }
11+
12+ function tear_down_after_script() {
13+ uninstall_local_elastic_stack
14+ }
15+
16+ function test_demo_k8s() {
17+ # result=$(launch_demo "cloud-hosted" "k8s")
18+ # assert_false "$result"
19+ assert_true true
20+ }
21+
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
33# Place your common test setup here
4+
5+ CURRENT_DIR=$( pwd)
6+ START_LOCAL_DIR=" ${CURRENT_DIR} /elastic-start-local"
7+ START_LOCAL_ENV_PATH=" ${START_LOCAL_DIR} /.env"
8+ START_LOCAL_UNINSTALL_FILE=" ${START_LOCAL_DIR} /uninstall.sh"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e -o pipefail
4+
5+ # Returns the HTTP status code from a call
6+ # usage: get_http_response_code url username password
7+ function get_http_response_code() {
8+ url=$1
9+ if [ -z " $url " ]; then
10+ echo " Error: you need to specify the URL for get the HTTP response"
11+ exit 1
12+ fi
13+ username=$2
14+ password=$3
15+
16+ if [ -z " $username " ] || [ -z " $password " ]; then
17+ result=$( curl -LI " $url " -o /dev/null -w ' %{http_code}\n' -s)
18+ else
19+ result=$( curl -LI -u " $username " :" $password " " $url " -o /dev/null -w ' %{http_code}\n' -s)
20+ fi
21+
22+ echo " $result "
23+ }
24+
25+ function start_local_elastic_stack() {
26+ curl -fsSL https://elastic.co/start-local | sh
27+ source " ${START_LOCAL_ENV_PATH} "
28+ sleep 2
29+ result=$( get_http_response_code " http://localhost:9200" " elastic" " ${ES_LOCAL_PASSWORD} " )
30+ assert_equals " 200" " $result "
31+ }
32+
33+ function uninstall_local_elastic_stack() {
34+ printf " yes\nno\n" | " ${START_LOCAL_UNINSTALL_FILE} "
35+ rm -rf " ${START_LOCAL_DIR} "
36+ }
37+
38+ function launch_demo() {
39+ deployment_type=" $1 "
40+ platform=" $2 "
41+ elasticsearch_endpoint=" ${ES_LOCAL_URL:- $3 } "
42+ elasticsearch_api_key=" ${ES_LOCAL_API_KEY} "
43+ printf " %s\n%s\n%s\n%s\n" " $deployment_type " " $platform " " $elasticsearch_endpoint " " $elasticsearch_api_key " | ./demo.sh
44+ }
45+
46+ function destroy_demo() {
47+ platform=" $1 "
48+ printf " %s\n" " $platform " | ./demo.sh destroy
49+ }
You can’t perform that action at this time.
0 commit comments