2020-05-06 09:37:52 +02:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"gotest.tools/v3/golden"
|
|
|
|
|
|
|
|
_ "github.com/docker/api/example"
|
2020-05-20 15:06:08 +02:00
|
|
|
"github.com/docker/api/tests/framework"
|
2020-05-06 09:37:52 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type PsSuite struct {
|
2020-05-20 15:06:08 +02:00
|
|
|
framework.CliSuite
|
2020-05-06 09:37:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (sut *PsSuite) TestPs() {
|
|
|
|
opts := psOpts{
|
|
|
|
quiet: false,
|
|
|
|
}
|
|
|
|
|
2020-05-20 15:06:08 +02:00
|
|
|
err := runPs(sut.Context(), opts)
|
|
|
|
require.Nil(sut.T(), err)
|
2020-05-06 09:37:52 +02:00
|
|
|
|
2020-05-20 15:06:08 +02:00
|
|
|
golden.Assert(sut.T(), sut.GetStdOut(), "ps-out.golden")
|
2020-05-06 09:37:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (sut *PsSuite) TestPsQuiet() {
|
|
|
|
opts := psOpts{
|
|
|
|
quiet: true,
|
|
|
|
}
|
|
|
|
|
2020-05-20 15:06:08 +02:00
|
|
|
err := runPs(sut.Context(), opts)
|
|
|
|
require.Nil(sut.T(), err)
|
2020-05-06 09:37:52 +02:00
|
|
|
|
2020-05-20 15:06:08 +02:00
|
|
|
golden.Assert(sut.T(), sut.GetStdOut(), "ps-out-quiet.golden")
|
2020-05-06 09:37:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestPs(t *testing.T) {
|
|
|
|
suite.Run(t, new(PsSuite))
|
|
|
|
}
|