Files
odo/tests/helper/helper_logs.go
Philippe Martin 26c90d7c4d Remove podman from experimental mode (#6628)
* Remove podman from experimental mode

* Remove env var for odo dev

* Cleanup tests and sources about experimental mode

* Hide "Experimental mode" doc page

* Cleanup latest commit

* doc odo dev --platform podman

* Doc other commands

* Apply suggestions from code review

Co-authored-by: Armel Soro <armel@rm3l.org>

* Remove more ODO_EXPERIMENTAL_MODE from latest commits on main

* Remove reference to Experimental mode from blog posts

---------

Co-authored-by: Armel Soro <armel@rm3l.org>
2023-03-06 14:17:39 +01:00

46 lines
1.1 KiB
Go

package helper
import (
"github.com/onsi/gomega/gexec"
)
type LogsSession struct {
session *gexec.Session
}
// StartLogsFollow starts a session with `odo logs --follow`
// It returns a session structure, the contents of the standard and error outputs
func StartLogsFollow(podman bool, opts ...string) (LogsSession, []byte, []byte, error) {
args := []string{"logs", "--follow"}
args = append(args, opts...)
if podman {
args = append(args, "--platform", "podman")
}
session := CmdRunner("odo", args...)
result := LogsSession{
session: session,
}
outContents := session.Out.Contents()
errContents := session.Err.Contents()
err := session.Out.Clear()
if err != nil {
return LogsSession{}, nil, nil, err
}
err = session.Err.Clear()
if err != nil {
return LogsSession{}, nil, nil, err
}
return result, outContents, errContents, nil
}
// OutContents returns the contents of the session's stdout
func (o *LogsSession) OutContents() []byte {
return o.session.Out.Contents()
}
// Kill the `odo logs --follow` session
func (o *LogsSession) Kill() {
o.session.Kill()
}