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

Commit

Permalink
Merge pull request #179 from wallrj/parameterise-es-yaml
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Parameterise ES cluster yaml in tests

Allows me to override the ES pilot image parameters when I'm running tests manually on GKE.

Using `envsubst` as a much lighter weight alternative to using helm chart. Discovered via: kubernetes/kubernetes#23896 (comment)


Stacked on #177 

**Release note**:
```release-note
NONE
```
  • Loading branch information
jetstack-ci-bot committed Jan 8, 2018
2 parents c2b2a24 + 25d4624 commit 9a78702
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
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

0 comments on commit 9a78702

Please sign in to comment.