integration: becomes experimental; remove support in bin/test

This commit is contained in:
Peter Bourgon
2015-05-18 17:23:19 +02:00
committed by Tom Wilkie
parent 4598d37ecd
commit 2ba9dab7bd
9 changed files with 23 additions and 22 deletions

View File

@@ -3,9 +3,6 @@
echo "mode: count" > profile.cov
fail=0
for dir in $(find . -type f -name '*_test.go' | xargs -n1 dirname | sort -u); do
if [ -e $dir/no_test ]; then
continue
fi
output=$(mktemp cover.XXXXXXXXXX)
if ! go test -tags netgo -covermode=count -coverprofile=$output $dir ; then
fail=1

View File

@@ -1,7 +1,6 @@
package integration
import (
"fmt"
"os"
"os/exec"
"path/filepath"
@@ -10,6 +9,13 @@ import (
"time"
)
var components = map[string]string{
"app": "../../app/app",
"bridge": "../bridge/bridge",
"fixprobe": "../fixprobe/fixprobe",
"demoprobe": "../demoprobe/demoprobe",
}
// cmdline is e.g. `experimental/fixprobe/fixprobe -publish.interval=10ms fixture.json`
func start(t *testing.T, cmdline string) *exec.Cmd {
toks := strings.Split(cmdline, " ")
@@ -18,9 +24,10 @@ func start(t *testing.T, cmdline string) *exec.Cmd {
}
component, args := toks[0], toks[1:]
relpath := fmt.Sprintf("../%s", component)
relpath, ok := components[component]
if !ok {
t.Fatalf("%s: unknown", component)
}
if _, err := os.Stat(relpath); err != nil {
t.Fatalf("%s: %s", component, err)
}

View File

@@ -31,22 +31,22 @@ func withContext(t *testing.T, c context, tests ...func()) {
switch c {
case oneProbe:
probe := start(t, fmt.Sprintf(`experimental/fixprobe/fixprobe -listen=:%d -publish.interval=%s %s/test_single_report.json`, probePort1, publish, cwd()))
probe := start(t, fmt.Sprintf(`fixprobe -listen=:%d -publish.interval=%s %s/test_single_report.json`, probePort1, publish, cwd()))
defer stop(t, probe)
time.Sleep(10 * time.Millisecond)
app := start(t, fmt.Sprintf(`app/app -http.address=:%d -probes=localhost:%d -batch=%s`, appPort, probePort1, batch))
time.Sleep(2 * publish)
app := start(t, fmt.Sprintf(`app -http.address=:%d -probes=localhost:%d -batch=%s`, appPort, probePort1, batch))
defer stop(t, app)
case twoProbes:
probe1 := start(t, fmt.Sprintf(`experimental/fixprobe/fixprobe -listen=:%d -publish.interval=%s %s/test_single_report.json`, probePort1, publish, cwd()))
probe1 := start(t, fmt.Sprintf(`fixprobe -listen=:%d -publish.interval=%s %s/test_single_report.json`, probePort1, publish, cwd()))
defer stop(t, probe1)
probe2 := start(t, fmt.Sprintf(`experimental/fixprobe/fixprobe -listen=:%d -publish.interval=%s %s/test_extra_report.json`, probePort2, publish, cwd()))
probe2 := start(t, fmt.Sprintf(`fixprobe -listen=:%d -publish.interval=%s %s/test_extra_report.json`, probePort2, publish, cwd()))
defer stop(t, probe2)
time.Sleep(10 * time.Millisecond)
app := start(t, fmt.Sprintf(`app/app -http.address=:%d -probes=localhost:%d,localhost:%d -batch=%s`, appPort, probePort1, probePort2, batch))
time.Sleep(2 * publish)
app := start(t, fmt.Sprintf(`app -http.address=:%d -probes=localhost:%d,localhost:%d -batch=%s`, appPort, probePort1, probePort2, batch))
defer stop(t, app)
default:

View File

@@ -14,10 +14,10 @@ import (
func TestComponentsAreAvailable(t *testing.T) {
pause := time.Millisecond
for _, c := range []string{
fmt.Sprintf(`app/app -http.address=:%d`, appPort),
fmt.Sprintf(`experimental/bridge/bridge -listen=:%d`, bridgePort),
fmt.Sprintf(`experimental/fixprobe/fixprobe -listen=:%d`, probePort1),
fmt.Sprintf(`experimental/demoprobe/demoprobe -listen=:%d`, probePort1),
fmt.Sprintf(`app -http.address=:%d`, appPort),
fmt.Sprintf(`bridge -listen=:%d`, bridgePort),
fmt.Sprintf(`fixprobe -listen=:%d`, probePort1),
fmt.Sprintf(`demoprobe -listen=:%d`, probePort1),
} {
cmd := start(t, c)
time.Sleep(pause)
@@ -30,11 +30,8 @@ func TestApplications(t *testing.T) {
withContext(t, oneProbe, func() {
topo := parseTopology(t, httpGet(t, fmt.Sprintf("http://localhost:%d/api/topology/applications", appPort)))
assertAdjacent(t, topo["proc:node-1.2.3.4:apache"], "theinternet", "proc:node-192.168.1.1:wget")
want := map[string]interface{}{"max_conn_count_tcp": float64(19)}
have := parseEdge(t, httpGet(t, fmt.Sprintf("http://localhost:%d/api/topology/applications/%s/%s", appPort, "proc:node-192.168.1.1:wget", "theinternet")))
want := map[string]interface{}{
"max_conn_count_tcp": float64(19),
}
if !reflect.DeepEqual(have, want) {
t.Errorf("have: %#v, want %#v", have, want)
}