Skip to content

Commit 9320593

Browse files
committed
Add "slow" to scenario requirements for better reuse
1 parent f7a7aee commit 9320593

11 files changed

Lines changed: 46 additions & 11 deletions

test/bin/vm_scheduler.sh

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@
4242
# multiple processes try to create VMs concurrently.
4343
#
4444
# ============================================================================
45+
# SCENARIO REQUIREMENTS
46+
# ============================================================================
47+
#
48+
# Scenarios opt-in to dynamic scheduling by defining dynamic_schedule_requirements().
49+
# Supported fields:
50+
# - min_vcpus: Minimum vCPUs required (default: DEFAULT_VM_VCPUS)
51+
# - min_memory: Minimum memory in MB (default: DEFAULT_VM_MEMORY)
52+
# - min_disksize: Minimum disk size in GB
53+
# - networks: Required networks (empty = network-agnostic, can run on any VM)
54+
# - boot_image: Required boot image
55+
# - fips: Whether FIPS mode is required
56+
# - slow: Set to "true" for long-running tests (e.g., router, conformance)
57+
# Slow tests get priority within their reusability tier to avoid
58+
# becoming the critical path.
59+
#
60+
# ============================================================================
4561

4662
set -euo pipefail
4763

@@ -669,11 +685,14 @@ sort_scenarios_for_reuse() {
669685
# 1. Reusability score (ascending): restrictive scenarios first
670686
# - They can't be reused anyway, so get them out of the way
671687
# - Their VMs are destroyed when done
672-
# 2. Within same reusability: boot_image descending (optionals before source)
673-
# 3. Then vcpus descending (larger VMs first)
688+
# 2. Within same reusability: slow tests first (ascending 0=slow, 1=normal)
689+
# - Long-running tests start early to avoid becoming critical path
690+
# 3. Then boot_image descending (optionals before source)
691+
# 4. Then vcpus descending (larger VMs first)
674692
#
675693
# This ensures:
676694
# - Restrictive scenarios (special networks/boot_images) start first
695+
# - Slow tests start early within their reusability tier
677696
# - Flexible scenarios stay queued longer, maximizing reuse opportunities
678697

679698
for scenario_script in "${scenarios[@]}"; do
@@ -682,19 +701,25 @@ sort_scenarios_for_reuse() {
682701
local req_file="${SCENARIO_STATUS}/${scenario_name}/requirements"
683702

684703
if [ -f "${req_file}" ]; then
685-
local boot_image networks vcpus reuse_score
704+
local boot_image networks vcpus reuse_score slow_flag slow_sort
686705
boot_image=$(get_req_value "${req_file}" "boot_image" "default")
687706
networks=$(get_req_value "${req_file}" "networks" "default")
688707
vcpus=$(get_req_value "${req_file}" "min_vcpus" "${DEFAULT_VM_VCPUS}")
708+
slow_flag=$(get_req_value "${req_file}" "slow" "false")
689709
reuse_score=$(get_reusability_score "${boot_image}" "${networks}")
690-
# Sort key: reuse_score (asc), boot_image (desc), vcpus (desc)
710+
# slow=true -> sort value 0 (first), slow=false -> sort value 1 (after)
711+
slow_sort=1
712+
if [ "${slow_flag}" = "true" ]; then
713+
slow_sort=0
714+
fi
715+
# Sort key: reuse_score (asc), slow_sort (asc), boot_image (desc), vcpus (desc)
691716
# Use inverse vcpus (100-vcpus) so ascending sort gives descending vcpus
692-
printf "%d\t%s\t%02d\t%s\n" "${reuse_score}" "${boot_image}" "$((100 - vcpus))" "${scenario_script}"
717+
printf "%d\t%d\t%s\t%02d\t%s\n" "${reuse_score}" "${slow_sort}" "${boot_image}" "$((100 - vcpus))" "${scenario_script}"
693718
else
694719
# Unknown requirements - treat as flexible, put last
695-
printf "9\taaa\t99\t%s\n" "${scenario_script}"
720+
printf "9\t1\taaa\t99\t%s\n" "${scenario_script}"
696721
fi
697-
done | sort -t$'\t' -k1,1n -k2,2r -k3,3n | cut -f4
722+
done | sort -t$'\t' -k1,1n -k2,2n -k3,3r -k4,4n | cut -f5
698723
}
699724

700725
# Global sequence counter for queue ordering

test/scenarios-bootc/presubmits/el98-src@cert-manager.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ min_disksize=25
2626
networks="${NETWORKS}"
2727
boot_image=rhel98-bootc-source-optionals
2828
fips=false
29+
slow=true
2930
EOF
3031
}
3132

test/scenarios-bootc/presubmits/el98-src@gateway-api.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ min_disksize=25
2626
networks="${NETWORKS}"
2727
boot_image=rhel98-bootc-source-optionals
2828
fips=false
29+
slow=true
2930
EOF
3031
}
3132

test/scenarios-bootc/presubmits/el98-src@generic-device-plugin.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ min_disksize=25
2626
networks="${NETWORKS}"
2727
boot_image=rhel98-bootc-source-optionals
2828
fips=false
29+
slow=true
2930
EOF
3031
}
3132

test/scenarios-bootc/presubmits/el98-src@multi-nic.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ min_disksize=20
1111
networks=default,"${VM_MULTUS_NETWORK}"
1212
boot_image=rhel98-bootc-source
1313
fips=false
14+
slow=true
1415
EOF
1516
}
1617

test/scenarios-bootc/presubmits/el98-src@olm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ min_disksize=25
2626
networks="${NETWORKS}"
2727
boot_image=rhel98-bootc-source-optionals
2828
fips=false
29+
slow=true
2930
EOF
3031
}
3132

test/scenarios-bootc/presubmits/el98-src@router.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ dynamic_schedule_requirements() {
88
min_vcpus=2
99
min_memory=4096
1010
min_disksize=20
11-
networks=default
11+
networks=
1212
boot_image=rhel98-bootc-source
1313
fips=false
14+
slow=true
1415
EOF
1516
}
1617

test/scenarios-bootc/presubmits/el98-src@upgrade-fails.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ dynamic_schedule_requirements() {
88
min_vcpus=2
99
min_memory=4096
1010
min_disksize=20
11-
networks=default
11+
networks=
1212
boot_image=rhel98-bootc-source
1313
fips=false
14+
slow=true
1415
EOF
1516
}
1617

test/scenarios/presubmits/el98-src@multi-nic.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ min_disksize=20
1111
networks=default,"${VM_MULTUS_NETWORK}"
1212
boot_image=rhel-9.6-microshift-source
1313
fips=false
14+
slow=true
1415
EOF
1516
}
1617

test/scenarios/presubmits/el98-src@router.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ dynamic_schedule_requirements() {
88
min_vcpus=2
99
min_memory=4096
1010
min_disksize=20
11-
networks=default
11+
networks=
1212
boot_image=rhel-9.6-microshift-source
1313
fips=false
14+
slow=true
1415
EOF
1516
}
1617

0 commit comments

Comments
 (0)