Skip to content

Conversation

@minizhiren
Copy link

📝 PR Description

This PR stabilizes spring-cloud-config-sample tests that occasionally failed due to Micrometer’s global registry initialization.
The affected tests do not rely on metrics or tracing, so we disable these features to ensure isolated and deterministic test environments.

Changes:

Added src/test/resources/application.properties under spring-cloud-config-sample

Disabled global metric/tracing registration:

management.metrics.use-global-registry=false
management.metrics.export.simple.enabled=false
management.observations.enabled=false
management.tracing.enabled=false

Rationale:
Micrometer’s global registry can create non-deterministic state shared across tests.
Disabling it ensures clean and independent test runs without affecting functionality.

Validation Script

Click to view validation script
#!/usr/bin/env bash
set -euo pipefail

LOG_ROOT="$HOME/logs/logs_config_new"
mkdir -p "$LOG_ROOT"

REPO_DIR="$HOME/myRepo/spring-cloud-config"

NONDEX_VERSION="2.2.1"
NONDEX_RUNS="50"
NONDEX_MODE="FULL"
NONDEX_SEED="123456"

MODULE="spring-cloud-config-sample"

TESTS=(
  "sample.ConfigDataCustomMediaTypeIntegrationTests"
  "sample.ConfigDataOrderingIntegrationTests#contextLoads"
)

cd "$REPO_DIR"

SHA="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)"
TS="$(date +%Y%m%d-%H%M%S)"
LOG_FILE="$LOG_ROOT/sample-configdata-${TS}-${SHA}.log"

TEST_PART=""
for t in "${TESTS[@]}"; do
  if [ -z "$TEST_PART" ]; then
    TEST_PART="$t"
  else
    TEST_PART="$TEST_PART,$t"
  fi
done

CMD="./mvnw clean && \
./mvnw -pl ${MODULE} \
  edu.illinois:nondex-maven-plugin:${NONDEX_VERSION}:nondex \
  -Dtest=${TEST_PART} \
  -DnondexRuns=${NONDEX_RUNS} \
  -DnondexMode=${NONDEX_MODE} \
  -DnondexSeed=${NONDEX_SEED}"

{
  echo "==== [${MODULE} NonDex - sample tests] $(date) ===="
  echo "repo     : $REPO_DIR"
  echo "module   : $MODULE"
  echo "sha      : $SHA"
  echo "command  : $CMD"
  echo

  eval "$CMD"

  echo
  echo "==== DONE $(date) ===="
} | tee "$LOG_FILE"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants