server: fix pod filter by truncated id
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
15f23bc6ac
commit
e7492ca12f
2 changed files with 11 additions and 1 deletions
|
@ -39,7 +39,11 @@ func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxReque
|
||||||
// Filter by pod id first.
|
// Filter by pod id first.
|
||||||
if filter != nil {
|
if filter != nil {
|
||||||
if filter.Id != nil {
|
if filter.Id != nil {
|
||||||
sb := s.getSandbox(*filter.Id)
|
id, err := s.podIDIndex.Get(*filter.Id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
sb := s.getSandbox(id)
|
||||||
if sb == nil {
|
if sb == nil {
|
||||||
podList = []*sandbox{}
|
podList = []*sandbox{}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -112,6 +112,12 @@ function teardown() {
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[[ "$output" != "" ]]
|
[[ "$output" != "" ]]
|
||||||
[[ "$output" =~ "$pod1_id" ]]
|
[[ "$output" =~ "$pod1_id" ]]
|
||||||
|
# filter by truncated id should work as well
|
||||||
|
run ocic pod list --id "${pod1_id:0:4}"
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" != "" ]]
|
||||||
|
[[ "$output" =~ "$pod1_id" ]]
|
||||||
run ocic pod list --id "$pod2_id"
|
run ocic pod list --id "$pod2_id"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
Loading…
Add table
Reference in a new issue