Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Parameterise ES cluster yaml in tests #179

Merged
merged 2 commits into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions hack/e2e.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#!/bin/bash
set -eux


: ${TEST_PREFIX:=""}

: ${NAVIGATOR_IMAGE_REPOSITORY:="jetstackexperimental"}
: ${NAVIGATOR_IMAGE_TAG:="build"}
: ${NAVIGATOR_IMAGE_PULLPOLICY:="Never"}

export \
NAVIGATOR_IMAGE_REPOSITORY \
NAVIGATOR_IMAGE_TAG \
NAVIGATOR_IMAGE_PULLPOLICY

NAVIGATOR_NAMESPACE="navigator"
RELEASE_NAME="nav-e2e"

Expand Down Expand Up @@ -102,7 +114,11 @@ function test_elasticsearchcluster() {
# Create and delete an ElasticSearchCluster
if ! kubectl create \
--namespace "${namespace}" \
--filename "${SCRIPT_DIR}/testdata/es-cluster-test.yaml"; then
--filename \
<(envsubst \
'$NAVIGATOR_IMAGE_REPOSITORY:$NAVIGATOR_IMAGE_TAG:$NAVIGATOR_IMAGE_PULLPOLICY' \
< "${SCRIPT_DIR}/testdata/es-cluster-test.template.yaml")
then
fail_test "Failed to create elasticsearchcluster"
fi
if ! kubectl get \
Expand Down Expand Up @@ -130,12 +146,14 @@ function test_elasticsearchcluster() {
fi
}

ES_TEST_NS="test-elasticsearchcluster-${TEST_ID}"
test_elasticsearchcluster "${ES_TEST_NS}"
if [ "${FAILURE_COUNT}" -gt "0" ]; then
fail_and_exit "${ES_TEST_NS}"
if [[ "test_elasticsearchcluster" = "${TEST_PREFIX}"* ]]; then
ES_TEST_NS="test-elasticsearchcluster-${TEST_ID}"
test_elasticsearchcluster "${ES_TEST_NS}"
if [ "${FAILURE_COUNT}" -gt "0" ]; then
fail_and_exit "${ES_TEST_NS}"
fi
kube_delete_namespace_and_wait "${ES_TEST_NS}"
fi
kube_delete_namespace_and_wait "${ES_TEST_NS}"

function cql_connect() {
local namespace="${1}"
Expand Down Expand Up @@ -238,9 +256,11 @@ function test_cassandracluster() {
fi
}

CASS_TEST_NS="test-cassandra-${TEST_ID}"
test_cassandracluster "${CASS_TEST_NS}"
if [ "${FAILURE_COUNT}" -gt "0" ]; then
fail_and_exit "${CASS_TEST_NS}"
if [[ "test_cassandracluster" = "${TEST_PREFIX}"* ]]; then
CASS_TEST_NS="test-cassandra-${TEST_ID}"
test_cassandracluster "${CASS_TEST_NS}"
if [ "${FAILURE_COUNT}" -gt "0" ]; then
fail_and_exit "${CASS_TEST_NS}"
fi
kube_delete_namespace_and_wait "${CASS_TEST_NS}"
fi
kube_delete_namespace_and_wait "${CASS_TEST_NS}"
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ spec:
- vm.max_map_count=262144

pilot:
repository: jetstackexperimental/navigator-pilot-elasticsearch
tag: build
pullPolicy: Never
repository: ${NAVIGATOR_IMAGE_REPOSITORY}/navigator-pilot-elasticsearch
tag: ${NAVIGATOR_IMAGE_TAG}
pullPolicy: ${NAVIGATOR_IMAGE_PULLPOLICY}

image:
repository: docker.elastic.co/elasticsearch/elasticsearch
Expand Down