mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	test: sched: replace pointer use with ptr
				
					
				
			As `pointer` functions are deprecated, replace those functions calls with `ptr.To`. Fixes: https://github.com/kubernetes/kubernetes/issues/130408 Signed-off-by: Shereen Haj <shajmakh@redhat.com>
This commit is contained in:
		@@ -38,7 +38,7 @@ import (
 | 
			
		||||
	testutils "k8s.io/kubernetes/test/integration/util"
 | 
			
		||||
	imageutils "k8s.io/kubernetes/test/utils/image"
 | 
			
		||||
	"k8s.io/kubernetes/test/utils/ktesting"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
@@ -1472,7 +1472,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
 | 
			
		||||
					"node",
 | 
			
		||||
					hardSpread,
 | 
			
		||||
					st.MakeLabelSelector().Exists("foo").Obj(),
 | 
			
		||||
					pointer.Int32(4), // larger than the number of domains (= 3)
 | 
			
		||||
					ptr.To[int32](4), // larger than the number of domains (= 3)
 | 
			
		||||
					nil,
 | 
			
		||||
					nil,
 | 
			
		||||
					nil,
 | 
			
		||||
@@ -1498,7 +1498,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
 | 
			
		||||
					"node",
 | 
			
		||||
					hardSpread,
 | 
			
		||||
					st.MakeLabelSelector().Exists("foo").Obj(),
 | 
			
		||||
					pointer.Int32(2), // smaller than the number of domains (= 3)
 | 
			
		||||
					ptr.To[int32](2), // smaller than the number of domains (= 3)
 | 
			
		||||
					nil,
 | 
			
		||||
					nil,
 | 
			
		||||
					nil,
 | 
			
		||||
@@ -1523,7 +1523,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
 | 
			
		||||
					"zone",
 | 
			
		||||
					v1.DoNotSchedule,
 | 
			
		||||
					st.MakeLabelSelector().Exists("foo").Obj(),
 | 
			
		||||
					pointer.Int32(3), // larger than the number of domains(2)
 | 
			
		||||
					ptr.To[int32](3), // larger than the number of domains(2)
 | 
			
		||||
					nil,
 | 
			
		||||
					nil,
 | 
			
		||||
					nil,
 | 
			
		||||
@@ -1545,7 +1545,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
 | 
			
		||||
					"zone",
 | 
			
		||||
					v1.DoNotSchedule,
 | 
			
		||||
					st.MakeLabelSelector().Exists("foo").Obj(),
 | 
			
		||||
					pointer.Int32(1), // smaller than the number of domains(2)
 | 
			
		||||
					ptr.To[int32](1), // smaller than the number of domains(2)
 | 
			
		||||
					nil,
 | 
			
		||||
					nil,
 | 
			
		||||
					nil,
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ import (
 | 
			
		||||
	schedulerutils "k8s.io/kubernetes/test/integration/scheduler"
 | 
			
		||||
	testutils "k8s.io/kubernetes/test/integration/util"
 | 
			
		||||
	imageutils "k8s.io/kubernetes/test/utils/image"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// imported from testutils
 | 
			
		||||
@@ -919,7 +919,7 @@ func TestPostFilterPlugin(t *testing.T) {
 | 
			
		||||
			// Setup plugins for testing.
 | 
			
		||||
			cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
				Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
					SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
					SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
					Plugins: &configv1.Plugins{
 | 
			
		||||
						Filter: configv1.PluginSet{
 | 
			
		||||
							Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -1208,7 +1208,7 @@ func TestPrebindPlugin(t *testing.T) {
 | 
			
		||||
			cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
				Profiles: []configv1.KubeSchedulerProfile{
 | 
			
		||||
					{
 | 
			
		||||
						SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
						SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
						Plugins: &configv1.Plugins{
 | 
			
		||||
							PreBind: configv1.PluginSet{
 | 
			
		||||
								Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -1218,7 +1218,7 @@ func TestPrebindPlugin(t *testing.T) {
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						SchedulerName: pointer.String("2nd-scheduler"),
 | 
			
		||||
						SchedulerName: ptr.To("2nd-scheduler"),
 | 
			
		||||
						Plugins: &configv1.Plugins{
 | 
			
		||||
							Filter: configv1.PluginSet{
 | 
			
		||||
								Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -1748,7 +1748,7 @@ func TestBindPlugin(t *testing.T) {
 | 
			
		||||
			// Setup initial unreserve and bind plugins for testing.
 | 
			
		||||
			cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
				Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
					SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
					SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
					Plugins: &configv1.Plugins{
 | 
			
		||||
						MultiPoint: configv1.PluginSet{
 | 
			
		||||
							Disabled: []configv1.Plugin{
 | 
			
		||||
@@ -2461,7 +2461,7 @@ func TestPreemptWithPermitPlugin(t *testing.T) {
 | 
			
		||||
			cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
				Profiles: []configv1.KubeSchedulerProfile{
 | 
			
		||||
					{
 | 
			
		||||
						SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
						SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
						Plugins: &configv1.Plugins{
 | 
			
		||||
							Permit: configv1.PluginSet{
 | 
			
		||||
								Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -2647,7 +2647,7 @@ func TestActivatePods(t *testing.T) {
 | 
			
		||||
	// Setup initial filter plugin for testing.
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
			SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
			Plugins: &configv1.Plugins{
 | 
			
		||||
				PreFilter: configv1.PluginSet{
 | 
			
		||||
					Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -2823,7 +2823,7 @@ func TestPreEnqueuePluginEventsToRegister(t *testing.T) {
 | 
			
		||||
				// Setup plugins for testing.
 | 
			
		||||
				cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
					Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
						SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
						SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
						Plugins: &configv1.Plugins{
 | 
			
		||||
							PreEnqueue: configv1.PluginSet{
 | 
			
		||||
								Enabled: []configv1.Plugin{
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,6 @@ import (
 | 
			
		||||
	"k8s.io/kubernetes/plugin/pkg/admission/priority"
 | 
			
		||||
	testutils "k8s.io/kubernetes/test/integration/util"
 | 
			
		||||
	"k8s.io/kubernetes/test/utils/ktesting"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -175,7 +174,7 @@ func TestPreemption(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
			SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
			Plugins: &configv1.Plugins{
 | 
			
		||||
				Filter: configv1.PluginSet{
 | 
			
		||||
					Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -874,7 +873,7 @@ func TestAsyncPreemption(t *testing.T) {
 | 
			
		||||
			}
 | 
			
		||||
			cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
				Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
					SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
					SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
					Plugins: &configv1.Plugins{
 | 
			
		||||
						MultiPoint: configv1.PluginSet{
 | 
			
		||||
							Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -1654,7 +1653,7 @@ func TestNominatedNodeCleanUp(t *testing.T) {
 | 
			
		||||
			t.Run(fmt.Sprintf("%s (Async preemption enabled: %v)", tt.name, asyncPreemptionEnabled), func(t *testing.T) {
 | 
			
		||||
				cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
					Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
						SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
						SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
						Plugins:       tt.customPlugins,
 | 
			
		||||
					}},
 | 
			
		||||
				})
 | 
			
		||||
@@ -2146,7 +2145,7 @@ func TestPreferNominatedNode(t *testing.T) {
 | 
			
		||||
func TestReadWriteOncePodPreemption(t *testing.T) {
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.StringPtr(v1.DefaultSchedulerName),
 | 
			
		||||
			SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
			Plugins: &configv1.Plugins{
 | 
			
		||||
				Filter: configv1.PluginSet{
 | 
			
		||||
					Enabled: []configv1.Plugin{
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ import (
 | 
			
		||||
	testfwk "k8s.io/kubernetes/test/integration/framework"
 | 
			
		||||
	testutils "k8s.io/kubernetes/test/integration/util"
 | 
			
		||||
	imageutils "k8s.io/kubernetes/test/utils/image"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestSchedulingGates(t *testing.T) {
 | 
			
		||||
@@ -264,7 +264,7 @@ func TestCustomResourceEnqueue(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
			SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
			Plugins: &configv1.Plugins{
 | 
			
		||||
				Filter: configv1.PluginSet{
 | 
			
		||||
					Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -378,7 +378,7 @@ func TestRequeueByBindFailure(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
			SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
			Plugins: &configv1.Plugins{
 | 
			
		||||
				MultiPoint: configv1.PluginSet{
 | 
			
		||||
					Enabled: []configv1.Plugin{
 | 
			
		||||
@@ -471,7 +471,7 @@ func TestRequeueByPermitRejection(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
			SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
			Plugins: &configv1.Plugins{
 | 
			
		||||
				MultiPoint: configv1.PluginSet{
 | 
			
		||||
					Enabled: []configv1.Plugin{
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ import (
 | 
			
		||||
	configtesting "k8s.io/kubernetes/pkg/scheduler/apis/config/testing"
 | 
			
		||||
	st "k8s.io/kubernetes/pkg/scheduler/testing"
 | 
			
		||||
	testutils "k8s.io/kubernetes/test/integration/util"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type nodeMutationFunc func(t *testing.T, n *v1.Node, nodeLister corelisters.NodeLister, c clientset.Interface)
 | 
			
		||||
@@ -248,13 +248,13 @@ func TestMultipleSchedulers(t *testing.T) {
 | 
			
		||||
	// 5. create and start a scheduler with name "foo-scheduler"
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.String(fooScheduler),
 | 
			
		||||
			SchedulerName: ptr.To(fooScheduler),
 | 
			
		||||
			PluginConfig: []configv1.PluginConfig{
 | 
			
		||||
				{
 | 
			
		||||
					Name: "VolumeBinding",
 | 
			
		||||
					Args: runtime.RawExtension{
 | 
			
		||||
						Object: &configv1.VolumeBindingArgs{
 | 
			
		||||
							BindTimeoutSeconds: pointer.Int64(30),
 | 
			
		||||
							BindTimeoutSeconds: ptr.To[int64](30),
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
@@ -278,8 +278,8 @@ func TestMultipleSchedulers(t *testing.T) {
 | 
			
		||||
func TestMultipleSchedulingProfiles(t *testing.T) {
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{
 | 
			
		||||
			{SchedulerName: pointer.String("default-scheduler")},
 | 
			
		||||
			{SchedulerName: pointer.String("custom-scheduler")},
 | 
			
		||||
			{SchedulerName: ptr.To("default-scheduler")},
 | 
			
		||||
			{SchedulerName: ptr.To("custom-scheduler")},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ import (
 | 
			
		||||
	st "k8s.io/kubernetes/pkg/scheduler/testing"
 | 
			
		||||
	testutils "k8s.io/kubernetes/test/integration/util"
 | 
			
		||||
	imageutils "k8s.io/kubernetes/test/utils/image"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// imported from testutils
 | 
			
		||||
@@ -80,7 +80,7 @@ const (
 | 
			
		||||
func initTestSchedulerForScoringTests(t *testing.T, preScorePluginName, scorePluginName string) *testutils.TestContext {
 | 
			
		||||
	cc := configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
			SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
			Plugins: &configv1.Plugins{
 | 
			
		||||
				PreScore: configv1.PluginSet{
 | 
			
		||||
					Disabled: []configv1.Plugin{
 | 
			
		||||
@@ -89,7 +89,7 @@ func initTestSchedulerForScoringTests(t *testing.T, preScorePluginName, scorePlu
 | 
			
		||||
				},
 | 
			
		||||
				Score: configv1.PluginSet{
 | 
			
		||||
					Enabled: []configv1.Plugin{
 | 
			
		||||
						{Name: scorePluginName, Weight: pointer.Int32(1)},
 | 
			
		||||
						{Name: scorePluginName, Weight: ptr.To[int32](1)},
 | 
			
		||||
					},
 | 
			
		||||
					Disabled: []configv1.Plugin{
 | 
			
		||||
						{Name: "*"},
 | 
			
		||||
@@ -117,7 +117,7 @@ func initTestSchedulerForNodeResourcesTest(t *testing.T, strategy configv1.Scori
 | 
			
		||||
	cfg := configtesting.V1ToInternalWithDefaults(t, configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{
 | 
			
		||||
			{
 | 
			
		||||
				SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
				SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
				PluginConfig: []configv1.PluginConfig{
 | 
			
		||||
					{
 | 
			
		||||
						Name: noderesources.Name,
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ import (
 | 
			
		||||
	frameworkruntime "k8s.io/kubernetes/pkg/scheduler/framework/runtime"
 | 
			
		||||
	st "k8s.io/kubernetes/pkg/scheduler/testing"
 | 
			
		||||
	testutils "k8s.io/kubernetes/test/integration/util"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// The returned shutdown func will delete created resources and scheduler, resources should be those
 | 
			
		||||
@@ -140,7 +140,7 @@ func InitRegistryAndConfig(t *testing.T, factory func(plugin framework.Plugin) f
 | 
			
		||||
 | 
			
		||||
	versionedCfg := configv1.KubeSchedulerConfiguration{
 | 
			
		||||
		Profiles: []configv1.KubeSchedulerProfile{{
 | 
			
		||||
			SchedulerName: pointer.String(v1.DefaultSchedulerName),
 | 
			
		||||
			SchedulerName: ptr.To(v1.DefaultSchedulerName),
 | 
			
		||||
			Plugins:       pls,
 | 
			
		||||
		}},
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user