~cmars/juju-core/local-repo-resolve

« back to all changes in this revision

Viewing changes to state/state_test.go

[r=dimitern] state;api: Allow adding existing networks/NICs

Added an AlreadyExistsError in errors/ and in
state/api/params with IsAlreadyExistsError and
IsCodeAlreadyExists helpers. This is used in
the provisioner API to report networks and
interfaces that already exist, and is needed
so that when provisioning more machines on the
same network wont' lead to errors (trying to
add existing network/NIC is just ignored).

https://codereview.appspot.com/85380043/

Show diffs side-by-side

added added

removed removed

Lines of Context:
996
996
        expectErr = `cannot add network "net69": invalid VLAN tag 9999: must be between 0 and 4094`
997
997
        c.Assert(err, gc.ErrorMatches, expectErr)
998
998
        _, err = s.State.AddNetwork("net1", "0.1.2.0/24", 0)
999
 
        expectErr = `cannot add network "net1": already exists`
 
999
        expectErr = `network net1 already exists`
1000
1000
        c.Assert(err, gc.ErrorMatches, expectErr)
 
1001
        c.Assert(err, jc.Satisfies, errors.IsAlreadyExistsError)
1001
1002
}
1002
1003
 
1003
1004
func (s *StateSuite) TestAddService(c *gc.C) {