Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: tests fix, nit fix
Browse files Browse the repository at this point in the history
fix tests and nit

Signed-off-by: Alex Price <[email protected]>
  • Loading branch information
awprice committed Apr 29, 2020
1 parent db28dcf commit b4833a4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion containerd-shim-v2/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func startContainer(ctx context.Context, s *service, c *container) error {
go watchSandbox(s)

// Start watching for oom events
go watchOOMEvents(s)
go watchOOMEvents(ctx, s)
} else {
_, err := s.sandbox.StartContainer(c.id)
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions containerd-shim-v2/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package containerdshim

import (
"context"
"path"
"time"

Expand Down Expand Up @@ -128,14 +129,14 @@ func watchSandbox(s *service) {
// No need to send async events here.
}

func watchOOMEvents(s *service) {
func watchOOMEvents(ctx context.Context, s *service) {
if s.sandbox == nil {
return
}

for {
select {
case <-s.ctx.Done():
case <-ctx.Done():
return
default:
containerID, err := s.sandbox.GetOOMEvent()
Expand Down
5 changes: 2 additions & 3 deletions virtcontainers/kata_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2322,9 +2322,8 @@ func (k *kataAgent) getOOMEvent() (string, error) {
if err != nil {
return "", err
}
oomEvent, ok := result.(*grpc.OOMEvent)
if ok {
return oomEvent.ContainerId, err
if oomEvent, ok := result.(*grpc.OOMEvent); ok {
return oomEvent.ContainerId, nil
}
return "", err
}

0 comments on commit b4833a4

Please sign in to comment.