~james-page/ubuntu/wily/juju-core/mir-fixes

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/worker/uniter/uniter_test.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-04-07 18:24:59 UTC
  • mfrom: (1.1.22)
  • Revision ID: package-import@ubuntu.com-20140407182459-1b6zvm5ygm4ki7yp
Tags: 1.18.0-0ubuntu1
* New upstream release (LP: #1287147), including fixes for:
  - maas/lxc: LXC permission denied issue (LP: #1299588).
  - core: mega-watcher for machines does not include container
    addresses (LP: #1301464).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
        "launchpad.net/juju-core/agent/tools"
25
25
        "launchpad.net/juju-core/charm"
26
26
        "launchpad.net/juju-core/errors"
 
27
        "launchpad.net/juju-core/instance"
27
28
        "launchpad.net/juju-core/juju/osenv"
28
29
        "launchpad.net/juju-core/juju/testing"
29
30
        "launchpad.net/juju-core/state"
868
869
                        },
869
870
                        verifyFile{
870
871
                                testFile("jujuc.output"),
871
 
                                "user-admin\nprivate.dummy.address.example.com\npublic.dummy.address.example.com\n",
 
872
                                "user-admin\nprivate.address.example.com\npublic.address.example.com\n",
872
873
                        },
873
874
                ), ut(
874
875
                        "run commands: proxy settings set",
1087
1088
        }
1088
1089
}
1089
1090
 
 
1091
// Assign the unit to a provisioned machine with dummy addresses set.
 
1092
func assertAssignUnit(c *gc.C, st *state.State, u *state.Unit) {
 
1093
        err := u.AssignToNewMachine()
 
1094
        c.Assert(err, gc.IsNil)
 
1095
        mid, err := u.AssignedMachineId()
 
1096
        c.Assert(err, gc.IsNil)
 
1097
        machine, err := st.Machine(mid)
 
1098
        c.Assert(err, gc.IsNil)
 
1099
        err = machine.SetProvisioned("i-exist", "fake_nonce", nil)
 
1100
        c.Assert(err, gc.IsNil)
 
1101
        err = machine.SetAddresses([]instance.Address{{
 
1102
                Type:         instance.Ipv4Address,
 
1103
                NetworkScope: instance.NetworkCloudLocal,
 
1104
                Value:        "private.address.example.com",
 
1105
        }, {
 
1106
                Type:         instance.Ipv4Address,
 
1107
                NetworkScope: instance.NetworkPublic,
 
1108
                Value:        "public.address.example.com",
 
1109
        }})
 
1110
        c.Assert(err, gc.IsNil)
 
1111
}
 
1112
 
1090
1113
func (s *UniterSuite) TestSubordinateDying(c *gc.C) {
1091
1114
        // Create a test context for later use.
1092
1115
        ctx := &context{
1115
1138
        c.Assert(err, gc.IsNil)
1116
1139
        rel, err := s.State.AddRelation(eps...)
1117
1140
        c.Assert(err, gc.IsNil)
 
1141
        assertAssignUnit(c, s.State, wpu)
1118
1142
 
1119
1143
        // Create the subordinate unit by entering scope as the principal.
1120
1144
        wpru, err := rel.Unit(wpu)
1231
1255
        c.Assert(err, gc.IsNil)
1232
1256
 
1233
1257
        // Assign the unit to a provisioned machine to match expected state.
1234
 
        err = unit.AssignToNewMachine()
1235
 
        c.Assert(err, gc.IsNil)
1236
 
        mid, err := unit.AssignedMachineId()
1237
 
        c.Assert(err, gc.IsNil)
1238
 
        machine, err := ctx.st.Machine(mid)
1239
 
        c.Assert(err, gc.IsNil)
1240
 
        err = machine.SetProvisioned("i-exist", "fake_nonce", nil)
1241
 
        c.Assert(err, gc.IsNil)
 
1258
        assertAssignUnit(c, ctx.st, unit)
1242
1259
        ctx.svc = svc
1243
1260
        ctx.unit = unit
1244
1261
 
1270
1287
                        // GZ 2013-07-10: Hardcoded values from dummy environ
1271
1288
                        //                special cased here, questionable.
1272
1289
                        private, _ := ctx.unit.PrivateAddress()
1273
 
                        if private != "private.dummy.address.example.com" {
 
1290
                        if private != "private.address.example.com" {
1274
1291
                                continue
1275
1292
                        }
1276
1293
                        public, _ := ctx.unit.PublicAddress()
1277
 
                        if public != "public.dummy.address.example.com" {
 
1294
                        if public != "public.address.example.com" {
1278
1295
                                continue
1279
1296
                        }
1280
1297
                        return