Skip to content

Commit 5dd2955

Browse files
committed
test: adapt smoke test to logging changes
1 parent faade27 commit 5dd2955

5 files changed

Lines changed: 108 additions & 1350 deletions

tests/templates/kuttl/smoke/30-assert.yaml.j2

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,14 @@ spec:
408408
name: data
409409
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
410410
- args:
411-
- |
411+
- |-
412412
mkdir --parents /stackable/log/_vector-state
413413
# Vector will ignore SIGTERM (as PID != 1) and must be shut down by writing a shutdown trigger file
414-
vector --config /stackable/config/vector.yaml & vector_pid=$!
414+
vector & vector_pid=$!
415415
if [ ! -f "/stackable/log/_vector/shutdown" ]; then
416-
mkdir -p /stackable/log/_vector && inotifywait -qq --event create /stackable/log/_vector; fi
416+
mkdir -p /stackable/log/_vector
417+
inotifywait -qq --event create /stackable/log/_vector;
418+
fi
417419
sleep 1
418420
kill $vector_pid
419421
command:
@@ -423,13 +425,31 @@ spec:
423425
- pipefail
424426
- -c
425427
env:
426-
- name: VECTOR_LOG
427-
value: info
428+
- name: CLUSTER_NAME
429+
value: hdfs
430+
- name: DATA_DIR
431+
value: /stackable/log/_vector-state
432+
- name: LOG_DIR
433+
value: /stackable/log
434+
- name: NAMESPACE
435+
valueFrom:
436+
fieldRef:
437+
fieldPath: metadata.namespace
438+
- name: ROLE_GROUP_NAME
439+
value: default
440+
- name: ROLE_NAME
441+
value: namenode
428442
- name: VECTOR_AGGREGATOR_ADDRESS
429443
valueFrom:
430444
configMapKeyRef:
431445
key: ADDRESS
432446
name: vector-aggregator-discovery
447+
- name: VECTOR_CONFIG_YAML
448+
value: /stackable/config/vector.yaml
449+
- name: VECTOR_FILE_LOG_LEVEL
450+
value: info
451+
- name: VECTOR_LOG
452+
value: info
433453
imagePullPolicy: IfNotPresent
434454
name: vector
435455
resources:
@@ -440,8 +460,10 @@ spec:
440460
cpu: 250m
441461
memory: 128Mi
442462
volumeMounts:
443-
- mountPath: /stackable/config
463+
- mountPath: /stackable/config/vector.yaml
444464
name: hdfs-config
465+
readOnly: true
466+
subPath: vector.yaml
445467
- mountPath: /stackable/log
446468
name: log
447469
{% endif %}

tests/templates/kuttl/smoke/31-assert.yaml.j2

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
# envsubst expands only the listed shell variables ($NAMESPACE etc.),
77
# leaving Hadoop ${env.FOO} references untouched.
88
#
9+
# The static vector.yaml is parameterised with Vector env-var refs like ${NAMESPACE}
10+
# that must stay literal in the ConfigMap. Since envsubst '$NAMESPACE' would expand
11+
# both `$NAMESPACE` (the core-site DNS, which we DO want substituted) and the literal
12+
# `${NAMESPACE}` in vector.yaml, we temporarily mask the braces form around envsubst.
13+
#
914
# kuttl runs script commands with sh, not bash, so process substitution
1015
# is unavailable. Temp files namespaced under $NAMESPACE are used for
1116
# diff output to avoid collisions when tests run concurrently.
@@ -17,7 +22,7 @@ commands:
1722
# ConfigMap data snapshot: hdfs-namenode-default
1823
#
1924
- script: |
20-
envsubst '$NAMESPACE' < 31_configmap_hdfs-namenode-default.yaml > /tmp/$NAMESPACE-expected.yaml
25+
sed 's/${NAMESPACE}/__VECTOR_NS__/g' 31_configmap_hdfs-namenode-default.yaml | envsubst '$NAMESPACE' | sed 's/__VECTOR_NS__/${NAMESPACE}/g' > /tmp/$NAMESPACE-expected.yaml
2126
kubectl -n $NAMESPACE get cm hdfs-namenode-default -o yaml | yq '.data' > /tmp/$NAMESPACE-actual.yaml
2227
if ! diff /tmp/$NAMESPACE-expected.yaml /tmp/$NAMESPACE-actual.yaml; then
2328
echo "ERROR: ConfigMap hdfs-namenode-default data drifted from snapshot."
@@ -32,7 +37,7 @@ commands:
3237
{% else %}
3338
export DATANODE_DATA_DIR='[DISK]/stackable/data/data/datanode'
3439
{% endif %}
35-
envsubst '$NAMESPACE $DATANODE_DATA_DIR' < 31_configmap_hdfs-datanode-default.yaml > /tmp/$NAMESPACE-expected.yaml
40+
sed 's/${NAMESPACE}/__VECTOR_NS__/g' 31_configmap_hdfs-datanode-default.yaml | envsubst '$NAMESPACE $DATANODE_DATA_DIR' | sed 's/__VECTOR_NS__/${NAMESPACE}/g' > /tmp/$NAMESPACE-expected.yaml
3641
kubectl -n $NAMESPACE get cm hdfs-datanode-default -o yaml | yq '.data' > /tmp/$NAMESPACE-actual.yaml
3742
if ! diff /tmp/$NAMESPACE-expected.yaml /tmp/$NAMESPACE-actual.yaml; then
3843
echo "ERROR: ConfigMap hdfs-datanode-default data drifted from snapshot."
@@ -42,7 +47,7 @@ commands:
4247
# ConfigMap data snapshot: hdfs-journalnode-default
4348
#
4449
- script: |
45-
envsubst '$NAMESPACE' < 31_configmap_hdfs-journalnode-default.yaml > /tmp/$NAMESPACE-expected.yaml
50+
sed 's/${NAMESPACE}/__VECTOR_NS__/g' 31_configmap_hdfs-journalnode-default.yaml | envsubst '$NAMESPACE' | sed 's/__VECTOR_NS__/${NAMESPACE}/g' > /tmp/$NAMESPACE-expected.yaml
4651
kubectl -n $NAMESPACE get cm hdfs-journalnode-default -o yaml | yq '.data' > /tmp/$NAMESPACE-actual.yaml
4752
if ! diff /tmp/$NAMESPACE-expected.yaml /tmp/$NAMESPACE-actual.yaml; then
4853
echo "ERROR: ConfigMap hdfs-journalnode-default data drifted from snapshot."

0 commit comments

Comments
 (0)