~bcsaller/juju-gui/bundlesOnIE

« back to all changes in this revision

Viewing changes to test/test_fakebackend.js

  • Committer: Rick Harding
  • Author(s): Richard Harding
  • Date: 2013-08-23 14:37:48 UTC
  • mfrom: (969.1.12 deploy-constraints)
  • Revision ID: rick.harding@canonical.com-20130823143748-lwkyt9cq1uzd3b2f
Add support for providing constraints on deploy.

- The deploy methods for both environments assume constraints is an empty
object.
- This adds support for the constraints on both go/python environments.
- For the go environment we have to map the names of the constraints from the
ones provided to the user to the Go Caps names required.
- Updates fakebackend and sandboxes for the changes accepting constraints as
well.
- This required adding another argument to env.deploy() and a bunch of adding
a 'null' constraints argument to those calls. This, of course, led to lint'ing
needing to kick in and resize the long lines.

R=jeff.pihach, matthew.scott
CC=
https://codereview.appspot.com/13084045

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
      assert.equal(units[0].service, 'wordpress');
146
146
    });
147
147
 
 
148
    it('deploys a charm with constraints', function() {
 
149
      var options = {
 
150
        constraints: {
 
151
          cpu: 1,
 
152
          mem: '4G',
 
153
          arch: 'i386'
 
154
        }
 
155
      };
 
156
      assert.isNull(
 
157
          fakebackend.db.charms.getById('cs:precise/wordpress-15'));
 
158
      fakebackend.deploy('cs:precise/wordpress-15', callback, options);
 
159
      var service = fakebackend.db.services.getById('wordpress');
 
160
      assert.isObject(
 
161
          service,
 
162
          'Null returend when a service was expected.');
 
163
      assert.strictEqual(service, result.service);
 
164
      var attrs = service.getAttrs();
 
165
      var deployedConstraints = attrs.constraints;
 
166
      assert.deepEqual(
 
167
          options.constraints,
 
168
          deployedConstraints
 
169
      );
 
170
    });
 
171
 
148
172
    it('rejects names that duplicate an existing service', function() {
149
173
      fakebackend.deploy('cs:precise/wordpress-15', callback);
150
174
      assert.isUndefined(result.error);