-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathcache_test.go
More file actions
48 lines (44 loc) · 1.33 KB
/
cache_test.go
File metadata and controls
48 lines (44 loc) · 1.33 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"
"github.com/deis/deis/tests/dockercliutils"
"github.com/deis/deis/tests/utils"
)
func runDeisCacheTest(t *testing.T, testSessionUID string, etcdPort string, servicePort string) {
cli, stdout, stdoutPipe := dockercliutils.GetNewClient()
done := make(chan bool, 1)
err := dockercliutils.BuildImage(t, "../", "deis/cache:"+testSessionUID)
if err != nil {
t.Fatal(err)
}
ipaddr := utils.GetHostIPAddress()
done <- true
go func() {
<-done
err = dockercliutils.RunContainer(cli,
"--name", "deis-cache-"+testSessionUID,
"--rm",
"-p", servicePort+":6379",
"-e", "PUBLISH="+servicePort,
"-e", "HOST="+ipaddr,
"-e", "ETCD_PORT="+etcdPort,
"deis/cache:"+testSessionUID)
}()
dockercliutils.PrintToStdout(t, stdout, stdoutPipe, "started")
if err != nil {
t.Fatal(err)
}
}
func TestCache(t *testing.T) {
var testSessionUID = utils.NewUuid()
fmt.Println("UUID for the session Cache Test :" + testSessionUID)
etcdPort := utils.GetRandomPort()
servicePort := utils.GetRandomPort()
dockercliutils.RunEtcdTest(t, testSessionUID, etcdPort)
fmt.Println("starting cache component test:")
runDeisCacheTest(t, testSessionUID, etcdPort, servicePort)
dockercliutils.DeisServiceTest(
t, "deis-cache-"+testSessionUID, servicePort, "tcp")
dockercliutils.ClearTestSession(t, testSessionUID)
}