diff --git a/bin/test b/bin/test index 2a4933d4f..65ed48a2a 100755 --- a/bin/test +++ b/bin/test @@ -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 diff --git a/integration/cmd.go b/experimental/integration/cmd.go similarity index 84% rename from integration/cmd.go rename to experimental/integration/cmd.go index 6f616d82f..e3d780288 100644 --- a/integration/cmd.go +++ b/experimental/integration/cmd.go @@ -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) } diff --git a/integration/contexts.go b/experimental/integration/contexts.go similarity index 56% rename from integration/contexts.go rename to experimental/integration/contexts.go index 784b4eda8..33529611b 100644 --- a/integration/contexts.go +++ b/experimental/integration/contexts.go @@ -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: diff --git a/integration/doc.go b/experimental/integration/doc.go similarity index 100% rename from integration/doc.go rename to experimental/integration/doc.go diff --git a/integration/easy_test.go b/experimental/integration/easy_test.go similarity index 88% rename from integration/easy_test.go rename to experimental/integration/easy_test.go index cf15944c8..b2eac5b96 100644 --- a/integration/easy_test.go +++ b/experimental/integration/easy_test.go @@ -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) } diff --git a/integration/no_test b/experimental/integration/no_test similarity index 100% rename from integration/no_test rename to experimental/integration/no_test diff --git a/integration/test_extra_report.json b/experimental/integration/test_extra_report.json similarity index 100% rename from integration/test_extra_report.json rename to experimental/integration/test_extra_report.json diff --git a/integration/test_single_report.json b/experimental/integration/test_single_report.json similarity index 100% rename from integration/test_single_report.json rename to experimental/integration/test_single_report.json diff --git a/integration/ignore_tests b/integration/ignore_tests deleted file mode 100644 index e69de29bb..000000000