-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlogger_test.go
More file actions
49 lines (44 loc) · 1.29 KB
/
logger_test.go
File metadata and controls
49 lines (44 loc) · 1.29 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
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()
imageName := utils.ImagePrefix() + "logger" + ":" + tag
//start etcd container
etcdName := "deis-etcd-" + tag
cli, stdout, stdoutPipe := dockercli.NewClient()
dockercli.RunTestEtcd(t, etcdName, etcdPort)
defer cli.CmdRm("-f", etcdName)
host, port := utils.HostAddress(), utils.RandomPort()
fmt.Printf("--- Run %s at %s:%s\n", imageName, 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",
imageName,
"--enable-publish",
"--log-port="+port,
"--publish-host="+host,
"--publish-port="+etcdPort)
}()
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)
}