mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
Merge pull request #117627 from skitt/intstr-fromint32-cloud-node
kubelet: use new intstr functions
This commit is contained in:
commit
19830bf51b
@ -437,7 +437,7 @@ func TestLifeCycleHook(t *testing.T) {
|
|||||||
t.Run("consistent", func(t *testing.T) {
|
t.Run("consistent", func(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
defer func() { fakeHTTP.req = nil }()
|
defer func() { fakeHTTP.req = nil }()
|
||||||
httpLifeCycle.PreStop.HTTPGet.Port = intstr.FromInt(80)
|
httpLifeCycle.PreStop.HTTPGet.Port = intstr.FromInt32(80)
|
||||||
testPod.Spec.Containers[0].Lifecycle = httpLifeCycle
|
testPod.Spec.Containers[0].Lifecycle = httpLifeCycle
|
||||||
m.killContainer(ctx, testPod, cID, "foo", "testKill", "", &gracePeriod)
|
m.killContainer(ctx, testPod, cID, "foo", "testKill", "", &gracePeriod)
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ func TestContainerLabels(t *testing.T) {
|
|||||||
HTTPGet: &v1.HTTPGetAction{
|
HTTPGet: &v1.HTTPGetAction{
|
||||||
Path: "path",
|
Path: "path",
|
||||||
Host: "host",
|
Host: "host",
|
||||||
Port: intstr.FromInt(8080),
|
Port: intstr.FromInt32(8080),
|
||||||
Scheme: "scheme",
|
Scheme: "scheme",
|
||||||
},
|
},
|
||||||
TCPSocket: &v1.TCPSocketAction{
|
TCPSocket: &v1.TCPSocketAction{
|
||||||
@ -110,7 +110,7 @@ func TestContainerAnnotations(t *testing.T) {
|
|||||||
HTTPGet: &v1.HTTPGetAction{
|
HTTPGet: &v1.HTTPGetAction{
|
||||||
Path: "path",
|
Path: "path",
|
||||||
Host: "host",
|
Host: "host",
|
||||||
Port: intstr.FromInt(8080),
|
Port: intstr.FromInt32(8080),
|
||||||
Scheme: "scheme",
|
Scheme: "scheme",
|
||||||
},
|
},
|
||||||
TCPSocket: &v1.TCPSocketAction{
|
TCPSocket: &v1.TCPSocketAction{
|
||||||
|
@ -179,7 +179,7 @@ func TestRunHandlerHttp(t *testing.T) {
|
|||||||
PostStart: &v1.LifecycleHandler{
|
PostStart: &v1.LifecycleHandler{
|
||||||
HTTPGet: &v1.HTTPGetAction{
|
HTTPGet: &v1.HTTPGetAction{
|
||||||
Host: "foo",
|
Host: "foo",
|
||||||
Port: intstr.FromInt(8080),
|
Port: intstr.FromInt32(8080),
|
||||||
Path: "bar",
|
Path: "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -216,7 +216,7 @@ func TestRunHandlerHttpWithHeaders(t *testing.T) {
|
|||||||
PostStart: &v1.LifecycleHandler{
|
PostStart: &v1.LifecycleHandler{
|
||||||
HTTPGet: &v1.HTTPGetAction{
|
HTTPGet: &v1.HTTPGetAction{
|
||||||
Host: "foo",
|
Host: "foo",
|
||||||
Port: intstr.FromInt(8080),
|
Port: intstr.FromInt32(8080),
|
||||||
Path: "/bar",
|
Path: "/bar",
|
||||||
HTTPHeaders: []v1.HTTPHeader{
|
HTTPHeaders: []v1.HTTPHeader{
|
||||||
{Name: "Foo", Value: "bar"},
|
{Name: "Foo", Value: "bar"},
|
||||||
@ -739,7 +739,7 @@ func TestRunHandlerHttpFailure(t *testing.T) {
|
|||||||
PostStart: &v1.LifecycleHandler{
|
PostStart: &v1.LifecycleHandler{
|
||||||
HTTPGet: &v1.HTTPGetAction{
|
HTTPGet: &v1.HTTPGetAction{
|
||||||
Host: "foo",
|
Host: "foo",
|
||||||
Port: intstr.FromInt(8080),
|
Port: intstr.FromInt32(8080),
|
||||||
Path: "bar",
|
Path: "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -44,14 +44,14 @@ func TestGetURLParts(t *testing.T) {
|
|||||||
port int
|
port int
|
||||||
path string
|
path string
|
||||||
}{
|
}{
|
||||||
{&v1.HTTPGetAction{Host: "", Port: intstr.FromInt(-1), Path: ""}, false, "", -1, ""},
|
{&v1.HTTPGetAction{Host: "", Port: intstr.FromInt32(-1), Path: ""}, false, "", -1, ""},
|
||||||
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString(""), Path: ""}, false, "", -1, ""},
|
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString(""), Path: ""}, false, "", -1, ""},
|
||||||
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString("-1"), Path: ""}, false, "", -1, ""},
|
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString("-1"), Path: ""}, false, "", -1, ""},
|
||||||
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString("not-found"), Path: ""}, false, "", -1, ""},
|
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString("not-found"), Path: ""}, false, "", -1, ""},
|
||||||
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString("found"), Path: ""}, true, "127.0.0.1", 93, ""},
|
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString("found"), Path: ""}, true, "127.0.0.1", 93, ""},
|
||||||
{&v1.HTTPGetAction{Host: "", Port: intstr.FromInt(76), Path: ""}, true, "127.0.0.1", 76, ""},
|
{&v1.HTTPGetAction{Host: "", Port: intstr.FromInt32(76), Path: ""}, true, "127.0.0.1", 76, ""},
|
||||||
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString("118"), Path: ""}, true, "127.0.0.1", 118, ""},
|
{&v1.HTTPGetAction{Host: "", Port: intstr.FromString("118"), Path: ""}, true, "127.0.0.1", 118, ""},
|
||||||
{&v1.HTTPGetAction{Host: "hostname", Port: intstr.FromInt(76), Path: "path"}, true, "hostname", 76, "path"},
|
{&v1.HTTPGetAction{Host: "hostname", Port: intstr.FromInt32(76), Path: "path"}, true, "hostname", 76, "path"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
@ -98,12 +98,12 @@ func TestGetTCPAddrParts(t *testing.T) {
|
|||||||
host string
|
host string
|
||||||
port int
|
port int
|
||||||
}{
|
}{
|
||||||
{&v1.TCPSocketAction{Port: intstr.FromInt(-1)}, false, "", -1},
|
{&v1.TCPSocketAction{Port: intstr.FromInt32(-1)}, false, "", -1},
|
||||||
{&v1.TCPSocketAction{Port: intstr.FromString("")}, false, "", -1},
|
{&v1.TCPSocketAction{Port: intstr.FromString("")}, false, "", -1},
|
||||||
{&v1.TCPSocketAction{Port: intstr.FromString("-1")}, false, "", -1},
|
{&v1.TCPSocketAction{Port: intstr.FromString("-1")}, false, "", -1},
|
||||||
{&v1.TCPSocketAction{Port: intstr.FromString("not-found")}, false, "", -1},
|
{&v1.TCPSocketAction{Port: intstr.FromString("not-found")}, false, "", -1},
|
||||||
{&v1.TCPSocketAction{Port: intstr.FromString("found")}, true, "1.2.3.4", 93},
|
{&v1.TCPSocketAction{Port: intstr.FromString("found")}, true, "1.2.3.4", 93},
|
||||||
{&v1.TCPSocketAction{Port: intstr.FromInt(76)}, true, "1.2.3.4", 76},
|
{&v1.TCPSocketAction{Port: intstr.FromInt32(76)}, true, "1.2.3.4", 76},
|
||||||
{&v1.TCPSocketAction{Port: intstr.FromString("118")}, true, "1.2.3.4", 118},
|
{&v1.TCPSocketAction{Port: intstr.FromString("118")}, true, "1.2.3.4", 118},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user