forked from UbuntuEvangelist/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelation_internal_test.go
40 lines (35 loc) · 976 Bytes
/
relation_internal_test.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
// Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package state
import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v6-unstable"
)
type RelationSuite struct{}
var _ = gc.Suite(&RelationSuite{})
// TestRelatedEndpoints verifies the behaviour of RelatedEndpoints in
// multi-endpoint peer relations, which are currently not constructable
// by normal means.
func (s *RelationSuite) TestRelatedEndpoints(c *gc.C) {
rel := charm.Relation{
Interface: "ifce",
Name: "group",
Role: charm.RolePeer,
Scope: charm.ScopeGlobal,
}
eps := []Endpoint{{
ServiceName: "jeff",
Relation: rel,
}, {
ServiceName: "mike",
Relation: rel,
}, {
ServiceName: "mike",
Relation: rel,
}}
r := &Relation{nil, relationDoc{Endpoints: eps}}
relatedEps, err := r.RelatedEndpoints("mike")
c.Assert(err, jc.ErrorIsNil)
c.Assert(relatedEps, gc.DeepEquals, eps)
}