00:04:29  * nfitchjoined
00:08:42  * nfitchquit (Ping timeout: 240 seconds)
00:34:31  * nfitchjoined
00:38:53  * nfitchquit (Ping timeout: 252 seconds)
01:20:00  * ed209quit (Remote host closed the connection)
01:20:08  * ed209joined
01:59:16  * seldoquit (Remote host closed the connection)
04:59:14  * marsellquit (Quit: marsell)
05:47:03  * seldojoined
05:50:58  * seldoquit (Ping timeout: 240 seconds)
06:58:39  * mamashjoined
08:16:09  * mamashpart
08:25:16  * mamashjoined
09:18:38  * mamashpart
09:31:18  * mamashjoined
10:24:15  * mamashpart
10:45:52  * marselljoined
10:53:10  * mamashjoined
12:53:52  * bixujoined
14:31:21  * chorrelljoined
15:01:23  * mamashpart
15:47:07  * dap_1joined
15:59:01  * nfitchjoined
15:59:58  * fredkjoined
16:28:58  * yunong1joined
17:03:22  * yunong1quit (Quit: Leaving.)
17:09:35  * ringzerojoined
17:13:15  * bixuquit (Remote host closed the connection)
17:30:50  * quijotejoined
17:33:18  * notmattjoined
17:36:12  * quijotequit (Ping timeout: 258 seconds)
17:41:35  * quijotejoined
18:00:32  * nicholaswyoungjoined
18:01:07  <nicholaswyoung>What is the best way to mock the manta client (to fake out uploads while testing)?
18:02:16  * quijotequit (Ping timeout: 258 seconds)
18:04:06  <nahamu>the command line client, or the javascript library, or a different library?
18:05:47  <nahamu>nicholaswyoung: ^
18:06:05  <nicholaswyoung>the javascript library
18:08:03  <nahamu>are you using client.put or client.createWriteStream or both?
18:08:22  <nicholaswyoung>I'm just using writeStream
18:08:53  <nicholaswyoung>(since, I assume, that's the most resource-friendly way to do it.)
18:09:06  <nahamu>I've never used it, so I don't know.
18:09:47  <nicholaswyoung>Do you have advice on mocking out client.put? Because I might be able to adapt it. Right now, I'm kinda at a loss, with zero idea how this should look.
18:09:48  <nahamu>but in theory couldn't you just wrap the function that creates the writeStream with your own function that during testing returns a writeStream that writes to /dev/null?
18:10:02  <nicholaswyoung>Good point!
18:10:24  <nahamu>I'm not a strong node.js programmer, so I don't know the node-y way of mocking out a function
18:10:44  <nicholaswyoung>(Nor am I. I'm still learning this stuff.)
18:11:20  <nahamu>but having written various programs in general, I've often wrapped library functions in my own functions that have DEBUG=true somewhere and a branch of if DEBUG then this else that
18:11:34  <nahamu>so that's the hack that comes to mind.
18:11:46  <nahamu>but tjfontaine might have a better suggestion if he's around...
18:12:08  <nahamu>or bahamas10... he seems to be a decent javascript programmer...
18:13:00  <nahamu>but you might go to one of the nodejs IRC channels to see if anyone in there has a better suggestion for how to do that.
18:13:03  <nicholaswyoung>Given that stream is just an EventEmitter, I might be able to do something like this: https://gist.github.com/kenperkins/df11d0856e6319d478ca
18:13:16  <nicholaswyoung>That's essentially the mock for pkgcloud, but I think it might work here.
18:14:08  * bixujoined
18:15:01  <nahamu>node/javascript is currently paged out of my brain, so your guess is better than mine...
18:15:04  <tjfontaine>nicholaswyoung: I mean, that's basically it, I would probably do something more full on streams like
18:15:26  <tjfontaine>nicholaswyoung: i guess the question is, how far through this do you need to mock out
18:15:49  <tjfontaine>nicholaswyoung: if you just don't want it to go to manta, change manta.createWriteStream to fs.createWriteStream('/dev/null')
18:15:55  * seldojoined
18:16:19  <nicholaswyoung>tjfontaine: That's a totally acceptable solution, and probably what I'll do. I need to test that the file was sent somewhere, but I don't exactly care where.
18:16:45  <nicholaswyoung>I just wanted to make sure that I was doing this the correct, 'Node.js way.'
18:17:25  <nicholaswyoung>Because I'm a total n00b. I know JS, but the Node stuff still confuses me on a daily basis (and I'd rather learn the right way from the beginning).
18:17:39  <nahamu>right, ideally for a unit test you'd love to be able to test all the rest of the program logic without actually uploading a file...
18:18:09  <nahamu>so maybe fs.createWriteStream('<something that helps validate the test>')
18:18:22  <nicholaswyoung>Exactly. At least according to everything else that I've learned about testing (in Ruby, etc.)
18:19:00  <nahamu>are you using a testing library?
18:19:06  * bixuquit (Ping timeout: 265 seconds)
18:19:24  <nicholaswyoung>Yeah, just Mocha.
18:19:36  <nahamu>http://stackoverflow.com/questions/15790505/mocking-modules-in-node-js-for-unit-testing
18:19:45  <nahamu>first answer suggests "sinon" for mocking
18:20:03  <nicholaswyoung>I've heard tons about Sinon, but I haven't dug into it yet. I guess now is the time!
18:20:08  <nahamu>another further down suggests "gently"
18:20:16  <nahamu>I know nothing about either.
18:21:53  <nahamu>I'd be curious to hear what you figure out...
18:23:02  * nfitchquit (Quit: Leaving.)
18:24:14  <nicholaswyoung>I'll definitely be back with my findings. Thank you, nahamu and tjfontaine -- you both rock. Here's to swift development and quick deployment of my new Manta solution. ;)
18:25:49  * fredkquit (Quit: Leaving.)
18:25:54  <tjfontaine>lemme know if I can help, I don't have entirely a lot of bw atm though -- there are folks here and in #node.js that can certainly help
18:28:27  * quijotejoined
18:32:56  * quijotequit (Ping timeout: 258 seconds)
18:34:46  * ryancnelsonjoined
18:40:51  * quijotejoined
18:44:25  * seldo_joined
18:44:35  * ringzero_joined
18:47:54  * ringzeroquit (Ping timeout: 240 seconds)
18:48:20  * seldoquit (Ping timeout: 252 seconds)
18:53:19  * ryancnelsonquit (Quit: Leaving.)
19:01:30  * nfitchjoined
19:13:44  * bixujoined
19:18:33  * bixuquit (Ping timeout: 265 seconds)
19:25:06  <bahamas10>nicholaswyoung nahamu: when testing manta-sync i didn't bother mocking... i just used manta directly
19:25:34  <nicholaswyoung>bahamas10: manta-sync?
19:25:35  <bahamas10>however, i think this is what your asking, just make client.createWriteStream act like fs.createWriteStream, and open a strem to /dev/null (like nahamu suggested)... that should do it, and send the same events
19:25:39  * quijotequit (Ping timeout: 252 seconds)
19:25:51  <bahamas10>client.createWriteStream was meant to mimic fs.createWriteStream, so it should be almost identical
19:26:33  <bahamas10>https://github.com/bahamas10/node-manta-sync like rsync for manta
19:26:34  <bahamas10>local => remote only however
19:27:11  <nahamu>bahamas10: to be fair, if nicholaswyoung's app is going to be uploading gigs and gigs of data, it might be worth testing to /dev/null or a local file... ;)
19:28:01  <nicholaswyoung>Yeah, we'll be handling loads of data. I'll probably just write to /dev/null, as that's the easiest way around this.
19:28:14  <bahamas10>oh agreed. i'd really just do something like `var client = { createWriteStream: fs.createWriteStream.bind(fs) };` or something
19:28:37  <nicholaswyoung>nahamu: I looked at Sinon, and for now, I don't think I have the mental capacity to understand it. Soon, though, I'll dig in and really grasp how mocking works in JS-land.
19:29:25  <nahamu>nicholaswyoung: I glanced at it, and it looked to me like you might want a "stub" not a "mock", but yeah, it looks a bit intimidating. :)
19:31:18  <bahamas10>i'm busy for the next hour or so, but i can write up a simple mock manta library that effecitively no-ops the calls
19:31:29  <bahamas10>that's how i'd approach the problem... you probably won't need anything fancy
19:32:26  <nicholaswyoung>To be completely honest, I'm still new to testing in JavaScript. I had my head wrapped around it in other traditional languages, but it's a whole new world for me, as this point.
19:32:51  <nicholaswyoung>Thanks, bahamas10. Any input or suggestions you have would be greatly appreciated.
19:33:39  * nfitchquit (Quit: Leaving.)
19:37:59  * nfitchjoined
19:38:54  * fredkjoined
19:39:08  * fredkquit (Client Quit)
19:55:30  * nfitchquit (Quit: Leaving.)
20:14:36  * bixujoined
20:19:27  * bixuquit (Ping timeout: 265 seconds)
20:23:24  * quijotejoined
20:28:08  * quijotequit (Ping timeout: 255 seconds)
20:33:46  * fredkjoined
20:34:10  * nfitchjoined
20:38:14  * nfitchquit (Ping timeout: 240 seconds)
20:40:29  * fredkquit (Ping timeout: 264 seconds)
20:54:43  * notmattquit (Remote host closed the connection)
20:55:18  * notmattjoined
20:59:45  * notmattquit (Ping timeout: 258 seconds)
20:59:54  <bahamas10>the docs are incorrect for http://apidocs.joyent.com/manta/nodesdk.html#clientcreatereadstreampath-options, the example shows client.get when it actually is client.createReadStream
21:00:52  <nahamu>are the docs just out of date or have they always been wrong?
21:01:03  <nahamu>(did the API change?)
21:03:58  <bahamas10>it's just a typo, it says `client.get` when it should be `client.createReadStream` in the example
21:04:14  <nahamu>ah
21:06:33  <bahamas10>nicholaswyoung: https://gist.github.com/bahamas10/98bf6fc910c8e2aef223 that's a very simple fake node-manta API that uses /dev/null
21:08:02  <nicholaswyoung>bahamas10: Thank you. That helps make everything clearer.
21:09:30  <bahamas10>great np, you should just be able to drop in that `require` line and have it "just work"
21:11:51  * fredkjoined
21:13:31  * fredkquit (Client Quit)
21:15:25  * bixujoined
21:16:46  * nfitchjoined
21:17:20  * fredkjoined
21:20:21  * bixuquit (Ping timeout: 265 seconds)
21:21:44  * nfitchquit (Quit: Leaving.)
21:24:07  * quijotejoined
21:28:53  * quijotequit (Ping timeout: 255 seconds)
21:28:59  * ringzero_quit
21:31:18  * fredkquit (Quit: Leaving.)
21:32:06  * fredkjoined
21:34:02  * AvianFluquit
21:38:00  * notmattjoined
21:38:13  * AvianFlujoined
21:39:22  * nfitchjoined
21:50:42  * ringzerojoined
21:54:07  * nfitchquit (Quit: Leaving.)
21:55:14  * ringzeroquit (Client Quit)
21:56:06  * ringzerojoined
22:02:31  * fredkquit (Quit: Leaving.)
22:16:06  * bixujoined
22:20:46  * bixuquit (Ping timeout: 265 seconds)
22:24:56  * quijotejoined
22:29:48  * quijotequit (Ping timeout: 276 seconds)
22:43:55  * ringzeroquit
22:59:10  * ringzerojoined
23:01:32  * ringzeroquit (Client Quit)
23:16:49  * bixujoined
23:21:40  * bixuquit (Ping timeout: 265 seconds)
23:22:31  * quijotejoined
23:27:28  * quijotequit (Ping timeout: 265 seconds)
23:41:55  * ringzerojoined