From: Martina Ferrari <tina@debian.org>
Date: Tue, 12 Jul 2016 03:23:14 +0000
Subject: Fix acceptance test paths

Forwarded: not-needed
Last-Update: 2024-03-06

Upstream uses a different build mechanism, which somehow makes the original
code work.
---
 test/cli/acceptance.go         | 9 ++++++---
 test/with_api_v2/acceptance.go | 5 ++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/cli/acceptance.go b/test/cli/acceptance.go
index a2d0088..24a157b 100644
--- a/test/cli/acceptance.go
+++ b/test/cli/acceptance.go
@@ -40,10 +40,10 @@ import (
 	"github.com/prometheus/alertmanager/cli/format"
 )
 
-const (
+var (
 	// nolint:godot
 	// amtool is the relative path to local amtool binary.
-	amtool = "../../../amtool"
+	amtool = filepath.Join(os.Getenv("GOPATH"), "bin/amtool")
 )
 
 // AcceptanceTest provides declarative definition of given inputs and expected
@@ -321,6 +321,8 @@ func (am *Alertmanager) Start(additionalArg []string) error {
 		"--config.file", am.confFile.Name(),
 		"--log.level", "debug",
 		"--web.listen-address", am.apiAddr,
+                "--template.default", filepath.Join(os.Getenv("GOPATH"), "src/github.com/prometheus/alertmanager/template/default.tmpl"),
+                "--web.ui-path", filepath.Join(os.Getenv("GOPATH"), "src/github.com/prometheus/alertmanager/ui/app"),
 		"--storage.path", am.dir,
 		"--cluster.listen-address", am.clusterAddr,
 		"--cluster.settle-timeout", "0s",
@@ -330,7 +332,8 @@ func (am *Alertmanager) Start(additionalArg []string) error {
 	}
 	args = append(args, additionalArg...)
 
-	cmd := exec.Command("../../../alertmanager", args...)
+	bin := filepath.Join(os.Getenv("GOPATH"), "bin/prometheus-alertmanager")
+	cmd := exec.Command(bin, args...)
 
 	if am.cmd == nil {
 		var outb, errb buffer
diff --git a/test/with_api_v2/acceptance.go b/test/with_api_v2/acceptance.go
index de59ab8..6dfb213 100644
--- a/test/with_api_v2/acceptance.go
+++ b/test/with_api_v2/acceptance.go
@@ -298,6 +298,8 @@ func (am *Alertmanager) Start(additionalArg []string) error {
 		"--config.file", am.confFile.Name(),
 		"--log.level", "debug",
 		"--web.listen-address", am.apiAddr,
+                "--template.default", filepath.Join(os.Getenv("GOPATH"), "src/github.com/prometheus/alertmanager/template/default.tmpl"),
+                "--web.ui-path", filepath.Join(os.Getenv("GOPATH"), "src/github.com/prometheus/alertmanager/ui/app"),
 		"--storage.path", am.dir,
 		"--cluster.listen-address", am.clusterAddr,
 		"--cluster.settle-timeout", "0s",
@@ -310,7 +312,8 @@ func (am *Alertmanager) Start(additionalArg []string) error {
 	}
 	args = append(args, additionalArg...)
 
-	cmd := exec.Command("../../../alertmanager", args...)
+	bin := filepath.Join(os.Getenv("GOPATH"), "bin/prometheus-alertmanager")
+	cmd := exec.Command(bin, args...)
 
 	if am.cmd == nil {
 		var outb, errb buffer
