-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use iobackends to send status messages. #145
Conversation
For some tests we do a require of mosto.js, that in turn ends up calling iobackend.patchBackbone(). This wouldn't be a problem if it happens at the beginning but within the test suite models were created before and after that and it is not a very good thing (for instance, Backbone-relational crashes with a 'RangeError: Maximum call stack size exceeded'). So, we patch backbone before all tests are run and also move the require() statements inside the functions. That way they will be evaluated only when they are run and not when the whole test suite is built.
dbPort: 27017 | ||
} | ||
}; | ||
var test_db = mbc.db(test_conf.db); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep test code inside tests... You can pass db to the constructor of this function and mosto server also receives the db object and can pass it alongside when calling this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On 13 March 2014 12:19, Juan Martin Runge [email protected] wrote:
In backends.js:
@@ -0,0 +1,85 @@
+var mbc = require('mbc-common'),
- search_options = mbc.config.Search,
- collections = mbc.config.Common.Collections,
- backboneio = require('backbone.io'),
- middleware = new mbc.iobackends().get_middleware()
+;
+var test_conf = {
- db: {
dbName: 'mediatestdb',
dbHost: 'localhost',
dbPort: 27017
- }
+};
+var test_db = mbc.db(test_conf.db);Please keep test code inside tests... You can pass db to the constructor of this function and mosto server also receives the db object and can pass it alongside when calling this...
Alright. Some tests do require() of mosto.js and create some things
on the db. We can either move the connection info for the test db
somewhere else here (inside mosto) or add it as another config option
and passing that to the call to mbc.db()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at the comment I made in test/001-patch-backbone.js and let me know what do you think. On mosto.js we could do
if (!opts.db)
db = mbc.db();
else
db = opts.db;
Or something like this...
Please make tests for all this. |
It is going to be defined somewhere anyways, I'd rather put it on the config. I still have the problem that I need to call patchBackbone() on an iobackend with all the backends (the ones used by mosto alone and the ones needed for the models created inside the tests) before creating any model as doing otherwise is not possible (mixing patched and unpatched models) I can extract the backends needed by the tests alone to another file and merge them with the ones from mosto , so things are separated. But the connection info to reach the test db still has to be defined somewhere. |
As for normal usage, the db info comes from config. For tests you could define it in the same file as patchBackbone and fix tests to use this db (mediatestdb) I think |
Okay, I can see that being useful with missing media files (for example checking upon startup if they are still missing). But for other things like, timeouts or lost connections? Perhaps I really missed the point but don't we restart melted when starting Mosto? |
Sorry if I misunderstood your suggestion but I don't agree about saving the connection details to a test db inside iobackends. I'd rather add another config key with that information and if we are running a test just create all the backends with it instead of the default. |
Got to read better what's going on there. Besides listening for them , are all of them really useful if present on the caspa ui? |
Alright, I guess that nobody will complain if we change the event naming. |
2014-03-18 22:25 GMT-03:00 Adrián Pardini [email protected]:
Nope. We only start it when not already started...
|
2014-03-18 22:31 GMT-03:00 Adrián Pardini [email protected]:
hbError: whenever an error occurs during sync check. Like any other error, noClips: means that melted has run out of clips. Should never happend! outOfSync: well, the name says everything... I think the user would like to forceCheckout: Whenever mosto needs more clips, this is just info.
|
2014-03-18 22:29 GMT-03:00 Adrián Pardini [email protected]:
|
On Tue, Mar 18 2014, [email protected] wrote:
yes, but we shouldn't. it's a hack, it needs to go away. |
2014-03-25 16:39 GMT-03:00 Niv Sardi [email protected]:
I checked Makefile and code and we dont (or could not find it). We only
|
Moving to #149 |
This also depends on inaes-tic/mbc-common#62