Closed
Bug 841086
Opened 13 years ago
Closed 8 years ago
mozprofile - test(s) should be written for bug 759594
Categories
(Testing :: Mozbase, defect)
Testing
Mozbase
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: k0scist, Unassigned, Mentored)
References
Details
(Whiteboard: [good first bug][lang=py])
Attachments
(7 files)
Now....hopefully....with bug 759594 if a profile has addons therein
that you are overwriting with mozprofile, the addons will be backed up
and restored. A simple test should be written to illustrate this.
Mostly likely I'm guessing there will be edge cases where this does
not (yet) work. If we have tests, we can ensure that we do not
regress.
| Reporter | ||
Updated•13 years ago
|
Whiteboard: [good first bug][mentor=jhammel][lang=py]
| Reporter | ||
Comment 1•13 years ago
|
||
So there is some nuance that make this bug a bit challenging. Still, I think it isn't too bad to get it to a good state and we can go from there. I was talking to ffledgling on irc://irc.mozilla.org/#ateam today and we figured out the basic approach here: http://logbot.glob.com.au/?c=mozilla%23ateam&s=13+Feb+2013&e=13+Feb+2013#c548810
It might be useful to distill the useful information there into a bug comment, but I don't have time right now.
Comment 2•13 years ago
|
||
I took the liberty of filtering the conversation out of the IRC background noise for someone else to read and distill out the necessary information. I am not familiar with the entire backstory, so I shall leave it for someone else.
Comment 3•13 years ago
|
||
:jhammel as you suspected, https://bugzilla.mozilla.org/show_bug.cgi?id=841963 is causing the tests to fail.
Updated•13 years ago
|
Assignee: nobody → ffledgling
Comment 4•13 years ago
|
||
:jhammel correction tests are not failing, but the Error message is still being shown.
I've marked the dependency, please edit flag if you think it is inappropriate.
| Reporter | ||
Comment 5•13 years ago
|
||
(In reply to Anhad Jai Singh (:ffledgling) from comment #4)
> :jhammel correction tests are not failing, but the Error message is still
> being shown.
>
> I've marked the dependency, please edit flag if you think it is
> inappropriate.
I meant to do that in filing. Thanks! I don't think too much can be tested without that anyway
Comment 6•12 years ago
|
||
This is the script to basically show the problem that seems to be happening, it's a rough code with commented out code etc, so it's not very nice to look at.
The more I run this, the more confused I get.
Comment 7•12 years ago
|
||
I'm attaching the proposed draft of the test I made here.
other than the slight confusion regarding the cleanup calls, this is the basic structure of the test.
I decided to do 3 kinds of tests
1) Adding a diff version of a previously installed addon
2) Adding the exactly the same addon
3) Adding an entirely different addon
All with restore = True
Attachment #716820 -
Flags: feedback?(jhammel)
| Reporter | ||
Comment 8•12 years ago
|
||
Comment on attachment 716805 [details]
basic script to explain issue.
http://quotes.burntelectrons.org/6016
Attachment #716805 -
Attachment mime type: text/x-python → text/plain
| Reporter | ||
Comment 9•12 years ago
|
||
Comment on attachment 716820 [details]
proposed test(s)
http://quotes.burntelectrons.org/6016
Attachment #716820 -
Attachment mime type: text/x-python → text/plain
| Reporter | ||
Comment 10•12 years ago
|
||
(In reply to Anhad Jai Singh (:ffledgling) from comment #6)
> Created attachment 716805 [details]
> basic script to explain issue.
>
> This is the script to basically show the problem that seems to be happening,
> it's a rough code with commented out code etc, so it's not very nice to look
> at.
>
> The more I run this, the more confused I get.
I am confused as well.
So your source of confusion is that profile2 does not get deleted? It looks like it should.
If you remove the addons from the ctor, do things behave differently?
I think we'll need to boil this down to a minimal test case, as I can't really run as is. The output would also be helpful.
| Reporter | ||
Comment 11•12 years ago
|
||
Comment on attachment 716820 [details]
proposed test(s)
Not important for f?, but the final patch should have...
- a shebang
- a license
>import os
>import shutil
>import unittest
>import mozprofile
In general it is encourage to alphabetize imports.
>class Bug841086(unittest.TestCase):
> """
> Test Case for Bug 759594 - mozprofile will delete addons if
> you specify the same addon to install.
> """
> here = os.path.dirname(os.path.abspath(__file__))
There's no reason for this to be a class/instance variable. This is actually a good place to use a global.
> def setUp(self):
> self.addons = os.path.join(self.here, 'addon')
> self.addonOne = os.path.join(self.addons, "firebug-1.11.1-fx.xpi")
> self.addonTwo = os.path.join(self.addons, "firebug-1.11.0-fx.xpi")
> self.addonThree = os.path.join(self.addons, "ghostery-2.8.4.xpi")
we can't and probably shouldn't use these addons in production. I'm not sure what we want to do here. Even were there not legal concerns, we would not want to add these to the repository. What we should probably do is make addons similar to https://github.com/mozilla/mozbase/tree/master/mozprofile/tests/empty or have a utility to make these addons.
> def test_restoreCaseOne(self):
> """ Install a different version of a previously installed add-on. """
>
> #sanity check
> self.assertTrue(os.path.exists(self.addons))
> self.assertTrue(os.path.exists(self.addonOne))
> self.assertTrue(os.path.exists(self.addonTwo))
Won't be necessary if the above is fixed.
> #create temp profile, install add-on
> profile = mozprofile.profile.FirefoxProfile(addons=[self.addonOne],
> restore=False)
> self.path = profile.profile
> existingExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> #Install new add-on to created profile
> profileNew = mozprofile.profile.FirefoxProfile(profile=self.path,
> addons=[self.addonTwo],
> restore=True)
> newInstalledExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> #clean-up
> #profileNew.cleanup()
Please don't include commented out code in the final patch.
> postCleanupExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> self.assertEqual(existingExtensions, postCleanupExtensions)
>
> def test_restoreCaseTwo(self):
> """ Install an addon that is previously installed. """
>
> #sanity check
> self.assertTrue(os.path.exists(self.addons))
> self.assertTrue(os.path.exists(self.addonOne))
>
> #create temp profile, install add-on
> profile = mozprofile.profile.FirefoxProfile(addons=[self.addonOne],
> restore=False)
> self.path = profile.profile
> existingExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> #Install new add-on to created profile
> profileNew = mozprofile.profile.FirefoxProfile(profile=self.path,
> addons=[self.addonOne],
> restore=True)
> newInstalledExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> #clean-up
> #profileNew.cleanup()
>
> postCleanupExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> self.assertEqual(existingExtensions, postCleanupExtensions)
>
> def test_restoreCaseThree(self):
> """
> Install an entirely different addon
> from one that is previously installed.
> """
>
> #sanity check
> self.assertTrue(os.path.exists(self.addons))
> self.assertTrue(os.path.exists(self.addonOne))
> self.assertTrue(os.path.exists(self.addonThree))
>
> #create temp profile, install add-on
> profile = mozprofile.profile.FirefoxProfile(addons=[self.addonOne],
> restore=False)
> self.path = profile.profile
> existingExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> #Install add-on to created profile
> profileNew = mozprofile.profile.FirefoxProfile(profile=self.path,
> addons=[self.addonThree],
> restore=True)
> newInstalledExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> #clean-up
> #profileNew.cleanup()
>
> postCleanupExtensions = os.listdir(os.path.join(self.path,
> "extensions",
> "staged"))
>
> self.assertEqual(existingExtensions, postCleanupExtensions)
>
> def tearDown(self):
> shutil.rmtree(self.path)
>
>
>if __name__ == '__main__':
> unittest.main()
Attachment #716820 -
Flags: feedback?(jhammel) → feedback+
Comment 12•12 years ago
|
||
:jhammel re: the proposed test, I understand your concerns, the test file was just was for giving a rough idea of the proposed test cases. I'll make sure to do proper ordering, licensing, and appropriate comments on the final patch.
re: addons, so even using the mozprofile addon might be an issue here? What kindof utility do you propose to generate addons?
re: the attachment 716805 [details], I will try to rerun tests and elaborate on the issue with proper output.
Comment 13•12 years ago
|
||
So here are the outputs for the test script.
http://pastebin.mozilla.org/2181312 (With addon in ctor)
http://pastebin.mozilla.org/2181322 (without addon in ctor)
I've double checked the addons.py I'm using for mozprofile using vimdiff and checked it against https://github.com/mozilla/mozbase/commit/6c09199d4bf42e670efa9a3855261fb5996634cb so I hope it isn't a file mismatch problem.
So profile should be deleted after I call cleanup but it doesn't seem to be happening. Am I doing something wrong here?
Comment 14•12 years ago
|
||
Hey Jeff, I hope you're feeling better now! Any update on this?
| Reporter | ||
Comment 15•12 years ago
|
||
Sorry, this got buried in my inbox. Flagging myself as a reminder to look at this soon.
Note: the pastebin links have rotted. bugzilla attachments ftw
Flags: needinfo?(jhammel)
| Reporter | ||
Comment 16•12 years ago
|
||
(In reply to Anhad Jai Singh (:ffledgling) from comment #12)
> :jhammel re: the proposed test, I understand your concerns, the test file
> was just was for giving a rough idea of the proposed test cases. I'll make
> sure to do proper ordering, licensing, and appropriate comments on the final
> patch.
>
> re: addons, so even using the mozprofile addon might be an issue here? What
> kindof utility do you propose to generate addons?
The mozprofile addon is fine to use; it is just only one addon, empty.xpi which I don't believe is enough to test.ver
An addon generator could use the folder structure for the empty addon and modify whatever fields are necessary to make unique addons
Flags: needinfo?(jhammel)
| Reporter | ||
Comment 17•12 years ago
|
||
:ffledgling , could you reattach the output as bugzilla attachments (for posterity)?
Comment 18•12 years ago
|
||
Hi Jeff,
I seem to have run into another strange problem. I get an error when I try to run what you described in - https://bugzilla.mozilla.org/show_bug.cgi?id=759594#c0
Attaching the code and the output as Bugzilla attachments (can't trust pastebin anymore ;) )
Comment 19•12 years ago
|
||
Basically implements the test case mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=759594#c0
Comment 20•12 years ago
|
||
| Reporter | ||
Comment 21•12 years ago
|
||
(In reply to Anhad Jai Singh (:ffledgling) from comment #20)
> Created attachment 748361 [details]
> Output for the aforementioned code
Ah, good catch. This is indeed a bug -- we do not define addon. I'll try to figure out what I meant to do here.
| Reporter | ||
Updated•12 years ago
|
Attachment #748360 -
Attachment mime type: text/x-python → text/plain
| Reporter | ||
Comment 22•12 years ago
|
||
Repro:
(mozmill)│mozprofile -a /home/jhammel/mozmill/src/mozbase/mozprofile/tests/addons/empty.xpi
/tmp/tmpgJsvbt.mozrunner
(mozmill)│ls /tmp/tmpgJsvbt.mozrunner
extensions prefs.js user.js
(mozmill)│ls /tmp/tmpgJsvbt.mozrunner/extensions/
staged
(mozmill)│ls /tmp/tmpgJsvbt.mozrunner/extensions/staged/
test-empty@quality.mozilla.org.xpi
(mozmill)│mozprofile -p /tmp/tmpgJsvbt.mozrunner -a /home/jhammel/mozmill/src/mozbase/mozprofile/tests/addons/empty.xpi
Exception UnboundLocalError: "local variable 'addon' referenced before assignment" in <bound method AddonManager.clean_addons of <mozprofile.addons.AddonManager object at 0xa4c72ac>> ignored
Comment 23•12 years ago
|
||
Hey Jeff,
So the issue I was talking about earlier.
I'm not able to reproduce the bug when I use temporary profiles created by mozprofile.profile.FirefoxProfile. (I'm able to repro when I use my actual firefox profile ~/.mozilla/firefox/foobar )
I'm using the addons.py just before :mihneadb's patch was applied to try to reproduce it.
It's probably me doing something wrong, but I can't figure out what it is.
Attaching the code and outputs.
Comment 24•12 years ago
|
||
Attachment #749652 -
Flags: feedback-
| Reporter | ||
Comment 25•12 years ago
|
||
So...I'm a bit confused. Isn't this what we expect?
| Reporter | ||
Comment 26•12 years ago
|
||
Oh, nm, the old code. It is a mystery to me.
Comment 27•12 years ago
|
||
adding diff, with reference to IRC discussion with :jhammel
Comment 28•11 years ago
|
||
:ahal
adding you as mentor, if you can't do it please update with someone better suited
Flags: needinfo?(ahalberstadt)
Whiteboard: [good first bug][mentor=jhammel][lang=py] → [good first bug][mentor=ahal][lang=py]
Comment 29•11 years ago
|
||
Sure, though it looks like there was some confusion in the last couple of comments. I'm not sure what the current status of this is.
Flags: needinfo?(ahalberstadt)
| Assignee | ||
Updated•11 years ago
|
Mentor: ahalberstadt
Whiteboard: [good first bug][mentor=ahal][lang=py] → [good first bug][lang=py]
Comment 30•11 years ago
|
||
if this is a good first bug, we should explain what to do and make it clear what the attachments that ffledgling wrote are doing? right now it is assigned to ffledgling, but this isn't actionable-
I would like to see this resolved:
* either outlined what is left to do
* accept defeat and mark this as resolved/wontfix
* if ffledgling isn't available to hack on it, lets unassign this bug.
Comment 31•11 years ago
|
||
If I recall correctly, there were issues actually trying to duplicate the issue in the original bug (Bug 759594). Therefore replicating the issue (using the older changeset pre Bug 759594) reliably is probably the first order of business.
Once that is done, one could probably build on the approach for the test proposed above.
I'm un-assigning myself from the bug, because I don't think I'll have time to hack on it in the immediate future.
I would probably not recommend this as a good first bug since it requires knowledge of both Firefox profiles and mozprofile code (as pointed out in https://bugzilla.mozilla.org/show_bug.cgi?id=759594#c2), but it is simple enough to probably count as a good second bug or good next bug.
If there's anything else needed, please feel free to needinfo? me.
Assignee: ffledgling → nobody
Comment 32•9 years ago
|
||
Hi, I'm really new
Comment 33•9 years ago
|
||
(In reply to Mollie from comment #32)
> Hi, I'm really new
I want to work on this bug, but I don't exactly know how to get started. Where could I get help with this?
Comment 34•8 years ago
|
||
Hello I know a fair bit of python! With a little help and information on the bug, I hope to solve it! Can anyone help?
Flags: needinfo?(ahalberstadt)
Comment 35•8 years ago
|
||
Hi dyex719, I'm not actually sure this is something we need anymore, because:
1. ~3 years ago we couldn't reproduce the original issue (so hard to write a test for it)
2. In a few weeks, the old style of addons that mozprofile deals with won't even work in Firefox anymore, so mozprofile development has basically stalled
3. Mozprofile has changed a ton since this bug was filed, including new tests. I'm not sure if this is even missing test coverage anymore.
For those reasons I'm going to WONTFIX the bug, sorry about that. But I can definitely help you find something else to work on! If you want something relatively straightforward, I'd suggest bug 1369710 or bug 1306122. Or (depending on your python experience) if you want something that will be a challenge and likely take awhile, you could try bug 1379151 or even bug 1346026. If you like start with one of the easier ones, get a feel for the process and move on to one of the more difficult ones if you feel up to it.
Of course these are things that I work on. If you have interest in other areas of the code base, I'd be happy to put you in contact with the owner! And please feel free to reach out to me by e-mail or on #ateam on irc.mozilla.org (nick: ahal).
Thanks for your interest!
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(ahalberstadt)
Resolution: --- → WONTFIX
Comment 36•8 years ago
|
||
(In reply to Andrew Halberstadt [:ahal] from comment #35)
> Hi dyex719, I'm not actually sure this is something we need anymore, because:
>
> 1. ~3 years ago we couldn't reproduce the original issue (so hard to write a
> test for it)
> 2. In a few weeks, the old style of addons that mozprofile deals with won't
> even work in Firefox anymore, so mozprofile development has basically stalled
> 3. Mozprofile has changed a ton since this bug was filed, including new
> tests. I'm not sure if this is even missing test coverage anymore.
>
> For those reasons I'm going to WONTFIX the bug, sorry about that. But I can
> definitely help you find something else to work on! If you want something
> relatively straightforward, I'd suggest bug 1369710 or bug 1306122. Or
> (depending on your python experience) if you want something that will be a
> challenge and likely take awhile, you could try bug 1379151 or even bug
> 1346026. If you like start with one of the easier ones, get a feel for the
> process and move on to one of the more difficult ones if you feel up to it.
>
> Of course these are things that I work on. If you have interest in other
> areas of the code base, I'd be happy to put you in contact with the owner!
> And please feel free to reach out to me by e-mail or on #ateam on
> irc.mozilla.org (nick: ahal).
>
> Thanks for your interest!
Thank you for your help, please refers to my post on bug 1369710. I hope to move to bug 1346026 later. Thanks again.
(In reply to Andrew Halberstadt [:ahal] from comment #35)
> 2. In a few weeks, the old style of addons that mozprofile deals with won't
> even work in Firefox anymore, so mozprofile development has basically stalled
FYI: There is bug 1377510 which will deal with adding support of installing extensions built on top of the WebExtensions API. There shouldn't be that much to update.
You need to log in
before you can comment on or make changes to this bug.
Description
•