1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
From: Shengjing Zhu <zhsj@debian.org>
Date: Fri, 16 Dec 2022 02:34:18 +0800
Subject: Remove depends on google.golang.org/protobuf/proto
Forwarded: not-needed
---
.../container_update_resources_linux_test.go | 61 +++++++++++-----------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/pkg/cri/server/container_update_resources_linux_test.go b/pkg/cri/server/container_update_resources_linux_test.go
index 33a6acf..8466b00 100644
--- a/pkg/cri/server/container_update_resources_linux_test.go
+++ b/pkg/cri/server/container_update_resources_linux_test.go
@@ -22,7 +22,6 @@ import (
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/assert"
- "google.golang.org/protobuf/proto"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
criconfig "github.com/containerd/containerd/pkg/cri/config"
@@ -30,6 +29,8 @@ import (
)
func TestUpdateOCILinuxResource(t *testing.T) {
+ newI64 := func(i int64) *int64 { return &i }
+ newU64 := func(i uint64) *uint64 { return &i }
oomscoreadj := new(int)
*oomscoreadj = -500
expectedSwap := func(swap int64) *int64 {
@@ -49,11 +50,11 @@ func TestUpdateOCILinuxResource(t *testing.T) {
Process: &runtimespec.Process{OOMScoreAdj: oomscoreadj},
Linux: &runtimespec.Linux{
Resources: &runtimespec.LinuxResources{
- Memory: &runtimespec.LinuxMemory{Limit: proto.Int64(12345)},
+ Memory: &runtimespec.LinuxMemory{Limit: newI64(12345)},
CPU: &runtimespec.LinuxCPU{
- Shares: proto.Uint64(1111),
- Quota: proto.Int64(2222),
- Period: proto.Uint64(3333),
+ Shares: newU64(1111),
+ Quota: newI64(2222),
+ Period: newU64(3333),
Cpus: "0-1",
Mems: "2-3",
},
@@ -78,13 +79,13 @@ func TestUpdateOCILinuxResource(t *testing.T) {
Linux: &runtimespec.Linux{
Resources: &runtimespec.LinuxResources{
Memory: &runtimespec.LinuxMemory{
- Limit: proto.Int64(54321),
+ Limit: newI64(54321),
Swap: expectedSwap(54321),
},
CPU: &runtimespec.LinuxCPU{
- Shares: proto.Uint64(4444),
- Quota: proto.Int64(5555),
- Period: proto.Uint64(6666),
+ Shares: newU64(4444),
+ Quota: newI64(5555),
+ Period: newU64(6666),
Cpus: "4-5",
Mems: "6-7",
},
@@ -98,11 +99,11 @@ func TestUpdateOCILinuxResource(t *testing.T) {
Process: &runtimespec.Process{OOMScoreAdj: oomscoreadj},
Linux: &runtimespec.Linux{
Resources: &runtimespec.LinuxResources{
- Memory: &runtimespec.LinuxMemory{Limit: proto.Int64(12345)},
+ Memory: &runtimespec.LinuxMemory{Limit: newI64(12345)},
CPU: &runtimespec.LinuxCPU{
- Shares: proto.Uint64(1111),
- Quota: proto.Int64(2222),
- Period: proto.Uint64(3333),
+ Shares: newU64(1111),
+ Quota: newI64(2222),
+ Period: newU64(3333),
Cpus: "0-1",
Mems: "2-3",
},
@@ -124,13 +125,13 @@ func TestUpdateOCILinuxResource(t *testing.T) {
Linux: &runtimespec.Linux{
Resources: &runtimespec.LinuxResources{
Memory: &runtimespec.LinuxMemory{
- Limit: proto.Int64(54321),
+ Limit: newI64(54321),
Swap: expectedSwap(54321),
},
CPU: &runtimespec.LinuxCPU{
- Shares: proto.Uint64(4444),
- Quota: proto.Int64(5555),
- Period: proto.Uint64(3333),
+ Shares: newU64(4444),
+ Quota: newI64(5555),
+ Period: newU64(3333),
Cpus: "0-1",
Mems: "6-7",
},
@@ -144,7 +145,7 @@ func TestUpdateOCILinuxResource(t *testing.T) {
Process: &runtimespec.Process{OOMScoreAdj: oomscoreadj},
Linux: &runtimespec.Linux{
Resources: &runtimespec.LinuxResources{
- Memory: &runtimespec.LinuxMemory{Limit: proto.Int64(12345)},
+ Memory: &runtimespec.LinuxMemory{Limit: newI64(12345)},
},
},
},
@@ -165,13 +166,13 @@ func TestUpdateOCILinuxResource(t *testing.T) {
Linux: &runtimespec.Linux{
Resources: &runtimespec.LinuxResources{
Memory: &runtimespec.LinuxMemory{
- Limit: proto.Int64(54321),
+ Limit: newI64(54321),
Swap: expectedSwap(54321),
},
CPU: &runtimespec.LinuxCPU{
- Shares: proto.Uint64(4444),
- Quota: proto.Int64(5555),
- Period: proto.Uint64(6666),
+ Shares: newU64(4444),
+ Quota: newI64(5555),
+ Period: newU64(6666),
Cpus: "4-5",
Mems: "6-7",
},
@@ -185,11 +186,11 @@ func TestUpdateOCILinuxResource(t *testing.T) {
Process: &runtimespec.Process{OOMScoreAdj: oomscoreadj},
Linux: &runtimespec.Linux{
Resources: &runtimespec.LinuxResources{
- Memory: &runtimespec.LinuxMemory{Limit: proto.Int64(12345)},
+ Memory: &runtimespec.LinuxMemory{Limit: newI64(12345)},
CPU: &runtimespec.LinuxCPU{
- Shares: proto.Uint64(1111),
- Quota: proto.Int64(2222),
- Period: proto.Uint64(3333),
+ Shares: newU64(1111),
+ Quota: newI64(2222),
+ Period: newU64(3333),
Cpus: "0-1",
Mems: "2-3",
},
@@ -214,13 +215,13 @@ func TestUpdateOCILinuxResource(t *testing.T) {
Linux: &runtimespec.Linux{
Resources: &runtimespec.LinuxResources{
Memory: &runtimespec.LinuxMemory{
- Limit: proto.Int64(54321),
+ Limit: newI64(54321),
Swap: expectedSwap(54321),
},
CPU: &runtimespec.LinuxCPU{
- Shares: proto.Uint64(4444),
- Quota: proto.Int64(5555),
- Period: proto.Uint64(6666),
+ Shares: newU64(4444),
+ Quota: newI64(5555),
+ Period: newU64(6666),
Cpus: "4-5",
Mems: "6-7",
},
|