← Back to Pull requests

Adding E2e tests (TC 6-9) #22

Open
unknown opened this pull request with 400 lines diff across 5 files
View on GitHub
unknown unknown commented on Jul 01, 2026 10:44 UTC
Author

(TC 6-7) DownwardAPIAssignedResources Feature Gate Toggle Test

This PR adds an e2e test verifying the full feature gate lifecycle (ON→OFF→ON) for DownwardAPIAssignedResources:

  • Stage 1: Start cluster with gate ON + CPU manager static policy

  • Stage 2: Create GU pod with assigned.cpuset DownwardAPI volume

  • Stage 3: Verify cpuset visible via exec into container

  • Stage 4: Toggle gate OFF; existing pod survives with cpusets on disk

  • Stage 5: Create new pod with gate OFF

  • Stage 6: Verify assigned.cpuset dropped from spec and not visible in container

  • Stage 7: Toggle gate back ON; pod2 still running without assigned.cpuset (not retroactively restored)

  • Stage 8: Create new pod with gate ON; assigned.cpuset present and visible
  • (TC 8-9) CPU Scale-Down Delay During Kubelet Upgrade/Downgrade

    This PR adds an e2e test (TestCPUScaleDownDelayKubeletUpgradeDowngrade) that validates the CPU scale-down delay behavior during kubelet upgrade and downgrade scenarios:

  • Stage 0 - Download Previous Release Binaries: Downloads the previous Kubernetes release tarball to obtain the older kubelet binary for downgrade testing
  • Stage 1 - Create Cluster with Master Binary: Starts a local cluster with master kubelet, DownwardAPIAssignedResources=true, and CPU manager static policy with scale-delay-time=10s
  • Stage 2 - Pod-A: Scale Up & Scale Down Test: Creates a Guaranteed pod with DownwardAPI volume; performs scale-up (1→2 CPUs), then initiates scale-down (2→1 CPUs), but doesn't wait for scale-down actuation.
  • Stage 3 & 4 - Kubelet Downgrade & Pod State Verification: Downgrades kubelet to previous release; disables DownwardAPIAssignedResources; verifies Pod-A survives downgrade; creates Pod-B to verify DownwardAPI cpuset is NOT populated with old kubelet
  • Stage 5 - Kubelet Restore & Final Verification: Restores kubelet to master binary; re-enables feature gate; performs scale-up/down on Pod-B to confirm scale-delay-time is respected
  • File Changes Summary

    1. feature_gate_toggle_test/downward_api_assigned_resources_toggle_test.go: Contains TC (6-7) - Feature gate toggle test implementation

    2. kubelet_upgrade_downgrade/cpu_scale_down_delay_test.go: Contains TC (8-9) - Kubelet upgrade/downgrade test with CPU scale-down delay validation

    3. common/kubelet_version_utils.go: Contains common functions to detect current K8s version and download old K8s binaries (implementation same as DRA team's, now exported for reuse)

    4. common/resize.go: Contains common resize verification methods (implementation same as cpu_manager_test.go, moved here since Go doesn't allow exporting functions from test packages; modified to use ktesting framework instead of ginkgo)

    5. utils/localupcluster.go: Adds ModifyFlagsByComponent field to ModifyOptions that allows modifying, replacing, or deleting command-line flags per component during cluster.Modify(). This is needed for the kubelet upgrade/downgrade e2e test where the previous kubelet binary doesn't recognize certain flags and feature gates added in the current release.

    Diff: 400 lines (+300 / -100) across 5 files Reviewer: Chunxia202410 Review duration: 217096m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.52) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 400 lines diff across 5 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.359
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #22"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 51.7% (MEDIUM) · Higher = larger blast radius
    51.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 28.6% · Safe to merge
    28.6%