mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 11:38:15 +00:00
convert pointer to ptr for sig-apps integration tests
This commit is contained in:
parent
1596bc962b
commit
1a41ed394d
@ -59,7 +59,7 @@ import (
|
||||
"k8s.io/kubernetes/test/integration/util"
|
||||
"k8s.io/kubernetes/test/utils/ktesting"
|
||||
"k8s.io/utils/clock"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
const stalePodDisruptionTimeout = 3 * time.Second
|
||||
@ -585,7 +585,7 @@ func TestPatchCompatibility(t *testing.T) {
|
||||
version: "v1",
|
||||
patchType: types.ApplyPatchType,
|
||||
patch: `{"apiVersion":"policy/v1","kind":"PodDisruptionBudget","spec":{"selector":{"matchLabels":{"patchmatch":"true"},"matchExpressions":[{"key":"patchexpression","operator":"In","values":["true"]}]}}}`,
|
||||
force: pointer.Bool(true),
|
||||
force: ptr.To(true),
|
||||
fieldManager: "test",
|
||||
// entire selector is replaced (because structType=atomic)
|
||||
expectSelector: &metav1.LabelSelector{
|
||||
|
@ -52,7 +52,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/controller/garbagecollector"
|
||||
"k8s.io/kubernetes/test/integration"
|
||||
"k8s.io/kubernetes/test/integration/framework"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func getForegroundOptions() metav1.DeleteOptions {
|
||||
@ -355,7 +355,7 @@ func testCrossNamespaceReferences(t *testing.T, watchCache bool) {
|
||||
}
|
||||
for i := 0; i < validChildrenCount; i++ {
|
||||
_, err := clientSet.CoreV1().Secrets(namespaceB).Create(context.TODO(), &v1.Secret{ObjectMeta: metav1.ObjectMeta{GenerateName: "child-", OwnerReferences: []metav1.OwnerReference{
|
||||
{Name: "parent", Kind: "ConfigMap", APIVersion: "v1", UID: parent.UID, Controller: pointer.BoolPtr(false)},
|
||||
{Name: "parent", Kind: "ConfigMap", APIVersion: "v1", UID: parent.UID, Controller: ptr.To(false)},
|
||||
}}}, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@ -369,7 +369,7 @@ func testCrossNamespaceReferences(t *testing.T, watchCache bool) {
|
||||
for i := 0; i < 25; i++ {
|
||||
invalidOwnerReferences = append(invalidOwnerReferences, metav1.OwnerReference{Name: "invalid", UID: types.UID(fmt.Sprintf("invalid-%d", i)), APIVersion: "test/v1", Kind: fmt.Sprintf("invalid%d", i)})
|
||||
}
|
||||
invalidOwnerReferences = append(invalidOwnerReferences, metav1.OwnerReference{Name: "invalid", UID: parent.UID, APIVersion: "v1", Kind: "Pod", Controller: pointer.BoolPtr(false)})
|
||||
invalidOwnerReferences = append(invalidOwnerReferences, metav1.OwnerReference{Name: "invalid", UID: parent.UID, APIVersion: "v1", Kind: "Pod", Controller: ptr.To(false)})
|
||||
|
||||
for i := 0; i < workers; i++ {
|
||||
_, err := clientSet.CoreV1().ConfigMaps(namespaceA).Create(context.TODO(), &v1.ConfigMap{ObjectMeta: metav1.ObjectMeta{GenerateName: "invalid-child-", OwnerReferences: invalidOwnerReferences}}, metav1.CreateOptions{})
|
||||
@ -384,7 +384,7 @@ func testCrossNamespaceReferences(t *testing.T, watchCache bool) {
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{"single-bad-reference": "true"},
|
||||
GenerateName: "invalid-child-b-",
|
||||
OwnerReferences: []metav1.OwnerReference{{Name: "invalid", UID: parent.UID, APIVersion: "v1", Kind: "Pod", Controller: pointer.BoolPtr(false)}},
|
||||
OwnerReferences: []metav1.OwnerReference{{Name: "invalid", UID: parent.UID, APIVersion: "v1", Kind: "Pod", Controller: ptr.To(false)}},
|
||||
},
|
||||
}, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
@ -434,7 +434,7 @@ func testCrossNamespaceReferences(t *testing.T, watchCache bool) {
|
||||
invalidChild, err := clientSet.CoreV1().Secrets(namespaceA).Create(context.TODO(), &v1.Secret{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
GenerateName: "invalid-child-c-",
|
||||
OwnerReferences: []metav1.OwnerReference{{Name: "invalid", UID: parent.UID, APIVersion: "v1", Kind: "Pod", Controller: pointer.BoolPtr(false)}},
|
||||
OwnerReferences: []metav1.OwnerReference{{Name: "invalid", UID: parent.UID, APIVersion: "v1", Kind: "Pod", Controller: ptr.To(false)}},
|
||||
},
|
||||
}, metav1.CreateOptions{})
|
||||
if err != nil {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/controller/podgc"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
testutils "k8s.io/kubernetes/test/integration/util"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
// TestPodGcOrphanedPodsWithFinalizer tests deletion of orphaned pods
|
||||
@ -256,7 +256,7 @@ func TestTerminatingOnOutOfServiceNode(t *testing.T) {
|
||||
}
|
||||
|
||||
// trigger termination of the pod, but with long grace period so that it is not removed immediately
|
||||
err = cs.CoreV1().Pods(testCtx.NS.Name).Delete(testCtx.Ctx, pod.Name, metav1.DeleteOptions{GracePeriodSeconds: pointer.Int64(300)})
|
||||
err = cs.CoreV1().Pods(testCtx.NS.Name).Delete(testCtx.Ctx, pod.Name, metav1.DeleteOptions{GracePeriodSeconds: ptr.To[int64](300)})
|
||||
if err != nil {
|
||||
t.Fatalf("Error: '%v' while deleting pod: '%v'", err, klog.KObj(pod))
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/test/integration/framework"
|
||||
testutil "k8s.io/kubernetes/test/utils"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -681,7 +681,7 @@ func TestPodDeletionCost(t *testing.T) {
|
||||
// Change RS's number of replics to 1
|
||||
rsClient := c.AppsV1().ReplicaSets(ns.Name)
|
||||
updateRS(t, rsClient, rs.Name, func(rs *apps.ReplicaSet) {
|
||||
rs.Spec.Replicas = pointer.Int32(1)
|
||||
rs.Spec.Replicas = ptr.To[int32](1)
|
||||
})
|
||||
|
||||
// Poll until ReplicaSet is downscaled to 1.
|
||||
|
@ -67,7 +67,7 @@ import (
|
||||
"k8s.io/kubernetes/test/integration/framework"
|
||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||
"k8s.io/kubernetes/test/utils/ktesting"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
// ShutdownFunc represents the function handle to be called, typically in a defer handler, to shutdown a running module
|
||||
@ -652,7 +652,7 @@ func InitTestSchedulerWithNS(t *testing.T, nsPrefix string, opts ...scheduler.Op
|
||||
func InitTestDisablePreemption(t *testing.T, nsPrefix string) *TestContext {
|
||||
cfg := configtesting.V1ToInternalWithDefaults(t, kubeschedulerconfigv1.KubeSchedulerConfiguration{
|
||||
Profiles: []kubeschedulerconfigv1.KubeSchedulerProfile{{
|
||||
SchedulerName: pointer.String(v1.DefaultSchedulerName),
|
||||
SchedulerName: ptr.To(v1.DefaultSchedulerName),
|
||||
Plugins: &kubeschedulerconfigv1.Plugins{
|
||||
PostFilter: kubeschedulerconfigv1.PluginSet{
|
||||
Disabled: []kubeschedulerconfigv1.Plugin{
|
||||
|
Loading…
Reference in New Issue
Block a user