forked from ehazlett/shipyard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.go
80 lines (74 loc) · 1.85 KB
/
helpers.go
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package mock_test
import (
"time"
"github.com/samalba/dockerclient"
"github.com/shipyard/shipyard"
"github.com/shipyard/shipyard/auth"
"github.com/shipyard/shipyard/dockerhub"
registry "github.com/shipyard/shipyard/registry/v1"
)
var (
TestContainerId = "1234567890abcdefg"
TestContainerName = "test-container"
TestContainerImage = "test-image"
TestRegistry = &shipyard.Registry{
ID: "0",
Name: "test-registry",
Addr: "http://localhost:5000",
}
TestRepository = ®istry.Repository{}
TestContainerInfo = &dockerclient.ContainerInfo{
Id: TestContainerId,
Created: string(time.Now().UnixNano()),
Name: TestContainerName,
Image: TestContainerImage,
}
TestNode = &shipyard.Node{
ID: "0",
Name: "testnode",
Addr: "tcp://127.0.0.1:3375",
}
TestAccount = &auth.Account{
ID: "0",
Username: "testuser",
Password: "test",
}
TestEvent = &shipyard.Event{
Type: "test-event",
ContainerInfo: TestContainerInfo,
Message: "test message",
Tags: []string{"test-tag"},
}
TestServiceKey = &auth.ServiceKey{
Key: "test-key",
Description: "Test Key",
}
TestWebhookKey = &dockerhub.WebhookKey{
ID: "1234",
Image: "ehazlett/test",
Key: "abcdefg",
}
TestConsoleSession = &shipyard.ConsoleSession{
ID: "0",
ContainerID: "abcdefg",
Token: "1234567890",
}
)
func getTestContainerInfo(id string, name string, image string) *dockerclient.ContainerInfo {
return &dockerclient.ContainerInfo{
Id: id,
Created: string(time.Now().UnixNano()),
Name: name,
Image: image,
}
}
func getTestContainers() []*dockerclient.ContainerInfo {
return []*dockerclient.ContainerInfo{
getTestContainerInfo(TestContainerId, TestContainerName, TestContainerImage),
}
}
func getTestEvents() []*shipyard.Event {
return []*shipyard.Event{
TestEvent,
}
}