-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlogger_test.go
More file actions
48 lines (45 loc) · 1.37 KB
/
logger_test.go
File metadata and controls
48 lines (45 loc) · 1.37 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
package tests
import (
"fmt"
"testing"
"time"
"github.com/deis/deis/tests/dockercli"
"github.com/deis/deis/tests/etcdutils"
"github.com/deis/deis/tests/utils"
)
func TestLogger(t *testing.T) {
var err error
tag, etcdPort := utils.BuildTag(), utils.RandomPort()
etcdName := "deis-etcd-" + tag
cli, stdout, stdoutPipe := dockercli.NewClient()
dockercli.RunTestEtcd(t, etcdName, etcdPort)
defer cli.CmdRm("-f", etcdName)
dataName := "deis-logger-data-" + tag
dockercli.RunDeisDataTest(t, "--name", dataName,
"-v", "/var/log/deis", "ubuntu:14.04", "/bin/true")
host, port := utils.HostAddress(), utils.RandomPort()
fmt.Printf("--- Run deis/logger:%s at %s:%s\n", tag, host, port)
name := "deis-logger-" + tag
defer cli.CmdRm("-f", name)
go func() {
_ = cli.CmdRm("-f", name)
err = dockercli.RunContainer(cli,
"--name", name,
"--rm",
"-p", port+":514/udp",
"-e", "EXTERNAL_PORT="+port,
"-e", "HOST="+host,
"-e", "ETCD_PORT="+etcdPort,
"--volumes-from", dataName,
"deis/logger:"+tag)
}()
dockercli.PrintToStdout(t, stdout, stdoutPipe, "deis-logger running")
if err != nil {
t.Fatal(err)
}
// FIXME: Wait until etcd keys are published
time.Sleep(5000 * time.Millisecond)
dockercli.DeisServiceTest(t, name, port, "udp")
etcdutils.VerifyEtcdValue(t, "/deis/logs/host", host, etcdPort)
etcdutils.VerifyEtcdValue(t, "/deis/logs/port", port, etcdPort)
}