Use Int32Ptr function from utils instead of self-written versions
This commit is contained in:
@@ -29,6 +29,7 @@ import (
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
corev1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
utilpointer "k8s.io/kubernetes/pkg/util/pointer"
|
||||
|
||||
// enforce that all types are installed
|
||||
_ "k8s.io/kubernetes/pkg/api/testapi"
|
||||
@@ -164,12 +165,6 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func newInt(val int32) *int32 {
|
||||
p := new(int32)
|
||||
*p = val
|
||||
return p
|
||||
}
|
||||
|
||||
func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
tests := []struct {
|
||||
rc v1.ReplicationController
|
||||
@@ -192,7 +187,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
{
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(0),
|
||||
Replicas: utilpointer.Int32Ptr(0),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@@ -207,7 +202,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
{
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(3),
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@@ -1274,7 +1269,7 @@ func TestDefaultRequestIsNotSetForReplicationController(t *testing.T) {
|
||||
}
|
||||
rc := &v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(3),
|
||||
Replicas: utilpointer.Int32Ptr(3),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user