-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlogger_test.go
More file actions
52 lines (48 loc) · 1.45 KB
/
logger_test.go
File metadata and controls
52 lines (48 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package tests
import (
"fmt"
"testing"
"github.com/deis/deis/tests/dockercliutils"
"github.com/deis/deis/tests/utils"
)
func runDeisLoggerTest(
t *testing.T, testSessionUID string, etcdPort string, servicePort string) {
var err error
cli, stdout, stdoutPipe := dockercliutils.GetNewClient()
done := make(chan bool, 1)
dockercliutils.RunDeisDataTest(t, "--name", "deis-logger-data",
"-v", "/var/log/deis", "deis/base", "true")
ipaddr := utils.GetHostIPAddress()
done <- true
go func() {
<-done
err = dockercliutils.RunContainer(cli,
"--name", "deis-logger-"+testSessionUID,
"--rm",
"-p", servicePort+":514/udp",
"-e", "PUBLISH="+servicePort,
"-e", "HOST="+ipaddr,
"-e", "ETCD_PORT="+etcdPort,
"--volumes-from", "deis-logger-data",
"deis/logger:"+testSessionUID)
}()
dockercliutils.PrintToStdout(t, stdout, stdoutPipe, "deis-logger running")
if err != nil {
t.Fatal(err)
}
}
func TestLogger(t *testing.T) {
testSessionUID := utils.NewUuid()
err := dockercliutils.BuildImage(t, "../", "deis/logger:"+testSessionUID)
if err != nil {
t.Fatal(err)
}
etcdPort := utils.GetRandomPort()
dockercliutils.RunEtcdTest(t, testSessionUID, etcdPort)
fmt.Println("starting logger component test:")
servicePort := utils.GetRandomPort()
runDeisLoggerTest(t, testSessionUID, etcdPort, servicePort)
dockercliutils.DeisServiceTest(
t, "deis-logger-"+testSessionUID, servicePort, "udp")
dockercliutils.ClearTestSession(t, testSessionUID)
}