[08:59] <Chipaca> welcome to day 1 post-Quino
[08:59] <bthomas> Quino ?
[09:03] <Chipaca> bthomas: https://en.wikipedia.org/wiki/Quino
[09:08] <Chipaca> bthomas: https://i.imgur.com/wDlx65Z.jpg
[09:09] <bthomas> thanks
[09:10] <Chipaca> bthomas: or maybe https://i.imgur.com/MvUSF2A.jpg
[09:11] <bthomas> nice and deep
[09:11] <Chipaca> his best ones were like that imho
[09:11] <Chipaca> although not all, eg https://pbs.twimg.com/media/C-WT7p-W0AAs8tl?format=jpg&name=medium
[09:12] <Chipaca> (there is social commentary in there, but it's not the joke)
[09:13] <bthomas> :) I like dilbert a lot
[09:13] <bthomas> BTW there is a comic book mode for emacs
[09:13] <bthomas> of course there is :)
[09:13] <Chipaca> of COURSE there is :-p
[09:13] <Chipaca> hehe
[09:35] <aluria> Chipaca: thx for the heads-up, yesterday re: charm-gitlab-k8s use of "self" as self.on_database_lost. I think I now have a clear idea on how to work with relations and events (+custom events)
[09:36] <aluria> now, I'm trying to create a simple test https://pastebin.ubuntu.com/p/5Dm35vNVxk/
[09:36] <Chipaca> aluria: FWIW, if you're not creating an interface, custom events should not be on your radar at all
[09:36] <aluria> but I get "AttributeError: 'Unit' object has no attribute 'framework'" because of the use of self.model.unit as "charm" attribute
[09:37] <aluria> Chipaca: yep, understood re: custom events (and I'm creating a interface-vpn one to be used on 2 different charms (one using the requires side, and the other one the provides one)
[09:37] <Chipaca> nice
[09:38] <aluria> the previous pastebin also should have a method on the VPNProvides class that uses self.model -> https://pastebin.ubuntu.com/p/f9Byk5SFRB/
[09:39] <aluria> how should I mock the "self.model" from the VPNProvides class using the harness capabilities?
[09:39] <Chipaca> aluria: er
[09:39] <aluria> I know VPNProvides.model = self.harness.model can't be done because it is immutable
[09:40] <Chipaca> aluria: you're doing VPNProvides(self.model.unit, 'vpn')
[09:40] <Chipaca> aluria: but VPNPRovides' first argument is called 'charm'
[09:40] <Chipaca> not 'unit'
[09:41] <Chipaca> aluria: and it looks like it should be a charm, indeed, not a unit :)
[09:41] <Chipaca> aluria: so you want harness.charm
[09:41] <Chipaca> which will only be not-None after you've done harness.begin
[09:44] <aluria> Chipaca: ah, cheers - I also see an example here -> https://github.com/openstack-charmers/ops-openstack/blob/ea51b43ec2a714aab3202d071d50a98cb7a4522d/unit_tests/test_ops_openstack.py#L77
[09:44] <aluria> ty
[14:07] <aluria> Chipaca: can an interface class inherit from CharmBase instead of Object?
[14:09] <aluria> something like ClassName(self.harness.charm, relation_name) <-- works, but ops.testing.Harness(ClassName) fails because: ops/testing.py", line 136, in begin -> self._charm = TestCharm(self._framework) -> TypeError: __init__() missing 1 required positional argument: 'relation_name'
[14:10] <Chipaca> aluria: i don't think you want your interface to be a charm, no
[14:10] <Chipaca> aluria: but, in your tests, you can create a charm that uses the interface
[14:10] <aluria> nop
[14:10] <aluria> aaah, ok
[14:11] <aluria> I'll try that, ty
[14:40] <aluria> Chipaca: that worked for general methods of the interface class, ty - last Q of the day is that I have an on_relation_joined(self, event) method which has -> event.relation.data[self.model.unit]["ip"] = value <-- and I want to check if the value has correctly been shared
[14:40] <aluria> in the setUp method, I've done -> self.relation_id_vpn = self.harness.add_relation("vpn", "vpn-client"); self.harness.begin()
[14:40] <aluria> and on the test case, I've done -> self.harness.add_relation_unit(self.relation_id_vpn, "vpn-client/0")
[14:41] <aluria> however, rel_data = self.harness.get_relation_data(self.relation_id_vpn, "vpn-client/0") <-- returns an empty dict
[14:46] <Chipaca> aluria: shouldn't that be vpn/0?
[14:47] <aluria> vpn is the interface name, and vpn-client is the appname (hence, vpn-client/0 for the unit name)
[14:47] <Chipaca> aluria: but what's the name of the other side of the relation?
[14:48] <Chipaca> it's that data that you're setting, aiui
[14:49] <aluria> ok, so I was trying to test the VPNProvides class, and the later do the same for a VPNRequires class... for the on_relation_joined part, should I test both classes together?
[14:49] <aluria> *then
[14:49] <Chipaca> you lost me :)
[14:50] <Chipaca> aluria: in that test, what is self.harness.unit.name ?
[14:51] <aluria> self.assertEqual(self.harness.unit.name, "asdf") -> AttributeError: 'Harness' object has no attribute 'unit'
[14:52] <Chipaca> aluria: self.harness.model.unit sorry
[14:52] <Chipaca> ...name
[14:53] <aluria> myapp/0 <-- b/c in the Harness call, I set up a meta value where "name: myapp"
[14:53] <Chipaca> aluria: and what's in self.harness.get_relation_data(self.relation_id_vpn, self.harness.model.unit.name) ?
[14:53] <aluria> yeah, I just tested that and it returns what it should
[14:53] <Chipaca> :)
[14:54] <aluria> I was not understanding which unit name or app name to use
[14:54] <Chipaca> yeah, it takes some mind-melding
[14:54] <aluria> I thought the ones in self.harness.add_relation and add_relation_unit were used
[14:54] <Chipaca> i still need to think really slowly through it
[14:54] <Chipaca> (in my defense, i'm new to juju)
[14:55] <aluria> thx Chipaca - I think I have minimum tests running for the VPNProvides interface - I'll work on the requires part but don't expect to interrupt you (at least, today :)
[14:55] <Chipaca> i might ignore you preëmptively
[14:55] <Chipaca> (got meetings coming up)
[14:56] <Chipaca> which reminds me, bthomas, justinclark, [dylan], you're going to be all lonesome during standup (conflicting meeting)
[14:56]  * bthomas is already feeling lonesome
[14:56] <justinclark> :(
[15:13] <dstathis> I have a couple questions about relation related hooks in operator
[15:15] <dstathis> for the event argument of relation_changed, what is event.unit? Is it a unit from the application you are related to?
[15:15] <dstathis> If so, why do I always see people checking if event.unit is None? What would be the case where this is true?
[15:19] <justinclark> dstathis yes, event.unit is the unit from the application you're related to. My understanding is that this can be None if the relation is broken and the remote unit is no longer available
[15:20] <dstathis> I actually found "The remote unit that has triggered this event. This may be None if the relation event was triggered as an Application level event"
[15:21] <justinclark> Interesting. Now I'm curious if a broken relation would also lead to event.unit being None or I was misunderstanding the use for that.