From 0be9b81319e2d265aa762844b8d74e541113a882 Mon Sep 17 00:00:00 2001 From: Jeff Grafton Date: Mon, 5 Dec 2016 15:38:48 -0800 Subject: [PATCH] Include resource type headers in diff report --- hack/e2e.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hack/e2e.go b/hack/e2e.go index 91e9ac252bb..752a1671d9e 100644 --- a/hack/e2e.go +++ b/hack/e2e.go @@ -29,6 +29,7 @@ import ( "os/signal" "os/user" "path/filepath" + "regexp" "strconv" "strings" "text/template" @@ -424,14 +425,19 @@ func DiffResources(before, clusterUp, clusterDown, after []byte, location string } lines = lines[2:] - var added []string + var added, report []string + resourceTypeRE := regexp.MustCompile(`^@@.+\s(\[\s\S+\s\])$`) for _, l := range lines { + if matches := resourceTypeRE.FindStringSubmatch(l); matches != nil { + report = append(report, matches[1]) + } if strings.HasPrefix(l, "+") && len(strings.TrimPrefix(l, "+")) > 0 { added = append(added, l) + report = append(report, l) } } if len(added) > 0 { - return fmt.Errorf("Error: %d leaked resources\n%v", len(added), strings.Join(added, "\n")) + return fmt.Errorf("Error: %d leaked resources\n%v", len(added), strings.Join(report, "\n")) } return nil }