summaryrefslogtreecommitdiff
path: root/test/e2e/libpod_suite_test.go
diff options
context:
space:
mode:
authorhaircommander <pehunt@redhat.com>2018-06-08 17:56:25 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-15 17:09:33 +0000
commitb43677c9fd7f04c1ebf8265a0b14fc8ed70e4d66 (patch)
tree7789d0838adc805bcddd680ceb06fadd77195a4f /test/e2e/libpod_suite_test.go
parent894ae2bf76ec9877f8a4707d5b978bc23f6556f8 (diff)
downloadpodman-b43677c9fd7f04c1ebf8265a0b14fc8ed70e4d66.tar.gz
podman-b43677c9fd7f04c1ebf8265a0b14fc8ed70e4d66.tar.bz2
podman-b43677c9fd7f04c1ebf8265a0b14fc8ed70e4d66.zip
Added --tls-verify functionality to podman search, with tests
Signed-off-by: haircommander <pehunt@redhat.com> Closes: #932 Approved by: baude
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r--test/e2e/libpod_suite_test.go33
1 files changed, 31 insertions, 2 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 9f59eb4a6..d06818fd3 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -2,6 +2,7 @@ package integration
import (
"context"
+ "encoding/json"
"fmt"
"io/ioutil"
"os"
@@ -12,8 +13,6 @@ import (
"testing"
"time"
- "encoding/json"
-
"github.com/containers/image/copy"
"github.com/containers/image/signature"
"github.com/containers/image/storage"
@@ -268,6 +267,36 @@ func (s *PodmanSession) OutputToStringArray() []string {
return strings.Split(output, "\n")
}
+// ErrorGrepString takes session stderr output and behaves like grep. it returns a bool
+// if successful and an array of strings on positive matches
+func (s *PodmanSession) ErrorGrepString(term string) (bool, []string) {
+ var (
+ greps []string
+ matches bool
+ )
+
+ for _, line := range strings.Split(s.ErrorToString(), "\n") {
+ if strings.Contains(line, term) {
+ matches = true
+ greps = append(greps, line)
+ }
+ }
+ return matches, greps
+}
+
+// ErrorToString formats session stderr to string
+func (s *PodmanSession) ErrorToString() string {
+ fields := strings.Fields(fmt.Sprintf("%s", s.Err.Contents()))
+ return strings.Join(fields, " ")
+}
+
+// ErrorToStringArray returns the stderr output as a []string
+// where each array item is a line split by newline
+func (s *PodmanSession) ErrorToStringArray() []string {
+ output := fmt.Sprintf("%s", s.Err.Contents())
+ return strings.Split(output, "\n")
+}
+
// IsJSONOutputValid attempts to unmarshal the session buffer
// and if successful, returns true, else false
func (s *PodmanSession) IsJSONOutputValid() bool {