summaryrefslogtreecommitdiffhomepage
path: root/pkg/test/criutil
diff options
context:
space:
mode:
authorIan Lewis <ianlewis@google.com>2020-06-11 19:29:34 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-11 19:31:24 -0700
commit8ea99d58ffd708aa7a26be58d89cb817d8eceec6 (patch)
treed5ff8477c5f13082364398cc20e73781322921a0 /pkg/test/criutil
parent5a894e35a090232085fbb20c71d1787c266bd995 (diff)
Set the HOME environment variable for sub-containers.
Fixes #701 PiperOrigin-RevId: 316025635
Diffstat (limited to 'pkg/test/criutil')
-rw-r--r--pkg/test/criutil/criutil.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/test/criutil/criutil.go b/pkg/test/criutil/criutil.go
index bebebb48e..8fed29ff5 100644
--- a/pkg/test/criutil/criutil.go
+++ b/pkg/test/criutil/criutil.go
@@ -113,6 +113,17 @@ func (cc *Crictl) Exec(contID string, args ...string) (string, error) {
return output, nil
}
+// Logs retrieves the container logs. It corresponds to `crictl logs`.
+func (cc *Crictl) Logs(contID string, args ...string) (string, error) {
+ a := []string{"logs", contID}
+ a = append(a, args...)
+ output, err := cc.run(a...)
+ if err != nil {
+ return "", fmt.Errorf("logs failed: %v", err)
+ }
+ return output, nil
+}
+
// Rm removes a container. It corresponds to `crictl rm`.
func (cc *Crictl) Rm(contID string) error {
_, err := cc.run("rm", contID)