Description:
Fix Go sandbox AllWatcher initialization
The Go sandbox AllWatcher was trying to send deltas immediately, which
does not match the juju core implementation. This fixes the behavior,
with a test.
It also fixes a user-visible bug. To qa, turn off the simulator in the
config file, and then deploy a service in the default go sandbox.
Before my branch, the unit would never appear, because the delta for
this change was lost. After my branch, the unit appears correctly.
Reviewers: mp+190685_ code.launchpad. net,
Message:
Please take a look.
Description:
Fix Go sandbox AllWatcher initialization
The Go sandbox AllWatcher was trying to send deltas immediately, which
does not match the juju core implementation. This fixes the behavior,
with a test.
It also fixes a user-visible bug. To qa, turn off the simulator in the
config file, and then deploy a service in the default go sandbox.
Before my branch, the unit would never appear, because the delta for
this change was lost. After my branch, the unit appears correctly.
https:/ /code.launchpad .net/~gary/ juju-gui/ fixGoSandboxWat cher2/+ merge/190685
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/14548050/
Affected files (+8, -5 lines): env/sandbox. js sandbox_ go.js
A [revision details]
M app/store/
M test/test_
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision: <email address hidden>
Index: test/test_ sandbox_ go.js sandbox_ go.js' sandbox_ go.js 2013-10-01 18:30:10 +0000 sandbox_ go.js 2013-10-11 13:47:43 +0000
client. onmessage = function(received) { parse(received. data);
assert. equal(receivedD ata.Response. AllWatcherId, 42); equal(client. get('juju' ).get(' nextRequestId' ), 1066); equal(receivedD ata.RequestId, 1066); isUndefined( client. get('juju' ).get(' nextRequestId' ));
client. open();
=== modified file 'test/test_
--- test/test_
+++ test/test_
@@ -164,7 +164,8 @@
var receivedData = Y.JSON.
- assert.
+ assert.
+ assert.
done();
};
Index: app/store/ env/sandbox. js env/sandbox. js' env/sandbox. js 2013-10-10 17:00:09 +0000 env/sandbox. js 2013-10-11 13:47:43 +0000 entWatchAll: function(data, client, state) { 'nextRequestId' , data.RequestId); valId = setInterval( bind(this) , this.get( 'deltaInterval' )); receive( {Response: {AllWatcherId: 42}});
=== modified file 'app/store/
--- app/store/
+++ app/store/
@@ -1066,12 +1066,12 @@
@return {undefined} Side effects only.
*/
handleCli
- this.set(
- this.deltaInter
- this.sendDelta.
// AllWatcherId can be hard-coded because we will only ever have one
// client listening to the environment with the sandbox environment.
- client.
+ client.receive({
+ RequestId: data.RequestId,
+ Response: {AllWatcherId: 42}
+ });
},
/**