server: fix ctr filter by truncated id
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
e7492ca12f
commit
f2b4fda554
2 changed files with 10 additions and 1 deletions
|
@ -36,7 +36,11 @@ func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersReque
|
||||||
// Filter using container id and pod id first.
|
// Filter using container id and pod id first.
|
||||||
if filter != nil {
|
if filter != nil {
|
||||||
if filter.Id != nil {
|
if filter.Id != nil {
|
||||||
c := s.state.containers.Get(*filter.Id)
|
id, err := s.ctrIDIndex.Get(*filter.Id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
c := s.state.containers.Get(id)
|
||||||
if c != nil {
|
if c != nil {
|
||||||
if filter.PodSandboxId != nil {
|
if filter.PodSandboxId != nil {
|
||||||
if c.Sandbox() == *filter.PodSandboxId {
|
if c.Sandbox() == *filter.PodSandboxId {
|
||||||
|
|
|
@ -187,6 +187,11 @@ function teardown() {
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[[ "$output" != "" ]]
|
[[ "$output" != "" ]]
|
||||||
[[ "$output" =~ "$ctr1_id" ]]
|
[[ "$output" =~ "$ctr1_id" ]]
|
||||||
|
run ocic ctr list --id "${ctr1_id:0:4}" --quiet
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" != "" ]]
|
||||||
|
[[ "$output" =~ "$ctr1_id" ]]
|
||||||
run ocic ctr list --id "$ctr2_id" --pod "$pod2_id" --quiet
|
run ocic ctr list --id "$ctr2_id" --pod "$pod2_id" --quiet
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
Loading…
Reference in a new issue