mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Do not set empty field or label selectors on requests
Default behavior for "" is already "everything"
This commit is contained in:
parent
a99bb4823b
commit
502204ad6d
@ -180,6 +180,9 @@ func (r *Request) SelectorParam(paramName string, s labels.Selector) *Request {
|
|||||||
if r.err != nil {
|
if r.err != nil {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
if s.Empty() {
|
||||||
|
return r
|
||||||
|
}
|
||||||
return r.setParam(paramName, s.String())
|
return r.setParam(paramName, s.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ func TestCreateLists(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
// Minion
|
// Minion
|
||||||
{
|
{
|
||||||
location: "/api/" + testapi.Version() + "/minions?fields=",
|
location: "/api/" + testapi.Version() + "/minions",
|
||||||
factory: factory.createMinionLW,
|
factory: factory.createMinionLW,
|
||||||
},
|
},
|
||||||
// Assigned pod
|
// Assigned pod
|
||||||
@ -95,15 +95,15 @@ func TestCreateWatches(t *testing.T) {
|
|||||||
// Minion watch
|
// Minion watch
|
||||||
{
|
{
|
||||||
rv: "",
|
rv: "",
|
||||||
location: "/api/" + testapi.Version() + "/watch/minions?fields=&resourceVersion=",
|
location: "/api/" + testapi.Version() + "/watch/minions?resourceVersion=",
|
||||||
factory: factory.createMinionLW,
|
factory: factory.createMinionLW,
|
||||||
}, {
|
}, {
|
||||||
rv: "0",
|
rv: "0",
|
||||||
location: "/api/" + testapi.Version() + "/watch/minions?fields=&resourceVersion=0",
|
location: "/api/" + testapi.Version() + "/watch/minions?resourceVersion=0",
|
||||||
factory: factory.createMinionLW,
|
factory: factory.createMinionLW,
|
||||||
}, {
|
}, {
|
||||||
rv: "42",
|
rv: "42",
|
||||||
location: "/api/" + testapi.Version() + "/watch/minions?fields=&resourceVersion=42",
|
location: "/api/" + testapi.Version() + "/watch/minions?resourceVersion=42",
|
||||||
factory: factory.createMinionLW,
|
factory: factory.createMinionLW,
|
||||||
},
|
},
|
||||||
// Assigned pod watches
|
// Assigned pod watches
|
||||||
|
Loading…
Reference in New Issue
Block a user