~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/state/export_test.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
        "gopkg.in/mgo.v2/bson"
22
22
        "gopkg.in/mgo.v2/txn"
23
23
 
 
24
        "github.com/juju/juju/core/lease"
24
25
        "github.com/juju/juju/mongo"
25
26
        "github.com/juju/juju/network"
26
27
        "github.com/juju/juju/testcharms"
41
42
)
42
43
 
43
44
var (
44
 
        ToolstorageNewStorage  = &toolstorageNewStorage
 
45
        BinarystorageNew       = &binarystorageNew
45
46
        ImageStorageNewStorage = &imageStorageNewStorage
46
47
        MachineIdLessThan      = machineIdLessThan
47
48
        ControllerAvailable    = &controllerAvailable
185
186
 
186
187
func addCharm(c *gc.C, st *State, series string, ch charm.Charm) *Charm {
187
188
        ident := fmt.Sprintf("%s-%s-%d", series, ch.Meta().Name, ch.Revision())
188
 
        curl := charm.MustParseURL("local:" + series + "/" + ident)
 
189
        url := "local:" + series + "/" + ident
 
190
        if series == "" {
 
191
                ident = fmt.Sprintf("%s-%d", ch.Meta().Name, ch.Revision())
 
192
                url = "local:" + ident
 
193
        }
 
194
        curl := charm.MustParseURL(url)
189
195
        sch, err := st.AddCharm(ch, curl, "dummy-path", ident+"-sha256")
190
196
        c.Assert(err, jc.ErrorIsNil)
191
197
        return sch
485
491
        c.Assert(err, jc.ErrorIsNil)
486
492
}
487
493
 
 
494
func RelationCount(service *Service) int {
 
495
        return service.doc.RelationCount
 
496
}
 
497
 
488
498
func AssertEndpointBindingsNotFoundForService(c *gc.C, service *Service) {
489
499
        globalKey := service.globalKey()
490
500
        storedBindings, _, err := readEndpointBindings(service.st, globalKey)
492
502
        c.Assert(err, gc.ErrorMatches, fmt.Sprintf("endpoint bindings for %q not found", globalKey))
493
503
        c.Assert(err, jc.Satisfies, errors.IsNotFound)
494
504
}
 
505
 
 
506
func LeadershipLeases(st *State) map[string]lease.Info {
 
507
        return st.leadershipClient.Leases()
 
508
}