mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-15 09:01:31 +00:00
fix: update test for explicit error handling
This commit is contained in:
@@ -470,9 +470,13 @@ func TestIntegration_EBSUnmountInvalidJSON(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer nc.Close()
|
||||
|
||||
// Current code silently returns without responding on unmarshal failure
|
||||
_, err = nc.Request("ebs.test-node.unmount", []byte("not json {{{"), 1*time.Second)
|
||||
assert.Error(t, err, "expected timeout because handler silently drops invalid JSON")
|
||||
// Handler responds with an error payload on invalid JSON
|
||||
msg, err := nc.Request("ebs.test-node.unmount", []byte("not json {{{"), 1*time.Second)
|
||||
require.NoError(t, err, "handler should respond even on invalid JSON")
|
||||
|
||||
var resp types.EBSUnMountResponse
|
||||
require.NoError(t, json.Unmarshal(msg.Data, &resp))
|
||||
assert.Contains(t, resp.Error, "bad request")
|
||||
}
|
||||
|
||||
// --- ebs.delete with VB instance (StopWALSyncer path) ---
|
||||
|
||||
@@ -26,7 +26,7 @@ if [[ -z "$QUIET" ]]; then
|
||||
go tool cover -func="$PROFILE" | tail -1
|
||||
fi
|
||||
|
||||
PASS=$(echo "$TOTAL >= $MIN" | bc -l)
|
||||
PASS=$(awk "BEGIN {print ($TOTAL >= $MIN) ? 1 : 0}")
|
||||
if [[ "$PASS" != "1" ]]; then
|
||||
echo "ERROR: Total coverage ${TOTAL}% is below minimum ${MIN}%"
|
||||
exit 1
|
||||
|
||||
@@ -255,20 +255,15 @@ if has_service "nats"; then
|
||||
set_oom_score "nats" "-500"
|
||||
check_service "NATS" "$NATS_CHECK_HOST" "4222"
|
||||
|
||||
# Ensure NATS JetStream is ready before Predastore starts.
|
||||
# Wait for NATS JetStream to be ready before Predastore starts.
|
||||
# Predastore lazily opens IAM KV buckets — it starts with config-only auth
|
||||
# and activates IAM auth once the hive daemon creates the KV buckets.
|
||||
echo "🔍 Waiting for NATS JetStream..."
|
||||
NATS_JS_READY=false
|
||||
for i in $(seq 1 15); do
|
||||
if nats -s nats://$NATS_CHECK_HOST:4222 stream ls --names 2>/dev/null | grep -q "KV_" 2>/dev/null; then
|
||||
echo " ✅ NATS JetStream is ready (KV streams found)"
|
||||
NATS_JS_READY=true
|
||||
break
|
||||
fi
|
||||
# JetStream may be up with no KV buckets yet (fresh install before admin init)
|
||||
if nats -s nats://$NATS_CHECK_HOST:4222 account info 2>/dev/null | grep -q "JetStream" 2>/dev/null; then
|
||||
echo " ✅ NATS JetStream is ready (no KV buckets yet — run 'hive admin init' to bootstrap)"
|
||||
# Send a NATS INFO probe — JetStream-enabled servers include "jetstream" in the INFO response
|
||||
if echo "" | nc -w 1 "$NATS_CHECK_HOST" 4222 2>/dev/null | grep -q "jetstream"; then
|
||||
echo " ✅ NATS JetStream is ready"
|
||||
NATS_JS_READY=true
|
||||
break
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user