/srv/irclogs.ubuntu.com/2013/01/24/#juju-dev.txt

=== slank is now known as slank_away
jtvI'm trying to figure out how to unit-test a non-exported function...  Is that possible?  Is there a knack to it?07:41
rogpeppejtv: there are two techniques for that07:49
rogpeppejtv: you can write a test file that's in the package itself (package foo, not package foo_test)07:50
rogpeppejtv: or you can export the function for the tests only07:50
rogpeppejtv: i'm assuming you're talking about Go here07:51
jtvrogpeppe: yes, Go, thanks.07:53
rogpeppejtv: there's a convention for applying the latter technique07:53
jtvThe test and the module are both in the same package.  Maybe the problem is that we have multiple source files and test files in the same package?07:53
rogpeppejtv: they're in the same directory, yes, but what does the "package" declaration at the top of the test file read?07:54
rogpeppejtv: there's no problem with having multiple source files and test files in the same directory07:54
jtvThey're in the same package (as well as the same directory)07:56
rogpeppejtv: then there should be no problem using unexported functions07:56
jtvHmmm07:56
jtvMaybe the problem is getting the branch into my Go environment.07:56
rogpeppejtv: what error message are you getting?07:57
jtvJust having it in $GOPATH/src/launchpad.net/ doesn't seem to do the trick.07:57
* jtv compiles...07:57
jtvundefined: <my lower-case function name>07:57
rogpeppejtv: if you push the branch, i could take a brief look07:58
jtvIt's based on lp:~maas-maintainers/maas/gomaasapi (which I think already has the problem)08:00
jtvMeanwhile, I'll commit & push.08:00
rogpeppejtv: i just ran go test in gomaasapi and it worked ok08:01
jtvBy the way, how do you get a branch with a URL like that into your Go environment?08:01
rogpeppejtv: it lives inside $GOPATH/src/$packagepath08:02
rogpeppejtv: so in this case, you might have it at $GOPATH/src/launchpad.net/maas08:03
rogpeppejtv: the awkward thing is that you can't have a differently named directory per branch, which doesn't fit well with the usual bzr way of doing things08:03
jtvYeah08:04
rogpeppejtv: because package paths are always absolute08:04
jtvHi there rvba08:04
rvba\o jtv08:04
rogpeppejtv: i use cobzr08:04
jtvWell current bzr versions supersede that, don't they?08:04
rogpeppejtv: but i know others have different workarounds08:04
rogpeppejtv: tell me more :-)08:05
jtvSee "Co-located branches with Bazaar" here: https://docs.google.com/a/canonical.com/document/d/1GQ3u7keE3hJH2oaweAm28K78hQZAbqeQqR9xwD9OR4I/edit#08:05
rogpeppejtv: cool!08:06
jtvNowhere near as cool as the title.08:06
rogpeppejtv: nice doc, BTW. i'll have a look through it.08:06
jtvThe more the merrier!08:07
* rogpeppe should really upgrade to q08:07
rogpeppe"But if you do want pass-by-reference, it may be best to pass a pointer to the interface value instead."08:08
rogpeppei think that's spurious08:08
jtvIt depends a bit on what the purpose of the interface is, I suspect.08:09
jtvBut in light of other gotchas that have come up, it's certainly not one of our big worries. I'll take it out.08:10
rogpeppejtv: passing a pointer to the interface doesn't help if you want the methods to be operating on the reference08:11
jtvNo, of course not.08:11
jtvBut they do help if you want to see, for instance, changes that are made by other functions you pass it to.08:11
rogpeppejtv: yeah. but that's part of the method contract. a pass-by-value implementation of a method can still have side effects that are reflected in later method calls to the same object.08:12
rogpeppejtv: (for example, it might be operating on a global data structure, or an external file)08:13
jtvYes, I wasn't thinking so much of pointer receiver types as of general parameter-parameter passing.08:14
jtv(Okay, I'm stating the obvious because an interface can't be a receiver type :)08:14
rogpeppejtv: yeah08:14
rogpeppejtv: in the section on non-nil interfaces, you might want to insert this link: http://golang.org/doc/faq#nil_error08:15
jtvOh yes, thanks08:15
jtvVery nice to have some external feedback.  :)08:16
jtvrogpeppe: My "go get launchpad.net/maas/gomaasapi" is taking forever.  I'm going to take a break.  After that, I'll see if my problems go away with the right branch setup.08:18
rogpeppejtv: i recommend using play.golang.org links rather than paste.ubuntu.com links. then people can easily try out the examples08:18
jtvOh, thanks.  I'll add a note.08:19
rogpeppejtv: in the "static polymorphism between structurally identical objects" section, you might want to link to the relevant spec section: http://golang.org/ref/spec#Conversions08:21
jtvThanks.  I'm trying to go off on a break here.  :)08:21
rogpeppejtv: ok, np. enjoy!08:22
jtv:)08:23
rogpeppejtv: could you give me permission to add comments?08:24
rogpeppedavecheney: hiya08:35
davecheneyrogpeppe: yo08:36
rogpeppedavecheney: i'll do a proper review of worker/stater now we think we know where we're going...08:39
davecheneyrogpeppe: cool, i'mma about to step out for the evening08:39
davecheneyhttp://osakamonaurail.com/en/tour.html08:39
davecheney^ tonight08:39
davecheneylive08:39
davecheneyfor the sydney festival08:40
davecheneyi have tix08:40
rogpeppedavecheney: enjoy. i'll ping you this evening, 7am your time maybe08:40
rogpeppedavecheney: cool. not heard of 'em08:40
rogpeppedavecheney: japanese soul, interesting08:42
davecheneythey are tighter than tight08:42
rogpeppedavecheney: :-) when my gran said "tight" she meant "drunk"08:43
rogpeppejtv: i looked for launchpad.net/maas/gomaasapi, but it doesn't seem to exist08:48
rogpeppe$ bzr branch lp:maas/gomaasapi08:48
rogpeppebzr: ERROR: Permission denied: "Cannot create 'gomaasapi'. Only Bazaar branches are allowed."08:48
rvbajtv: not sure why you would want to use launchpad.net/maas/gomaasapi right now… the code is in lp:~maas-maintainers/maas/gomaasapi while we're still getting the project started. http://paste.ubuntu.com/1565492/08:52
jtvGah.  I was using the wrong invocation of "go test" again.  That's all there is to it.09:14
rvbaThat's what I suspected ;)09:15
jtvLost a lot of stupid time to that, barking up the wrong trees.09:17
rogpeppejtv: almost always i just use plain old "go test"...10:18
rogpeppejtv: an invocation that's hard to get wrong :-)10:19
jtvotp10:20
rogpeppedimitern: hiya10:47
dimiternrogpeppe: yo!10:47
dimiternmgz, jam: standup?11:30
rogpeppearam: fancy doing some reviews at some point?12:19
niemeyerHello all!12:41
rogpeppeniemeyer: yo!12:42
rogpeppeniemeyer: are you still on reviews?12:43
rogpeppeniemeyer: yay! just had first successful live API test.12:45
rogpeppeniemeyer: well, "success" did take the form of a failure :-)12:45
rogpeppe3:49.482     c.Assert(apiInstId0, Equals, instId0)12:45
rogpeppe3:49.482 ... obtained string = "i-963dcbe6"12:45
rogpeppe3:49.482 ... expected state.InstanceId = "i-963dcbe6"12:45
niemeyerrogpeppe: Woah12:50
niemeyerrogpeppe: That's cool :-)12:50
rogpeppeniemeyer: the string there came back from the Request method of the API12:50
niemeyerrogpeppe: In that specific case, even better than silence, as you know it actually worked :-)12:50
rogpeppeniemeyer: indeed12:50
rogpeppeniemeyer: i had a good chat with davecheney last night BTW12:51
rogpeppeniemeyer: i think we know where we're going with the HA stuff now12:51
niemeyerrogpeppe: Any changes?12:54
rogpeppeniemeyer: pretty much according to the sketch i showed you12:55
rogpeppeall live tests pass13:04
niemeyerrogpeppe: How's it different from what is already being pushed by Dave?13:04
rogpeppeniemeyer: it doesn't involve stater as a jujud subcommand13:04
rogpeppeniemeyer: worker/stater stays pretty much as he's proposing it though13:04
rogpeppeniemeyer: although it needs more logic to check if it's already running13:05
niemeyerrogpeppe: Cool, that makes sense13:05
rogpeppeniemeyer: we run the stater as a job in the machine agent13:05
niemeyerrogpeppe: +113:06
rogpeppeniemeyer: i'm happy with the direction. i think i can see it all hanging together now.13:06
rogpeppeniemeyer: if you were up for doing some reviews, i've got a sequence of 4 noisy-but-fairly-insubstantial reviews that take us up to having a working API13:07
rogpeppehttps://codereview.appspot.com/7133063/13:08
rogpeppehttps://codereview.appspot.com/7197049/13:08
rogpeppehttps://codereview.appspot.com/7133072/13:08
rogpeppehttps://codereview.appspot.com/7195051/13:08
rogpeppeniemeyer: but i totally understand if you don't want to13:09
niemeyerrogpeppe: I'll surely have a look13:12
rogpeppeniemeyer: thanks13:20
rogpeppeniemeyer: how's 17070 for a port number? it's not on either of the two assigned-number lists i've looked at so far.13:43
rogpeppeniemeyer: and 7070 is kinda mnemonic for juju if you squint right13:44
niemeyerrogpeppe: Hah, looks good :)13:45
rogpeppeniemeyer: i only use random ports in the tests, so we can run tests concurrently on the same machine without clashing13:45
niemeyerrogpeppe: The default port for mongo is 27017, btw.. that's where 37017 comes from13:46
rogpeppeniemeyer: i suspect that we may not need to use a fixed port number in the future, if an agent is actively publishing server addresses. but we may want to anyway.13:47
niemeyerrogpeppe: You mean an agent with a fixed port just to tell us what the dynamic port is? :-)13:48
rogpeppeniemeyer: no, i don't think we'd *need* any agent with a fixed port.13:49
niemeyerrogpeppe: "if an agent is actively publishing server addresses"13:49
niemeyerrogpeppe: How would one connect to said agent?13:49
rogpeppeniemeyer: yeah, we need a place to publish, but we already need a place to public (currently it's the private storage; you were suggesting tags, which seems like a good plan too)13:49
rogpeppes/to public/publish/13:50
niemeyerrogpeppe: Doesn't sound good13:50
rogpeppeniemeyer: what i mean is that we've already got a well known place to look, without necessarily needing to have well known ports too13:51
niemeyerrogpeppe: One thing is what we do.. something else is requiring that everyone talking to an API implement the full logic to figure out where to talk to13:51
dimiternmgz: ping13:51
niemeyerrogpeppe: Our "well known place" is not observable without a good amount of logic13:51
rogpeppeniemeyer: we already need to find out the IP address. a port isn't much addition to that.13:51
niemeyerrogpeppe: The only thing we need is to hand out an IP address13:51
niemeyerrogpeppe: and the TCP port13:51
mgzdimitern: hey13:52
niemeyerrogpeppe: Which is somewhat common for a few decades :)13:52
rogpeppeniemeyer: indeed. i'm not sure why the port needs to be well known though. we can hand out an IP-address/port pair if we want.13:52
niemeyerrogpeppe: Man.. that's the kind of discussion I'd hope was unnecessary13:52
rogpeppeniemeyer: and that might have advantages13:52
dimiternmgz: so I found out what I was doing wrong - I assumed in server detail accessIPv4 and accessIPv6 are the addresses to look, but there indeed is addresses with the same structure as server/ips returns13:52
niemeyerrogpeppe: Please use a fixed port number for the service13:53
rogpeppeniemeyer: for instance, we could potentially run several API servers on the same machine13:53
rogpeppeniemeyer: i will, and i am13:53
niemeyerrogpeppe: Thakns13:53
rogpeppeniemeyer: apart from in tests13:53
niemeyerrogpeppe: Sure13:53
rogpeppeniemeyer: as for authentication, i don't mind it being open for the moment, as the only thing you can do is request an instance id, which doesn't seem too harmful.13:54
dimiternmgz: so instead of landing the CL about /ips, I'll propose a new one, parsing the addresses part of server detail and use that to get the public/private addresses in juju13:54
mgzright, it's the 'addresses' key you care about, which has a list of dicts as content13:54
rogpeppeniemeyer: authentication is next on the agenda13:54
niemeyerrogpeppe: Sounds good then.. please mention that in the CL13:54
rogpeppeniemeyer: will do13:54
niemeyerrogpeppe: There's no "Destroy" or anything, right?13:54
rogpeppeniemeyer: maybe i'll just slip one in for the hell of it. plus a root shell :)13:55
dimiternmgz: but the thing is - should I parse and make available all addresses reported, from goose into ServerDetail, so juju can pick which ones to use?13:56
mgzdimitern: yes, I'd do that.13:56
dimiternmgz: that's what you suggested - move the logic out of goose and into juju, providing all the necessary details13:57
rogpeppeniemeyer: thanks v much for the reviews. that's helped immensely.13:57
dimiternmgz: ok then13:57
niemeyerrogpeppe: My pleasure13:58
mgzdimitern: a list of struct that pretty much just corresponds to the json should be fine for now14:00
dimiternmgz: what I'm not yet sure is how to implement the "wait" part of getting DNSName - just keep calling server/detail until I have addresses?14:00
mgzsounds reasonable for first stab14:02
dimiternmgz: cool, I should have it soon14:02
mgzit's pretty much what the python code does14:03
mgzsee the while loop in juju.providers.openstack.launch14:03
dimiternmgz: ok, 10x14:03
mgz(it only does it when configured to provided a public ip, but the principle is the same)14:04
* aram doesn't feel very well.14:07
dimiternaram, get well soon!14:08
aramtrying; thanks.14:08
mgzfix internal bugs! or kill them...14:09
rogpeppeAPI is live in trunk. not that it *does* anything yet :-)14:27
rogpeppetime for lunch and a walk in the snow, i think14:27
dimiternrogpeppe: at least you have snow :)14:28
=== slank_away is now known as slank
rogpeppedimitern: yeah it's great. still aching from sledging activity at the weekend :-)14:28
dimiternrogpeppe: man, I envy you a bit - my snowboarding skills got all rusty in sunny malta14:29
dimiternbut the summer's great :)14:29
rogpeppedimitern: i haven't been skiing in years14:30
rogpeppedimitern: i miss it a  bit14:30
dimiternrogpeppe: at lest you don't have to catch a plane to go skiing :)14:31
rogpeppedimitern: i do... the snow only happens here for about a week a year and the hills aren't big enough for skiing unless i go up to scotland where they're still small and the skiing's crap14:32
rogpeppeanyway, lunch!14:32
dimiternyeah, enjoy14:32
fssniemeyer: ping16:09
niemeyerfss: Hey16:09
fssniemeyer: may we get those iam patches merged? :-)16:24
niemeyerfss: Yeah, the end is near16:24
fssniemeyer: thanks16:24
niemeyerfss: I'm planning some time next week to go over goamz-everything16:24
fssniemeyer: nice, we needed some ELB support too, and flaviamissi prepared patches for that too16:28
niemeyerfss: Neat16:28
niemeyerfss: Are they up for review already?16:29
fssniemeyer: not sure, let me ask her16:29
fssand there we go :-)16:30
flaviamissiniemeyer, https://codereview.appspot.com/7014047/16:31
flaviamissihi, btw16:31
flaviamissix)16:31
niemeyerflaviamissi: Cheers!16:31
niemeyerflaviamissi: Hi :)16:31
flaviamissiniemeyer, I still have to change the regions endpoints and update some stuff... I'll probably do it tomorrow16:33
flaviamissibut if you could take a look16:33
niemeyerflaviamissi: Sounds good. I'll probably not get to that before next week16:33
flaviamissiniemeyer, alright then x)16:41
flaviamissithanks!16:41
fwereadeniemeyer, rogpeppe, davecheney: https://codereview.appspot.com/7198051 should be very simple: it's basically a straight move (no behaviour changes), leavened by the deletion of a whole bunch of redundant tests16:46
rogpeppefwereade: looking16:47
rogpeppefwereade: morning, BTW!16:47
fwereaderogpeppe, heyhey :)16:47
rogpeppefwereade: assuming no test coverage has been lost, LGTM16:48
fwereaderogpeppe, I believe that to be the case -- the only lack of redundancy I could find was moved into RUS16:48
fwereaderogpeppe, and the intent was always that RUS be the real tests... ORUS was only there out of state-swap paranoia16:49
rogpeppefwereade: we have a "working" API BTW.16:49
fwereaderogpeppe, sweeeet!16:49
rogpeppefwereade: it only has one request so far: Machine.InstanceId16:50
rogpeppefwereade: just to check end-to-end sanity16:50
fwereaderogpeppe, a black triangle :)16:50
rogpeppefwereade: indeed so16:50
rogpeppefwereade: and now i'm pondering about how much (if any) to resurrect of my old rpc package branch16:51
fwereaderogpeppe, oh yes?16:51
rogpeppefwereade: well, i want *something* to take the dogwork out of writing rpc methods16:51
rogpeppefwereade: and the standard rpc package isn't up to it16:51
rogpeppefwereade: because it can't deal with per-connection auth16:52
rogpeppefwereade: i'm wondering about the best way to express permissions without turning the code into a rats' nest16:52
fwereaderogpeppe, ha, yes, this has been somewhat on my mind16:53
rogpeppefwereade: three immediate possibilities come to mind16:53
* fwereade is listening16:53
rogpeppefwereade: 1) map users (entity names) to capabilities; check the requisite capability inside each method16:54
rogpeppefwereade: 2) map capabilities to allowed users; check for the requisite capabilitiy inside each method16:54
rogpeppefwereade: 3) dispense with a table and just check for permissions explicitly inside each method16:55
rogpeppefwereade: rather, check for particular entities inside each method16:55
niemeyerrogpeppe: It's not just about having a capability or not16:55
fwereaderogpeppe, explicit per-method checks feel clearest and simplest to me... the first two smack a little of premature abstraction16:56
niemeyerrogpeppe: Unit foo/1 has see config capability, for its *own* config16:56
rogpeppeniemeyer: that's the "see own config" capability :-)16:56
niemeyerrogpeppe: Heh16:56
rogpeppeniemeyer: i think we'll always need *some* explicit per-method checks16:57
niemeyerrogpeppe: That was my point16:57
niemeyerWhat fwereade said, though16:57
niemeyerI'd get a feeling for the problem first16:57
rogpeppeniemeyer: yes16:58
fwereaderogpeppe, I'm sure the right abstractions will emerge in the fullness of time ;)17:00
* rogpeppe is off for the night.18:33
rogpeppesee y'all tomorrow18:33
fwereadegn rog18:35
rogpeppedavecheney: ping20:03
=== slank is now known as slank_away
=== slank_away is now known as slank
davecheneyrogpeppe: ack21:13
davecheneysorry i'm late21:13
davecheneyis now too late to call ?21:13
rogpeppe1davecheney: sorry, missed your ack and now it *is* too late :-)23:39
davecheneythat is ok23:39
davecheneywould 7 tomorrow work for you ?23:39
davecheneysorry 19:0023:40
rogpeppe1davecheney: 1900 would be 6am for you i think23:40
davecheneywell, i'll ping you when I'm up23:40
davecheneyif it works out, all the better23:40
rogpeppe1davecheney: sounds good. if you're up for an early saturday morning, it'd be good to chat...23:41
rogpeppe1davecheney: otherwise maybe sunday night (monday morning for you). or the day after. if you toggle your away status, i'll know if it's worth pinging you.23:43
rogpeppe1davecheney: anyway, things going ok?23:44
rogpeppe1davecheney: what was the last thing you saw me say?23:45
rogpeppe1ach well23:46
rogpeppe1davecheney_: hope to speak some time23:46

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!