While figuring out the issue in #334554: SimpleTest: Prevent endless loop and upper timeout during request I've found that an issue with locale module create many fails while running simpletest. See the log file in http://drupal.org/files/issues/SimpleTest_Server500Crash_AllTables.zip for the 355+ logged messages. The number of errors hardly depends on the called page.

Repro
1. install simpletest 6.x-2.5
2. install google analytics 6.x-2.0
3. install core locale module
4. import a second translation like German. (Not tested if really required, but my environment.)
5. set up german as default language. (Not tested if really required, but my environment.)

Test:
6. run ga test
7. the test finishes and you get 355+ messages like:

Table 'drupal6.simpletest370434cache' doesn't exist query: DELETE FROM simpletest370434cache WHERE cid LIKE 'locale:%'	User warning	database.mysqli.inc	128	_db_query()

Table 'drupal6.simpletest370434locales_source' doesn't exist query: SELECT s.lid, t.translation, s.version FROM simpletest370434locales_source s LEFT JOIN simpletest370434locales_target t ON s.lid = t.lid AND t.language = 'de' WHERE s.source = 'Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.' AND s.textgroup = 'default'	User warning	database.mysqli.inc	128	_db_query()
CommentFileSizeAuthor
#13 yh.patch1.76 KByhager

Comments

hass’s picture

I missed to say that the mysql DUMP will show that the tables _db_query() complains about are really missing.

boombatower’s picture

D7 issue?

boombatower’s picture

Status: Active » Postponed (maintainer needs more info)
hass’s picture

Simply turn on locale module and then run a test... remove the lines that drops all errors from simpletest table and you will see.

boombatower’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Yes, indeed...D7 issue as well....work environment bleeds into test environment.

#348455: Provide a scalable way to ensure a clean testing environment for SimpleTest

hass’s picture

Isn't not the other case a duplicate of this case?

yhager’s picture

I have read all the links and am a bit confused. Is there a way to make the locale exceptions go away? My site has locale enabled, but I don't require it for testing. Maybe I can disable locale for the tests environment? how can I do that?

Thanks.

hass’s picture

@yhager: If you do so - how do you make sure that the tested module works well with locale module enabled? :-)

boombatower’s picture

the tested module should enable the locale module anyway...shouldn't depend on outside environment.

$this->setUp('locale', 'self');

The issue with locale is a bleed-over effect.

yhager’s picture

@hass: I can't even do unit testing with 250 exceptions every time I run a test
@boombatower: I am new to simpletest. What is bleed-over? Is there some workaround? Maybe I can help debugging it, but I need some guidance...

hass’s picture

@yhager: You are in the same situation than me, but there was never a guide or helping hand and I wasted 3 days on this module and the bugs I was able to fix have been fixed on my local box. The problem with locale module is - that the install process of a test creates temp tables the test should run on, but IS buggy and that temp process is than running half on your main / production database and half on a few temp tables and this is why the tests think there is a locale module enabled + you get the many many many errors. So - sum up - the abstraction between your main database you are developing with and the simpletest* tables a test is running on - is broken in several ways, but I don't know why, too.

@boombatower: If a module test define to run a test without locale module it is nevertheless running with locale module if the main installation have locale module installed.

boombatower’s picture

#11: Correct, I was just responding to the question of how else can you test with locale.

The issue of bleed-over is rather complex and results from the hard-coded statics within Drupal. Many of these statics are reset manually, but there is no clean way to reset them all.

Functions in the following format create this issue.

function get_something($reset = FALSE) {
  static $static;

  if (!isset($static) || $reset) {
    $static = // Do something once.
  }
  return $static;
}

Many of these functions are never directly called by anything other than the system and thus are hard to find and reset in a clean way, other than calling them all with $reset = TRUE.

A revamp of API or some sort of registry with all these functions is needed so they can be cleared cleanly. #348455: Provide a scalable way to ensure a clean testing environment for SimpleTest

yhager’s picture

Priority: Normal » Critical
Status: Closed (duplicate) » Needs review
StatusFileSize
new1.76 KB

Thanks for the explanations.

After long debugging sessions, I managed to find a way to run tests on my environment. This is by no means a solution to the bigger problem of a standard method to run tests in a clean environment, but it works for me.

The specific problem with locale is that t() is being called from the schema installation, after the $db_prefix have changed. This causes it to search for translations in tables that do not exist yet.

I was able to devise a patch that will at least allow me to run my unit tests, without being hit by 250 exceptions, which render simpletest useless for locale enabled sites.

I am taking this issue out of duplicate state, since I find it critical, and easier to fix than #348455: Provide a scalable way to ensure a clean testing environment for SimpleTest.

boombatower’s picture

Status: Needs review » Closed (duplicate)

The issue is that we have done this over and over...and never fixed the root cause. I would really prefer we fix it. I have proposed a general solution on the other issue.

Please use the patch for now, but I don't want d6 backport to deviate from core.

hass’s picture

The issue is that we have done this over and over...

Every time I reported bugs you said you cannot repro and now you say you know about it... how strange is this!???

boombatower’s picture

/me is tired of hass getting on his case when he works hard and just likes respect

I never said I couldn't reproduce this issue...infact in my first real response #5 I linked to reason. I'm getting tired of you getting all over my case. These issues are linked to D7 core and there is NOTHING I can/will do about them in D6. Please deal with the issue in core...I have even posted possible fix.

A number of your issues I could not reproduce and infact if I remember correctly were specific to your setup.

My response was directed at previous comment, as is the usual way of things, in that we have hard coded fixes to these static issues multiple times and need to come up with clean fix that can be applied to contrib as well.

@yhager: forgot to say before, but thanks for debugging that. It confirms my suspicion.

@hass: I see you are annoyed that you wasted a lot of time and all, but that doesn't mean you need to take it out on me. The majority of the issues are very specific and odd the rest were issues for core. I have been rather busy that last few months and didn't have a whole lot of time to debug issues that only you were seeing and several, if not all, of which were upgrade specific. The 2.x branch is a convenience to the community as it is a backport of D7...it is purely for development and not for production sites....thus an upgrade path is rather pointless and being that my time was limited devoting resources to that end was at lowest priority, not to mention I really don't want the upgrade stuff in there.

damien tournoud’s picture

Project: SimpleTest » Drupal core
Version: 6.x-2.x-dev » 7.x-dev
Component: Code » simpletest.module

/me helping Jimmy closing 6.x issues.

This is a duplicate of #348455: Provide a scalable way to ensure a clean testing environment for SimpleTest.

hass’s picture

Who says that a develop installation need to be a plain new vanilla install? I'd often like to develop with real live data much more as it makes testing of modules much easier. Therefore I'm using one of my sites with different data as devel cannot create such custom nodes and block etc. for us today.

This bugs are examples of untested configurations abroad an standard installation (custom files folder) or simple upgrade paths between major Drupal versions. It's nothing specific to my installation nor setup. I know upgrade paths are often not well tested and this is *why* I jump into this QA to make sure my installations are not going to be cluttered and broken. Sorry for testing upgrade paths. We are all very bussy... sorry for stressing :-)

boombatower’s picture

Was not referring to this issue as configuration specific. This issue is not due to untested configuration or w/e...we are aware of the issue...but it is one of infinite scale...SimpleTest CANNOT clear ALL statics manually...just doesn't work...especially when you contrib...therefore the ONLY solution is #348455: Provide a scalable way to ensure a clean testing environment for SimpleTest.

Upgrade path you can leave at what you like...we disagree on that and won't ever see eye to eye. What I have tried to say all along is that SimpleTest 2.x is simply the second generation of Drupal's testing framework...it no longer uses the simpletest.org library and doesn't resemble the original workings (internally and allot externally) at all. This is simply a convenience having this backported. Perhaps to better illustrate my point I should have created a different module called "Testing" which is what SimpleTest will be re-named to just before D7 goes into freeze.

yhager’s picture

@boombatower: I understand and agree to your reasoning that this should be handled correctly in the other issue for D7. However, D6 is in maintenance mode, and I am not sure if such a patch has a chance to land in D6. For this reason, I believe that although this is the same issue and the proper fix should go into D7, for D6 we have no choice, but continue running after statics like this - to provide a working simpletest environment.

boombatower’s picture

Title: locale module errors when running a simpletest » Clear language statics to remove locale module errors
Project: Drupal core » SimpleTest
Version: 7.x-dev » 6.x-2.x-dev
Component: simpletest.module » Code
Status: Closed (duplicate) » Fixed

Although this is not the clean solution, now that I have brainstormed and see that the clean solution requires modification of core this seems reasonable.

Committed modified #13.

yhager’s picture

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.