I have a module, uc_dropdown_attributes (7.x-1.x), with tests that run locally and also run using run-tests.sh with no failures. However, when I try to run the tests on drupal.org the tests fail. It looks like ubercart is getting loaded from the log. The enabled modules step is red so it appears that is the problem. Since it fails at the beginning it is not likely to be due to being installed in a subdirectory or not having clean URLs. The fatal error is reported as
Call to undefined function uc_attribute_save()
but this is likely due to the error in enabling modules. uc_attribute is specified as a dependency in the .info file.
The error message in the log is:
FATAL UCDropdownAttributesTestCase: test runner returned a non-zero error code (255).
I have tried adding the modules from Ubercart into the setup function. The only successful test is if I just enable uc_store. If I put in rules it fails. If I switch the order of rules and uc_store it fails. If I copy the code from the setup function in Ubercart tests it fails. I have written tests for another module without this problem. Committing changes to git to try to debug this is tedious. Any suggestions on how to proceed?
Comments
Comment #1
rfayThe test is http://qa.drupal.org/pifr/test/238834
The failure is on uc_attribute_save() - it's not found.
It looks to me like you're doing a very wrong thing in the function where the failure happens. A "public static function" is not going to have access to the actual test instance since it's static. My bet is that you have uc_attribute() enabled in your install (the test-runner install). And of course it's not enabled on the test runner on the testbot.
Anyway, move the stuff out of static functions. That's my opinion anyway.
Comment #2
trobey CreditAttribution: trobey commentedI removed the static declarations. These two functions were mostly copied from the uc_attribute tests which used the static declaration.
Same problem. Runs locally in the GUI and command line with no errors. Fails to run on drupal.org with the same errors. http://qa.drupal.org/pifr/test/238834.
Comment #3
rfayCould you please disable all ubercart modules on your local and try to run the tests locally?
Comment #4
rfayI did that on the testbot; here are the files and database. It does in fact not work as configured on the testbot.
Drupal checkout files: http://dl.dropbox.com/u/7350603/tmp/uc_dropdown_attributes.files.tgz
Drupal checkout database: http://dl.dropbox.com/u/7350603/tmp/uc_dropdown_attributes.sql.gz
Admin is admin/drupal - easier to use drush uli for it though.
Comment #5
trobey CreditAttribution: trobey commentedHere is a screen shot of the Ubercart tests using the tar ball and database you sent. This is of the lower part of the screen (taking the screen shot seems to scroll the window). Enabling the modules fails. All the permissions that are defined by Ubercart fail. It cannot find a class defined in one of the Ubercart modules. This is the same thing I am seeing (using the CLI):
Fail Other uc_dropdown_attri 25 UCDropdownAttributesTestCase->setUp
Enabled modules: uc_dropdown_attributes
I can get it to pass enabling the modules with just the uc_store module in the setup function but everything else I have tested fails.
Comment #6
rfayUntil you can get it to pass locally, this is not a testbot problem. I might take a look, but not sure I'll have time.
Comment #7
trobey CreditAttribution: trobey commentedrfay: You have helped immensely by giving me those files. Now I have the ability to solve the problem although it will take a while. So do not feel you need to spend any time other than giving advice.
Comment #8
trobey CreditAttribution: trobey commentedAttached is a patch which adds an additional test to check whether all the dependent modules exist. This assertion is similar to the assertion for testing whether an module is enabled and useful for finding problems such as in this issue. Attached are screen shots of the test ouptut before and after this patch.
Comment #9
rfayIf you want to get this improved, you'll need to move it to drupal core in the simpletest component.
If the problem is that the wrong module is not available due to the testbot not loading a module, that's something we can fix on this end.
Comment #10
rfayIf you want to get this improved, you'll need to move it to drupal core in the simpletest component.
If the problem is that the wrong module is not available due to the testbot not loading a module, that's something we can fix on this end.
Comment #11
trobey CreditAttribution: trobey commentedThe patch has been moved to Drupal core.
The testbot is loading the uc_dropdown_attributes and Ubercart projects. uc_dropdown_attributes requires uc_attribute and uc_cart so this is why Ubercart is loaded. But all the modules that uc_attribute and uc_cart require are not loaded (such as Views, Rules and several others). I can put these chained dependencies into the uc_dropdown_attributes.info and wait a day and then the testbot will probably load them. I am not sure this is the best solution since the list of dependencies will be much longer, could suddenly stop working if other modules change their dependencies and adds complexity that would be better handled by computers than people.
Comment #12
rfayThe project dependency module's job is to find out the chain of dependencies required to test a module.
Currently, it shows only
However, we know that uc 3.x requires far more than that. So I'm about to rebuild the dependencies for ubercart 3.x.... And after rebuild they're fine.
So this *looks* like a flaw in project_dependency. It's odd that although uc_dropdown_attributes has a dependency on uc_cart and uc_attribute, that dependency chain does not (seem to) get followed correctly.
It's possible that the fact that there's not a module called "ubercart" triggers a particular bug.
Moving this to Project Dependency. It will take some careful database study to sort it out. Thanks for your patience in explaining this. I wish I'd understood earlier that the dependencies required weren't being loaded on the box.
Comment #13
trobey CreditAttribution: trobey commentedI appreciate your time looking at this. The patch I submitted makes the problem more obvious. Without the patch it takes some digging to figure out.
Comment #14
rfayManual analysis of the attributes goes like this:
And of course Drupal says on the module page:
Requires: Cart (disabled), Order (disabled), Store (disabled), Rules (missing), Views (missing), Product (disabled), Image (enabled), File (enabled), Field (enabled), Field SQL storage (enabled), Product attributes (disabled)
So somehow we're not finding our way to uc_cart or uc_order's dependencies.
Comment #15
rfayIt's my belief that the problem is going to come down to the limit on recursion levels, see the attached patch. But I'm out of time for tonight, and can't get this patch to solve the problem.
As you see in the above, rules is 5 levels deep, depending on how you count.
It's obvious we need a better patch, with a variable; if we've had to increase it this time, it may have to be increased again.
Note also, that although I don't think it matters, we're using Ubercart 3.0, since that's the recommended release, not Ubercart 7.x-3.x
Comment #16
rfayNeeds work for two reasons: The patch doesn't actually solve the problem, and it needs to use a variable_get()
Comment #17
trobey CreditAttribution: trobey commentedI do not believe that a limit on recursion levels is necessary. It can be replaced with a check to see if projects have already been added to the dependencies. This will remove the possibility of circular dependencies and the need to limit recursion levels. If circular dependencies are eliminated then there is a finite limit to the number of projects. I would be willing to work on fixing this code. The function is called from the Project Release tests but I get an error that $this->createRelease cannot be found.
Comment #18
rfayThe tests are completely abandoned, from a much earlier rendition of this module.
Comment #19
rfay@trobey I'd be delighted to have you work on this, and would be pleased as punch to help you. You probably need to apply for a sandbox, http://drupal.org/node/1018084. If you do, let me know and I'll push the button. Project Dependency needs to know a pile of info about projects to work, so you need a database.
Comment #20
trobey CreditAttribution: trobey commentedMy application is at #1517040: Review Drupal.org development site for trobey.
Comment #21
trobey CreditAttribution: trobey commentedIt took some digging but here is what is happening. Using uc_dropdown_attributes which depends on uc_attribute and uc_cart, no other dependencies are found, such as uc_product which uc_attribute depends. Why isn't uc_product found? Here is a join of the project_dependency_dependency and project_dependency_component tables for uc_attribute:
*************************** 1. row ***************************
component_id: 331290
release_nid: 1424926
name: uc_attribute
title: Product attributes
description: Extends product content types to support product variations that customers may select before purchase.
dependency_id: 490698
component_id: 331290
dependency: uc_product
core_api: 7.x
external: 0
external_release_nid: 0
dependency_type: 0
1 row in set (0.01 sec)
The dependency field shows uc_product. Why is it not found? From the project_dependency.drupal.inc file at about line 495:
Note the "ADD pdd.external =1." Looking at the database the external field is 0. Both uc_attribute and uc_product are in the ubercart project so it is an internal dependency. We do not need internal dependencies do we? Well, actually we do as this case shows. Remove the "ADD pdd.external = 1" and we get the dependencies:
uc_attribute
uc_product
image
uc_store
uc_cart
uc_order
rules
entity
entity_token
views
ctools
This is with the recursion level set to 4.
Patch to soon follow. Then we will need to test it.
Comment #22
trobey CreditAttribution: trobey commentedHere is the patch.
Comment #23
rfayVery nice work.
So what's happening is that a dependency module (component) *within* the same release node package doesn't get followed, right?
I'm a little worried that this will skew the results for other modules and end up adding redundant internal references in. But I think there's a line of code that automatically removes those anyway. Just have to take a look and see.
Nicely done! Thanks!
Comment #24
trobey CreditAttribution: trobey commentedYes, that is correct. A dependency component within the same release node does not get followed.
Comment #25
rfayHere's #22 rolled as a git patch rooted in the project. No changes. Testing today.
@trobey, probably what you should have done on your sandbox was to clone project_dependency into the sites/all/modules/project_dependency directory and then your patch would have been correct.
Comment #26
rfayThis looks great to me. Casual testing shows it resolves the OP, and I find no breakage with any other dependency generation.
Thanks!
Comment #27
rfayCommitted, http://drupalcode.org/project/project_dependency.git/commitdiff/8cc7a0b
Rolled into release: 6.x-1.0-beta2
Ready for d.o deployment.
Comment #28
rfayDeployed on drupal.org.
Rebuilt the dependencies using jenkins and project_dependency_rebuild_project
The dependencies of uc_dropdown_attributes are now
Looks pretty good to me.
And it looks like success after a retest: http://qa.drupal.org/pifr/test/238834
Congrats and thanks, @trobey!
Comment #29
rfayOf interest, possible bug: #1530452: Duplicate module checkout (Repository checkout: failed to checkout from [git://git.drupal.org/...]
Comment #30
rfayYeah, OG doesn't work right. It gets og listed as a dependency of itself. Odd that we don't have that problem with ubercart. Perhaps because Ubercart doesn't have a module named ubercart?
Comment #31
rfayMoving to critical, as it appears this breaks many contrib modules. For Example, skinr is broken:
Skinr: http://qa.drupal.org/pifr/test/98689
Ubercart: http://qa.drupal.org/pifr/test/132134
I guess my testing must not have been adequate.
Comment #32
rfayI reverted the deployment, so we're now back to 6.x-1.0-beta1 deployed on drupal.org, so this is no longer critical. We can work it at our leisure.
Comment #33
trobey CreditAttribution: trobey commentedI will concentrate here on Organic Groups since it is one of the modules that had problems. For OG 7.x-2.x I get:
This should not include og since it is self referential. Here is the code from the project_dependency_get_external_release_dependencies().
We want to follow the internal dependencies in OG but not include the og project in the results. So we want og to be part of the excluded dependencies. So add the following code.
This gives the dependencies as follows.
Comment #34
trobey CreditAttribution: trobey commentedComment #35
rfay@trobey, I apologize for not getting this in. And now I'm traveling for the next week, so a very poor time to commit or deploy. But I'll at least try to look at it this week. Thanks so much for all your work on this.
Comment #36
rfay#33 rerolled with proper root.
Comment #37
rfayLooks good to me. Committed, http://drupalcode.org/project/project_dependency.git/commitdiff/7611b97
Now, we need a new release and deployment. Created 6.x-1.0-beta3
I'm going to be out all morning, so won't deploy now, but may try deploying this afternoon.
Thanks so much, @trobey.
Comment #38
rfayDeployment is in progress.
Comment #39
rfayDoesn't seem to have broken og, skinr, or uc_dropdown_attributes. YAY!
@trobey++
Sorry for the terrible lapse on this. I had a 3 week interruption in my life.
I'd appreciate it if you'd consider comaintaining this module, since you obviously already have a good grasp of it.