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

« back to all changes in this revision

Viewing changes to state/machine_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:
496
496
        c.Assert(err, gc.ErrorMatches, expectErr)
497
497
 
498
498
        _, err = machine.AddNetworkInterface("aa:bb:cc:dd:ee:f0", "eth2", "net1")
499
 
        expectErr = errorPrefix + `interface with MAC address "aa:bb:cc:dd:ee:f0" already exists`
 
499
        expectErr = `interface with MAC address aa:bb:cc:dd:ee:f0 already exists`
500
500
        c.Assert(err, gc.ErrorMatches, expectErr)
 
501
        c.Assert(err, jc.Satisfies, errors.IsAlreadyExistsError)
501
502
 
502
503
        _, err = machine.AddNetworkInterface("aa:bb:cc:dd:ee:f0", "eth2", "invalid")
503
504
        expectErr = errorPrefix + `network "invalid" not found`