-
Notifications
You must be signed in to change notification settings - Fork 34
/
test_helpers.go
64 lines (50 loc) · 1.32 KB
/
test_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
package abn
import "github.com/iter8-tools/iter8/controllers"
type testroutemapsByName map[string]*testroutemap
type testroutemaps struct {
nsRoutemap map[string]testroutemapsByName
}
func (s *testroutemaps) GetRoutemapFromNamespaceName(namespace string, name string) controllers.RoutemapInterface {
rmByName, ok := s.nsRoutemap[namespace]
if ok {
return rmByName[name]
}
return nil
}
type testversion struct {
signature *string
}
func (v *testversion) GetSignature() *string {
return v.signature
}
type testroutemap struct {
name string
namespace string
versions []testversion
normalizedWeights []uint32
}
func (s *testroutemap) RLock() {}
func (s *testroutemap) RUnlock() {}
func (s *testroutemap) GetNamespace() string {
return s.namespace
}
func (s *testroutemap) GetName() string {
return s.name
}
func (s *testroutemap) Weights() []uint32 {
return s.normalizedWeights
}
func (s *testroutemap) GetVersions() []controllers.VersionInterface {
result := make([]controllers.VersionInterface, len(s.versions))
for i := range s.versions {
v := s.versions[i]
result[i] = controllers.VersionInterface(&v)
}
return result
}
type testRoutemaps struct {
allroutemaps testroutemaps
}
func (cm *testRoutemaps) GetAllRoutemaps() controllers.RoutemapsInterface {
return &cm.allroutemaps
}