Skip to content

Commit e34dfb8

Browse files
committed
Separate integration test from unit test construct
1 parent 77b3920 commit e34dfb8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed
File renamed without changes.

cmd/exporter/metrics/integration_test.go renamed to integration_test/main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package metrics_test
1+
package main
22

33
import (
44
"fmt"
@@ -9,18 +9,17 @@ import (
99
"os/exec"
1010
"strconv"
1111
"strings"
12-
"testing"
1312
"time"
1413
)
1514

16-
func TestIntegration(t *testing.T) {
15+
func main() {
1716
const port = "8771"
1817
const exporterBinaryName = "process_exporter"
1918
const dummyBinaryName = "prcexpintdum"
2019
const dummyDescripiveName = "iamdummy"
2120
run("go", "build", "-o", exporterBinaryName, "github.com/setlog/process_exporter/cmd/exporter")
2221
defer os.Remove(exporterBinaryName)
23-
run("go", "build", "-o", dummyBinaryName, "github.com/setlog/process_exporter/test/dummy")
22+
run("go", "build", "-o", dummyBinaryName, "github.com/setlog/process_exporter/integration_test/dummy")
2423
defer os.Remove(dummyBinaryName)
2524
cmd := exec.Command("./"+exporterBinaryName, "-port", port, "-binary", dummyBinaryName)
2625
err := cmd.Start()
@@ -89,13 +88,13 @@ func TestIntegration(t *testing.T) {
8988
if err != nil {
9089
panic(err)
9190
}
92-
9391
}
9492

9593
func run(command string, args ...string) {
9694
cmd := exec.Command(command, args...)
97-
err := cmd.Run()
95+
out, err := cmd.CombinedOutput()
9896
if err != nil {
97+
fmt.Println(string(out))
9998
panic(err)
10099
}
101100
}

0 commit comments

Comments
 (0)