Skip to content

Adapt fixtures and asserts in graceful-shutdown and product-config-compat tests - #765

Open
maltesander wants to merge 5 commits into
mainfrom
fix/weekly-test-failures
Open

Adapt fixtures and asserts in graceful-shutdown and product-config-compat tests#765
maltesander wants to merge 5 commits into
mainfrom
fix/weekly-test-failures

Conversation

@maltesander

Copy link
Copy Markdown
Member

Description

  • fix fixtures and asserts in graceful-shutdown and product-config-compat tests (failing in weekly)
  • improve assert loop to not spam output every second
    --- PASS: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/product-config-compat_openshift-false_spark-regression-3.5.8 (11.01s)
        --- PASS: kuttl/harness/graceful-shutdown_openshift-false_spark-4.1.1 (43.11s)
        --- PASS: kuttl/harness/graceful-shutdown_openshift-false_spark-3.5.8 (37.93s)
        --- PASS: kuttl/harness/graceful-shutdown_openshift-false_spark-4.1.2 (43.77s)
PASS

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Helm chart can be installed and deployed operator works
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible
  • Links to generated (nightly) docs added
  • Release note snippet added

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

@maltesander maltesander self-assigned this Sep 3, 2026

@Techassi Techassi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scripts are... hard to look at. I think we can make it slightly easier to look at them.

"security.properties": "networkaddress.cache.negative.ttl=0\nnetworkaddress.cache.ttl=30\n",
"spark-env.sh": "",
"template.yaml": "metadata:\n labels:\n app.kubernetes.io/component: spark\n app.kubernetes.io/instance: pyspark-pi\n app.kubernetes.io/managed-by: spark.stackable.tech_sparkapplication\n app.kubernetes.io/name: spark-k8s\n app.kubernetes.io/version: 3.5.8-stackable0.0.0-dev\n prometheus.io/scrape: 'true'\n stackable.tech/vendor: Stackable\n name: spark\nspec:\n affinity: {}\n containers:\n - env:\n - name: CONTAINERDEBUG_LOG_DIRECTORY\n value: /stackable/log/containerdebug\n - name: _STACKABLE_PRE_HOOK\n value: containerdebug --output=/stackable/log/containerdebug-state.json --loop &\n image: oci.stackable.tech/sdp/spark-k8s:3.5.8-stackable0.0.0-dev\n imagePullPolicy: IfNotPresent\n name: spark\n resources:\n limits:\n cpu: '2'\n memory: 1Gi\n requests:\n cpu: '1'\n memory: 1Gi\n volumeMounts:\n - mountPath: /stackable/log_config\n name: log-config\n - mountPath: /stackable/log\n name: log\n enableServiceLinks: false\n securityContext:\n fsGroup: 1000\n serviceAccountName: pyspark-pi\n volumes:\n - emptyDir:\n sizeLimit: 39Mi\n name: log\n - configMap:\n name: pyspark-pi-driver-pod-template\n name: log-config\n - configMap:\n name: pyspark-pi-driver-pod-template\n name: config\n"
"template.yaml": "metadata:\n labels:\n app.kubernetes.io/component: spark\n app.kubernetes.io/instance: pyspark-pi\n app.kubernetes.io/managed-by: spark.stackable.tech_sparkapplication\n app.kubernetes.io/name: spark-k8s\n app.kubernetes.io/version: 3.5.8-stackable0.0.0-dev\n prometheus.io/scrape: 'true'\n stackable.tech/vendor: Stackable\n name: spark\nspec:\n affinity: {}\n containers:\n - env:\n - name: CONTAINERDEBUG_LOG_DIRECTORY\n value: /stackable/log/containerdebug\n - name: _STACKABLE_PRE_HOOK\n value: containerdebug --output=/stackable/log/containerdebug-state.json --loop &\n image: oci.stackable.tech/sdp/spark-k8s:3.5.8-stackable0.0.0-dev\n imagePullPolicy: IfNotPresent\n name: spark\n resources:\n limits:\n cpu: '2'\n memory: 1Gi\n requests:\n cpu: '1'\n memory: 1Gi\n volumeMounts:\n - mountPath: /stackable/log_config\n name: log-config\n - mountPath: /stackable/log\n name: log\n enableServiceLinks: false\n securityContext:\n fsGroup: 1000\n runAsNonRoot: true\n serviceAccountName: pyspark-pi\n volumes:\n - emptyDir:\n sizeLimit: 39Mi\n name: log\n - configMap:\n name: pyspark-pi-driver-pod-template\n name: log-config\n - configMap:\n name: pyspark-pi-driver-pod-template\n name: config\n"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this change was triggered by the addition of "runAsNonRoot": true in the ...-spec.json file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, the json wasnt refreshed properly after #744.

Comment on lines +23 to +26
executors=$(kubectl -n "$NAMESPACE" get pods -l "spark-role=executor,app.kubernetes.io/instance=$app" -o json \
| jq -r '.items[]
| select(.metadata.deletionTimestamp == null and .status.phase == "Running")
| .metadata.name')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better formatting would make this slightly less cursed.

Suggested change
executors=$(kubectl -n "$NAMESPACE" get pods -l "spark-role=executor,app.kubernetes.io/instance=$app" -o json \
| jq -r '.items[]
| select(.metadata.deletionTimestamp == null and .status.phase == "Running")
| .metadata.name')
executors=$(
kubectl -n "$NAMESPACE" get pods \
-l "spark-role=executor,app.kubernetes.io/instance=$app" \
-o json | jq -r \
'
.items[]
| select(.metadata.deletionTimestamp == null and .status.phase == "Running")
| .metadata.name'
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaned up 6a8d8ba

fi
if [ -z "$executors" ]; then
echo "FAIL: no executor Pods found for $app, so no shutdown can be propagated to any"
running=$(printf '%s\n' "$executors" | grep -c . || true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for counting the number of running executor? If so, this can be done better by using jq's length function.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 6a8d8ba

if [ -z "$executors" ]; then
echo "FAIL: no executor Pods found for $app, so no shutdown can be propagated to any"
running=$(printf '%s\n' "$executors" | grep -c . || true)
if [ "$running" -ne 2 ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, numerical equality checks are tricky. We have to be really certain bash thinks $running is a number and not a string containing a number.

@maltesander maltesander Sep 4, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jq length fixed this automatically (and it is not bash: POSIX test is an arithmetic comparison).

Comment on lines +19 to +22
for pod in $(kubectl -n "$NAMESPACE" get pods -l "$selector" -o json \
| jq -r '.items[]
| select(.metadata.deletionTimestamp == null and .status.phase == "Running")
| .metadata.name'); do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should pull this out of the loop header. It is currently cumbersome to read.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed 678d450

Comment thread tests/templates/kuttl/graceful-shutdown/12-assert.yaml Outdated
Comment on lines +36 to +37
echo "FAIL: ${budget_seconds}s after the executor was stopped, $registered of 2"
echo "executors are registered and running a task, so no replacement came back"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use a single echo -e here for newlines?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The echo -e does not work for kuttls sh -c. Could do printf?

@maltesander
maltesander requested a review from Techassi September 4, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants