mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add network endpoint for crashTest
This commit is contained in:
parent
ebe157ebb5
commit
20c2a4f80f
1 changed files with 20 additions and 0 deletions
|
@ -1,8 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
@ -39,17 +41,35 @@ func crashTest() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var endpoint string
|
||||||
|
if ep := os.Getenv("TEST_ENDPOINT"); ep == "" {
|
||||||
|
endpoint = "192.168.56.1:7979"
|
||||||
|
} else {
|
||||||
|
endpoint = ep
|
||||||
|
}
|
||||||
|
conn, _ := net.Dial("tcp", endpoint)
|
||||||
|
|
||||||
|
restartCount := 0
|
||||||
|
totalTestCount := 1
|
||||||
for {
|
for {
|
||||||
daemon, err := runDaemon()
|
daemon, err := runDaemon()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if conn != nil {
|
||||||
|
fmt.Fprintf(conn, "RESTART: %d\n", restartCount)
|
||||||
|
}
|
||||||
|
restartCount++
|
||||||
// time.Sleep(5000 * time.Millisecond)
|
// time.Sleep(5000 * time.Millisecond)
|
||||||
var stop bool
|
var stop bool
|
||||||
go func() error {
|
go func() error {
|
||||||
stop = false
|
stop = false
|
||||||
for i := 0; i < 100 && !stop; i++ {
|
for i := 0; i < 100 && !stop; i++ {
|
||||||
func() error {
|
func() error {
|
||||||
|
if conn != nil {
|
||||||
|
fmt.Fprintf(conn, "TEST: %d\n", totalTestCount)
|
||||||
|
}
|
||||||
|
totalTestCount++
|
||||||
cmd := exec.Command(DOCKER_PATH, "run", "base", "echo", "hello", "world")
|
cmd := exec.Command(DOCKER_PATH, "run", "base", "echo", "hello", "world")
|
||||||
log.Printf("%d", i)
|
log.Printf("%d", i)
|
||||||
outPipe, err := cmd.StdoutPipe()
|
outPipe, err := cmd.StdoutPipe()
|
||||||
|
|
Loading…
Add table
Reference in a new issue