mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-05-19 00:00:14 +08:00
chore: replace int32Ptr usage with ptr.To
Kubernetes-commit: e0f9914ef726bd5bcafcdadf5a6a0a6e92d9a885
This commit is contained in:
committed by
Kubernetes Publisher
parent
346d1ccd4e
commit
64ae4a258c
+6
-7
@@ -34,6 +34,7 @@ import (
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/klog/v2/ktesting"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
samplecontroller "k8s.io/sample-controller/pkg/apis/samplecontroller/v1alpha1"
|
||||
"k8s.io/sample-controller/pkg/generated/clientset/versioned/fake"
|
||||
@@ -247,7 +248,7 @@ func getRef(foo *samplecontroller.Foo, t *testing.T) cache.ObjectName {
|
||||
|
||||
func TestCreatesDeployment(t *testing.T) {
|
||||
f := newFixture(t)
|
||||
foo := newFoo("test", int32Ptr(1))
|
||||
foo := newFoo("test", ptr.To[int32](1))
|
||||
_, ctx := ktesting.NewTestContext(t)
|
||||
|
||||
f.fooLister = append(f.fooLister, foo)
|
||||
@@ -262,7 +263,7 @@ func TestCreatesDeployment(t *testing.T) {
|
||||
|
||||
func TestDoNothing(t *testing.T) {
|
||||
f := newFixture(t)
|
||||
foo := newFoo("test", int32Ptr(1))
|
||||
foo := newFoo("test", ptr.To[int32](1))
|
||||
_, ctx := ktesting.NewTestContext(t)
|
||||
|
||||
d := newDeployment(foo)
|
||||
@@ -278,13 +279,13 @@ func TestDoNothing(t *testing.T) {
|
||||
|
||||
func TestUpdateDeployment(t *testing.T) {
|
||||
f := newFixture(t)
|
||||
foo := newFoo("test", int32Ptr(1))
|
||||
foo := newFoo("test", ptr.To[int32](1))
|
||||
_, ctx := ktesting.NewTestContext(t)
|
||||
|
||||
d := newDeployment(foo)
|
||||
|
||||
// Update replicas
|
||||
foo.Spec.Replicas = int32Ptr(2)
|
||||
foo.Spec.Replicas = ptr.To[int32](2)
|
||||
expDeployment := newDeployment(foo)
|
||||
|
||||
f.fooLister = append(f.fooLister, foo)
|
||||
@@ -299,7 +300,7 @@ func TestUpdateDeployment(t *testing.T) {
|
||||
|
||||
func TestNotControlledByUs(t *testing.T) {
|
||||
f := newFixture(t)
|
||||
foo := newFoo("test", int32Ptr(1))
|
||||
foo := newFoo("test", ptr.To[int32](1))
|
||||
_, ctx := ktesting.NewTestContext(t)
|
||||
|
||||
d := newDeployment(foo)
|
||||
@@ -313,5 +314,3 @@ func TestNotControlledByUs(t *testing.T) {
|
||||
|
||||
f.runExpectError(ctx, getRef(foo, t))
|
||||
}
|
||||
|
||||
func int32Ptr(i int32) *int32 { return &i }
|
||||
|
||||
Reference in New Issue
Block a user