From c2a06e7912cdec093c59a65aff74a726bb88be1e Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 22 Jul 2025 12:36:43 +0300 Subject: [PATCH] DRA: skip flaky test case on Windows Added a skipOnWindows flag to DynamicResources scheduler test case to skip test that relies on nanosecond timer precision. Windows timer granularity is much coarser than Linux, which causes the test to fail often. --- .../plugins/dynamicresources/dynamicresources_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go index 0438b63af20..75dc8594327 100644 --- a/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go +++ b/pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + goruntime "runtime" + "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/assert" @@ -387,6 +389,7 @@ func TestPlugin(t *testing.T) { enableDRAPrioritizedList bool enableDRADeviceTaints bool disableDRASchedulerFilterTimeout bool + skipOnWindows string }{ "empty": { pod: st.MakePod().Name("foo").Namespace("default").Obj(), @@ -1041,6 +1044,10 @@ func TestPlugin(t *testing.T) { status: fwk.NewStatus(fwk.Unschedulable, `still not schedulable`), }, }, + // Skipping this test case on Windows as a 1ns timeout is not guaranteed to + // expire immediately on Windows due to its coarser timer granularity - + // typically in the range of 0.5 to 15.6 ms + skipOnWindows: "coarse timer granularity", }, "timeout_disabled": { // This variant uses the normal test objects to avoid excessive runtime. @@ -1108,6 +1115,9 @@ func TestPlugin(t *testing.T) { } for name, tc := range testcases { + if len(tc.skipOnWindows) > 0 && goruntime.GOOS == "windows" { + t.Skipf("Skipping '%s' test case on Windows, reason: %s", name, tc.skipOnWindows) + } // We can run in parallel because logging is per-test. tc := tc t.Run(name, func(t *testing.T) {