mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-02-21 22:57:15 +00:00
Merge pull request #124318 from liangyuanpeng/drop-ptr-wrappers-pkg-util
pkg/util: drop pointer wrapper functions.
This commit is contained in:
@@ -28,7 +28,7 @@ import (
|
||||
"github.com/lithammer/dedent"
|
||||
|
||||
"k8s.io/kubernetes/pkg/util/iptables"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func TestParseRule(t *testing.T) {
|
||||
@@ -139,8 +139,8 @@ func TestParseRule(t *testing.T) {
|
||||
Comment: &IPTablesValue{Value: "ns1/svc1:p80"},
|
||||
AffinityName: &IPTablesValue{Value: "KUBE-SEP-SXIVWICOYRO3J4NJ"},
|
||||
AffinitySeconds: &IPTablesValue{Value: "10800"},
|
||||
AffinityCheck: utilpointer.Bool(true),
|
||||
AffinityReap: utilpointer.Bool(true),
|
||||
AffinityCheck: ptr.To(true),
|
||||
AffinityReap: ptr.To(true),
|
||||
Jump: &IPTablesValue{Value: "KUBE-SEP-SXIVWICOYRO3J4NJ"},
|
||||
},
|
||||
},
|
||||
@@ -200,7 +200,7 @@ func TestParseRule(t *testing.T) {
|
||||
parsed: &Rule{
|
||||
Raw: `-A TEST -m recent ! --rcheck -j KUBE-SEP-SXIVWICOYRO3J4NJ`,
|
||||
Chain: iptables.Chain("TEST"),
|
||||
AffinityCheck: utilpointer.Bool(false),
|
||||
AffinityCheck: ptr.To(false),
|
||||
Jump: &IPTablesValue{Value: "KUBE-SEP-SXIVWICOYRO3J4NJ"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/core/validation"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -99,20 +99,20 @@ var (
|
||||
Key: "foo",
|
||||
Operator: api.TolerationOpExists,
|
||||
Effect: api.TaintEffectNoExecute,
|
||||
TolerationSeconds: utilpointer.Int64Ptr(10),
|
||||
TolerationSeconds: ptr.To[int64](10),
|
||||
},
|
||||
"foo-noexec-0": {
|
||||
Key: "foo",
|
||||
Operator: api.TolerationOpExists,
|
||||
Effect: api.TaintEffectNoExecute,
|
||||
TolerationSeconds: utilpointer.Int64Ptr(0),
|
||||
TolerationSeconds: ptr.To[int64](0),
|
||||
},
|
||||
"foo-bar-noexec-10": {
|
||||
Key: "foo",
|
||||
Operator: api.TolerationOpEqual,
|
||||
Value: "bar",
|
||||
Effect: api.TaintEffectNoExecute,
|
||||
TolerationSeconds: utilpointer.Int64Ptr(10),
|
||||
TolerationSeconds: ptr.To[int64](10),
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -338,7 +338,7 @@ func TestFuzzed(t *testing.T) {
|
||||
gen.Value = strings.Repeat("b", r.Intn(6)+1)
|
||||
}
|
||||
if gen.Effect == api.TaintEffectNoExecute && r.Float32() < tolerationSecondsProbability {
|
||||
gen.TolerationSeconds = utilpointer.Int64Ptr(r.Int63n(10))
|
||||
gen.TolerationSeconds = ptr.To[int64](r.Int63n(10))
|
||||
}
|
||||
// Ensure only valid tolerations are generated.
|
||||
require.NoError(t, validation.ValidateTolerations([]api.Toleration{gen}, field.NewPath("")).ToAggregate(), "%#v", gen)
|
||||
|
||||
Reference in New Issue
Block a user