Streamline events (#287)
* Sync process.State() with the matching events Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com> * Allow requesting events for a specific container Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com> * Sync container state retrieval with other events Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com> * Let containerd take care of calling runtime delete on exit Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com> * Take care of possible race in TestBusyboxTopExecTopKillInit Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
committed by
Michael Crosby
parent
6dd2f1c422
commit
90f827ca10
@@ -9,8 +9,11 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/docker/containerd/api/grpc/types"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/golang/protobuf/ptypes/timestamp"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
@@ -19,6 +22,21 @@ func (cs *ContainerdSuite) GetLogs() string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func (cs *ContainerdSuite) Events(from time.Time, storedOnly bool, id string) (types.API_EventsClient, error) {
|
||||
var (
|
||||
ftsp *timestamp.Timestamp
|
||||
err error
|
||||
)
|
||||
if !from.IsZero() {
|
||||
ftsp, err = ptypes.TimestampProto(from)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return cs.grpcClient.Events(context.Background(), &types.EventsRequest{Timestamp: ftsp, StoredOnly: storedOnly, Id: id})
|
||||
}
|
||||
|
||||
func (cs *ContainerdSuite) ListRunningContainers() ([]*types.Container, error) {
|
||||
resp, err := cs.grpcClient.State(context.Background(), &types.StateRequest{})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user