From c2a1138aecc2a0b3f60e3a61c0dfe18de3a47684 Mon Sep 17 00:00:00 2001
From: Brent Baude <bbaude@redhat.com>
Date: Fri, 17 Apr 2020 13:20:36 -0500
Subject: [PATCH] enable integration testing

Signed-off-by: Brent Baude <bbaude@redhat.com>
---
 .cirrus.yml                   | 45 +++++++++++++++++++++++++++++++++++
 cmd/podman/volumes/inspect.go |  7 +++++-
 cmd/podman/volumes/list.go    |  3 +++
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index e96994cfe7..016ef8f2b8 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -453,6 +453,49 @@ testing_task:
             path: "*.log.html"
             type: "text/html"
 
+# This task only temporary as we creep up on making
+# all tests passing for v2. Once all tests pass, we
+# should immediately remove this and re-enable the
+# testing matrix.
+integration_test_temporary_task:
+
+    allow_failures: $CI == 'true'
+
+    depends_on:
+        - "gating"
+        - "varlink_api"
+        - "vendor"
+        - "build_each_commit"
+        - "build_without_cgo"
+
+    only_if: >-
+        $CIRRUS_CHANGE_MESSAGE !=~ '.*CI:IMG.*' &&
+        $CIRRUS_CHANGE_MESSAGE !=~ '.*CI:DOCS.*'
+
+    env:
+        ADD_SECOND_PARTITION: 'true'
+        TEST_REMOTE_CLIENT: 'false'
+
+    timeout_in: 60m
+
+    networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
+    setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
+    integration_test_script: '$SCRIPT_BASE/integration_test.sh |& ${TIMESTAMP} | ${LOGFORMAT} integration_test'
+
+    on_failure:
+        failed_branch_script: '$CIRRUS_WORKING_DIR/$SCRIPT_BASE/notice_branch_failure.sh'
+
+    always:
+        package_versions_script: '$SCRIPT_BASE/logcollector.sh packages'
+        ginkgo_node_logs_script: '$SCRIPT_BASE/logcollector.sh ginkgo'
+        df_script: '$SCRIPT_BASE/logcollector.sh df'
+        audit_log_script: '$SCRIPT_BASE/logcollector.sh audit'
+        journal_script: '$SCRIPT_BASE/logcollector.sh journal'
+        varlink_script: '$SCRIPT_BASE/logcollector.sh varlink'
+        podman_system_info_script: '$SCRIPT_BASE/logcollector.sh podman'
+        html_artifacts:
+            path: "*.log.html"
+            type: "text/html"
 
 # This task executes tests under unique environments/conditions
 special_testing_rootless_task:
@@ -798,6 +841,8 @@ success_task:
         - "test_build_cache_images"
         - "verify_test_built_images"
         - "docs"
+        # FIXME remove when all v2 tests pass
+        - "integration_test_temporary"
 
     env:
         CIRRUS_WORKING_DIR: "/usr/src/libpod"
diff --git a/cmd/podman/volumes/inspect.go b/cmd/podman/volumes/inspect.go
index 57e773aef4..feaaee176e 100644
--- a/cmd/podman/volumes/inspect.go
+++ b/cmd/podman/volumes/inspect.go
@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"html/template"
 	"os"
+	"strings"
 
 	"github.com/containers/buildah/pkg/formats"
 	"github.com/containers/libpod/cmd/podman/registry"
@@ -61,7 +62,11 @@ func inspect(cmd *cobra.Command, args []string) error {
 		}
 		fmt.Println(string(jsonOut))
 	default:
-		tmpl, err := template.New("volumeInspect").Parse(inspectFormat)
+		if !strings.HasSuffix(inspectFormat, "\n") {
+			inspectFormat += "\n"
+		}
+		format := "{{range . }}" + inspectFormat + "{{end}}"
+		tmpl, err := template.New("volumeInspect").Parse(format)
 		if err != nil {
 			return err
 		}
diff --git a/cmd/podman/volumes/list.go b/cmd/podman/volumes/list.go
index fd89db01f3..f75de6b4bd 100644
--- a/cmd/podman/volumes/list.go
+++ b/cmd/podman/volumes/list.go
@@ -68,6 +68,9 @@ func list(cmd *cobra.Command, args []string) error {
 	if err != nil {
 		return err
 	}
+	if len(responses) < 1 {
+		return nil
+	}
 	// "\t" from the command line is not being recognized as a tab
 	// replacing the string "\t" to a tab character if the user passes in "\t"
 	cliOpts.Format = strings.Replace(cliOpts.Format, `\t`, "\t", -1)