mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Fix a bug in pod listing introduced in a recent refactor.
Add a test to catch a regression in the future.
This commit is contained in:
parent
f57ae2f4bf
commit
77dd0afc26
@ -78,6 +78,7 @@ func (registry *EtcdRegistry) ListPods(query labels.Query) ([]api.Pod, error) {
|
||||
}
|
||||
for _, pod := range machinePods {
|
||||
if query.Matches(labels.Set(pod.Labels)) {
|
||||
pod.CurrentState.Host = machine
|
||||
pods = append(pods, pod)
|
||||
}
|
||||
}
|
||||
|
@ -354,6 +354,10 @@ func TestEtcdListPods(t *testing.T) {
|
||||
if len(pods) != 2 || pods[0].ID != "foo" || pods[1].ID != "bar" {
|
||||
t.Errorf("Unexpected pod list: %#v", pods)
|
||||
}
|
||||
if pods[0].CurrentState.Host != "machine" ||
|
||||
pods[1].CurrentState.Host != "machine" {
|
||||
t.Errorf("Failed to populate host name.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEtcdListControllersNotFound(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user