ps_test.go 713 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package cmd
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/require"
  5. "github.com/stretchr/testify/suite"
  6. "gotest.tools/v3/golden"
  7. _ "github.com/docker/api/example"
  8. "github.com/docker/api/tests/framework"
  9. )
  10. type PsSuite struct {
  11. framework.CliSuite
  12. }
  13. func (sut *PsSuite) TestPs() {
  14. opts := psOpts{
  15. quiet: false,
  16. }
  17. err := runPs(sut.Context(), opts)
  18. require.Nil(sut.T(), err)
  19. golden.Assert(sut.T(), sut.GetStdOut(), "ps-out.golden")
  20. }
  21. func (sut *PsSuite) TestPsQuiet() {
  22. opts := psOpts{
  23. quiet: true,
  24. }
  25. err := runPs(sut.Context(), opts)
  26. require.Nil(sut.T(), err)
  27. golden.Assert(sut.T(), sut.GetStdOut(), "ps-out-quiet.golden")
  28. }
  29. func TestPs(t *testing.T) {
  30. suite.Run(t, new(PsSuite))
  31. }