ping ted. do you have some time to talk again about a temp home dir? https://bugs.launchpad.net/ubuntu-app-launch/+bug/1376423 Ubuntu bug 1376423 in Ubuntu Application Launcher "There is no easy and future-proof way of starting an app in a clean environment" [Undecided,New] pong elopio ubuntu-qa, thomi and balloons: ^ feel free to also comment that bug. I kinda disagree with your statement there. "In the past we were able to get a reasonably clean environment setting the value of $HOME to a temporary directory." That was always a bad idea. elopio, Why can't you just wipe the device for a clean environment? ted: that's clear for me now. That's really the only way it's really "clean" ted: we are not always testing on phones, we also need to test on dev machines. hmm ted: and some of the devices we are using are also the ones we dogfood. elopio, Okay, in a container. it's bad to have to reset them every time. elopio, dog fooded devices can't ever be clean. ted: a container can be a good solution. I'm hoping people don't use that for real testing. ted: not for something like running the whole suite to decide if a version is promoted or not. but we need to use the dogfooding devices to check that a new test we added works. or to debug a test that started failing. otherwise we would need two devices. Of every model. But, you'll need to wipe it to land the silo with the new test, no? -*- balloons settles in So you kinda need a device you can wipe of every model you care about. ted: that's for the silo testers. Don't we silo MRs for tests? they are not necessarily the same as the dogfooders or automation devs. ted, we do need a way to run tests sanely as a developer or test writer too Sure, but those folks don't need a clean test environment either. ted: I didn't get that last question. But I think you would agree that any solution we find, needs to be easily runnable from a dev machine. Do we agree there? but you can argue about whether the test or the test harness should prep the environment I'm just saying that we're not going to get "clean" on a device that isn't wiped. It's always going to be sullied in some way. ted: maybe we could get a container on a device that is not wiped Or there's enough of a chance that it could be that it's not a "result" just a checkup. at the very least the test shouldn't be polluting, while still allow us to setup at least the parts we are responsible for correctly and generally we will run on an unwiped device just a small subset of tests. maybe for that case we don't need a perfectly clean environment. Just something that doesn't delete all the photos I took yesterday. Sure, the testing shouldn't be destructive. elopio: can you not run the tests in a schroot? ted: but we need to test the behavior of the gallery app without existing tests. So we need to have an environment that temporarily doesn't see any photos. right.. I feel like for the things the app reads and writes, we should be able to control and initialize and clean up well dobey: I think we could. Here we just want to start the discussion of which is the right way. we need to take into account how slow it is, because if it takes 10 minutes to run two tests, tests are not going to be run often enough. Sure, so I think that a chroot is an option. I like creating another user for the tests. right.. if the test harness creates the environment, the setup is not easy That creates a cleanish environment for that user. but if we find a way to do it in a reasonable amount of time, it works for me. If it's a system image based device, then the new user should be very clean. ted: or just run them as "guest" user ted: and everything gets destroyed on logout elopio, well technically adt-run is more or less there, as it sets up the env for it's tests ted: so if the solution is creating another user for the tests, we need to start working on reducing the amount of time it takes unity to start or on launching apps without unity. dobey, Yeah it'd be roughly the same, but I dont' think we'd want automatic delete like guest does. but that's also a perfectly valid option. there was issues with just jumping to another user, but the apparmor stuff too would be easier I know jamie preferred that route ted: then a scrhoot is probably the best thing (and i think that's what adt-run uses anyway) elopio, I can't think of anyone that doesn't want U8 to start faster, but I don't think that blocks working on a new user based solution. dobey: adt-run can use anything. lxc, schroot, ssh into a real or emulated device, or even just run on the local machine. an lxc/chroot with nested apparmor support would be more in the right direction dobey: that's something I like. then we need to talk about a virtual framebuffer for MIR, and an easy command that fires up the lxc with all the app armor rules and upstart vars that we will find on ubuntu touch. you can't run click apps confined in lxc not yet anyway. that needs the apparmor stacking work to be completed, which we are working on jdstrand: welcome to the party :) I'm glad you are here, sorry for not pinging you before. well you can but it takes some work, and won't be generally supported yet jdstrand, welcome indeed :-) you have to turn off the existing apparmor mediation on lxc, and setup an apparmor policy namespace for the lxc container all we are asking is for a blessed way to start apps for testing. And get this blessed way under automated tests so we can rely on it working forever. then you can in fact do it I don't know if the solution should live in ubuntu-app-launch, upstart, autopilot, phablet-tools, or something else. elopio: for it to work forever in lxc, you need to wait for our 15.04 work. maybe something could be done like jjohansen mentioned, but thinking that wouldn't work fantastic elopio: emulator? :) so this does seem to push everything into the harness. Should the tests then be 'dumb'? elopio: sorry I can only offer you a shim atm, I won't promise it will work forever what about the emulator? elopio, I don't think you need anything in Mir really, it already supports nesting for the system compositor case. jdstrand: it works fine, I use it all the time, there just isn't any tooling around it so it is a pita elopio: can you not create/destroy emulator instances and run the tests inside the emulator? emulator is also an option. But the apps will eventually work on desktop too jjohansen: sure, that is what I meant be not working fantastic-- would have to do the tooling etc and then it would be tossed out down the road it would feel weird to launch an emulator that emulates your actual development device. But if it's fast and reliable, I'm also ok with that. elopio: well, that's all a chroot is jdstrand: ah okay, yep elopio: when we get to a converged state, i would expect the emulator to be able to have layouts for tablet and other things as well as phone. so, I've been welcomed to the party, but what is the topic of the discussion at this party exactly? if it doesn't then the emulator itself loses a lot of usefulness dobey: I guess you would be able to choose if you want to run on a brand new and clean chroot, or on your real machine with the risk of affecting your contests. *contents jdstrand, Creating a way to run tests, with mock data, in a semi-clean fashion on a dogfooding device. that's also fine by me. I feel like the tests should be a bit better behaved and not offload everything to the runner, imho. I'm somewhat concerned about the idea of only being able to run tests in an isolated enviornment we are supposed to also gate on the emulator working correctly. we don't now, but that is planned aiui elopio: we can already do that though :) jdstrand, https://bugs.launchpad.net/ubuntu-app-launch/+bug/1376423 Ubuntu bug 1376423 in Ubuntu Application Launcher "There is no easy and future-proof way of starting an app in a clean environment" [Undecided,New] balloons: ok, so this is a continuation of our discussion jdstrand, it's a continuation and evolution of Matla discussions yep (longtime discussion) dobey: but we don't have a way now to get the same environment you would get on ubuntu-touch from a chroot. and before matla :-) at least not easily. I maintain that creating a new user is the likely the easiest short term solution we need to launch the apps with ubuntu-app-launch, and that's not currently possible without unity, I think. elopio: well, that's what the emulator is; or you could download the image and unpack it, and use that as the chroot and if we need to start unity, then it's slow. ubuntu-app-launch works fine without unity once we have lxc stacking, we should be able to leverage lxc for this more easily dobey: it doesn't work on an xvfb. We need to do some extra work to get it set up. which is fine. As long as that extra work is encapsulated on a simple API call, with the API being maintained by the devs that will eventually break it. elopio: not sure what you're missing there, but it works fine inside my lxc while redirecting DISPLAY to my host oh, well it used to. maybe it doesn't any more jdstrand, I too am curious about blockers for the new user route dobey: so there are two more or less related problems. Run tests in a virtual X, and then run the tests with a clean home. "unable to setup cgroup" which i guess is the apparmor nesting problem if we created a new user, could we simply start the app outside of unity running? dobey: and what you are finding is what has brought us to an unmanageable mess. There are simple solutions that work at some point. we put them on the test set up, and then they stop working. the solution to get them back to green is again simple, so we do it. elopio: welcome to the joy of developing things on top of a moving target and that has happened for a long time, so the solution is now not simple, nor clean, and will keep breaking. ^^ that is the primary concern.. the complexity only continues to grow dobey: it wouldn't be hard at all to make sure the solution keeps working always. We just need to make sure that it's tested when releasing new app armor rules, new upstart versions, new container versions. All the weird details will be encapsulated behind a single call. we just need to find which is the team that has to implement that testability API. currently I don't know. I think that ted and jdstrand agree that a clean environment means a new user. So I'm with jdstrand on creating a new user right.. if there's one proper way to do it, we can test it and keep it working if that's the case, where do we put a script that gives us that new user with an env as close as what we will see on ubuntu-touch as possible? I think you can steal the code from the guest account setup, and do basically the same thing. ted: but I don't want to steal code and duplicate it on every test suite set up. elopio: it is hard to make a solution that always works, because requirements change, and we get better at doing things. as that happens, stuff will stop working in the same way. Basically you create the new user and then poke lightdm to autologin as that user the next time it runs. elopio, related, would we take the new user concept to the desktop and other platforms as well (instead of mocking)? Basically a new device at that point. I want to just make a single call, and that call to be the same on all the set ups. dwim() dobey, right.. we have helpers that elopio has maintained for some time to improve the backend and keep things working without breaking tests, all while letting us do simple things I would invision this to be more or less the same ted: I like how it sounds, and on the test clean up we can reset lightdm to the real behaviour and delete the new user. right. it's a matter of getting all the brains in the same room and coming up with something that is implemetable, maintainable, and pushes things further in the right direction elopio, Correct and you can also suck up the whole home directory as test artifacts on failure. You'll get the upstart logs, etc all for free without having to know which to grab. all good stuff if we all agree that's the best solution, then we can start thinking of where to maintain that fixture. And the next problems we will find, like restarting unity. To be clear, you won't be restarting unity. You'll be logging out the current user and logging in the new one. I guess we will be able to call the same fixture from an LXC, schroot or emulator. So it sounds independent from the test runner. Which, in effect, restarts unity. ted: oh, but then if I run it on the machine where I'm writing the tests, the IDE and everything will be closed. can't we start an additional user session? In theory, but you'll be testing Mir in a new way there today. In the long run that should work, but I'd imagine you find interesting bugs today. ahh that was the issue.. I couldn't remember the ! with a new user well, I'm not too concerned about how hard would it be. If that's the right(tm) solution, then we look for resources to implement it and while it's done we can keep maintaing our hacks. it needs to happen for MIR anyway.. right, we can be a catalyst well, I think that it's an essential feature for upstart, ubuntu-app-launch, app-armor, mir and unity to provide these testability features we are requesting. ted, elopio: well, you should be able to just run a second X session as the new user too. you don't need to log out the current user. you just need to run the session for the new user somewhere it doesn't sound to me like we are spoiled and want extra easy things. I might be wrong, because I'm spoiled :) not sure how you do that with mir though elopio, Everyone thinks their features are essential :-) dobey, Ubuntu system compositor ted: yes, but we have a better argument. If we don't test everybody else's features, they will break :D we had to drink from a rolled up newspaper! elopio, I think of it the other way, if you don't test I don't have more bugs to fix! ;-) funny guy. ;) ok, I'll put all this discussion on a paste and link it to the bug. it will be open I guess for a couple of weeks before we decide a course of action. ted, lol.. no bugs found, no bugs to fix ;-) if you're going to paste it, just paste it in the bug report don't link to pastebins in bug reports I guess kgunn and the ci-team would also like to be involved in the discusssion. pastebins can expire dobey: ack. elopio, Probably a session for the next sprint, seems to align with your timelines. thanks everybody for your time. And don't worry, we will keep bothering you ted, most certainly it will be discussed at the sprint ;-) live and in person means I hope we have a solution by the end eh? -*- ted looks to see what weapons he can pack in his suitcase :-) "solution" balloons: if solution is "drink more beer" then maybe a possible solution! Honestly, I think what we have is reasonable, it's more a matter of working out the details at this point.