mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-01 17:44:30 +00:00
Align lifecycle handlers and probes
Align the behavior of HTTP-based lifecycle handlers and HTTP-based probers, converging on the probers implementation. This fixes multiple deficiencies in the current implementation of lifecycle handlers surrounding what functionality is available. The functionality is gated by the features.ConsistentHTTPGetHandlers feature gate.
This commit is contained in:
committed by
Billie Cleek
parent
429f71d958
commit
5a6acf85fa
43
pkg/probe/util_test.go
Normal file
43
pkg/probe/util_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package probe
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
func TestFindPortByName(t *testing.T) {
|
||||
container := v1.Container{
|
||||
Ports: []v1.ContainerPort{
|
||||
{
|
||||
Name: "foo",
|
||||
ContainerPort: 8080,
|
||||
},
|
||||
{
|
||||
Name: "bar",
|
||||
ContainerPort: 9000,
|
||||
},
|
||||
},
|
||||
}
|
||||
want := 8080
|
||||
got, err := findPortByName(&container, "foo")
|
||||
if got != want || err != nil {
|
||||
t.Errorf("Expected %v, got %v, err: %v", want, got, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user