More metric tests and fix reconnect

* more metric test and fix reconnect

* remove build-devjmstest as dependency
This commit is contained in:
Rob Parker
2018-05-31 11:56:39 +01:00
committed by Arthur Barr
parent 9f3032f014
commit 143649deb6
754 changed files with 2427 additions and 248624 deletions

View File

@@ -571,3 +571,34 @@ func getWebPort(t *testing.T, cli *client.Client, ID string) string {
}
return i.NetworkSettings.Ports["9443/tcp"][0].HostPort
}
func countLines(t *testing.T, r io.Reader) int {
scanner := bufio.NewScanner(r)
count := 0
for scanner.Scan() {
count++
}
err := scanner.Err()
if err != nil {
t.Fatal(err)
}
return count
}
func countTarLines(t *testing.T, b []byte) int {
r := bytes.NewReader(b)
tr := tar.NewReader(r)
total := 0
for {
_, err := tr.Next()
if err == io.EOF {
// End of TAR
break
}
if err != nil {
t.Fatal(err)
}
total += countLines(t, tr)
}
return total
}