With the detection of a problem in db_query_range. I realized that the fork features did not work at all.

  • db_query_range miss an argument
  • even with the argument there is a problem in the query, so I change it with a db_select
  • In the validation function, there is the use of $form['#post'] which is undefined

I wonder if someone is using this feature. Which seems very buggy to me. I will upload a fix.

If nobody is using this feature, maybe it should be deleted ?

Comments

grimreaper’s picture

grimreaper’s picture

Status: Active » Needs review

Forgot to change issue status

izus’s picture

Status: Needs review » Needs work

idk if someone is using it, but it may be interesting to keep it and fix it for people that use it in d6 version and that my want it in d7 too

+++ b/protected_node.fork.inc
@@ -214,13 +214,14 @@ function protected_node_enter_any_password_validate($form, &$form_state) {
+    ->range(0, 1)

why only one result ?

also i agree that we can mege a quick fix for the fork feature, but we should also start some testings for it in a new task (there is a lot of @todo in that file !!)

grimreaper’s picture

Why one result? I don't know as the db_query_range was not implemented correctly. It's a quick fix.

Yeah a lot of things to do, that's why I have proposed to delete if nobody is using it.

Ok about keeping the feature if we have tests for it.

grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new17.71 KB

Hello,

There is a patch that fix the fork feature and add tests for that.

@izus: Now I can answer you why one result. Because it is the node to which the user will be redirected.

Thanks for the review.

Status: Needs review » Needs work

The last submitted patch, 5: protected_node-fix_fork_feature-2447913-5.patch, failed testing.

grimreaper’s picture

Hum I don't understand why the tests failed with the automated bot and not in my ocal environment.

If someone can test the last patch please.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 5: protected_node-fix_fork_feature-2447913-5.patch, failed testing.

izus’s picture

i have it working too locally, but we should find why it doesn't with d.o or all tests to come will fail :/

izus’s picture

Status: Needs work » Needs review
StatusFileSize
new10.93 KB

Here is a patch that is only there for debugging
Please do not merge it or use it except for debugging do test robot.

actually it : deletes all tests except the one that is failing (so that test run very fast :))
so that we can some verbose and debug what test robots gets

Status: Needs review » Needs work
izus’s picture

Status: Needs work » Needs review
StatusFileSize
new53.96 KB

oups, this is the good patch

izus’s picture

now adding all the .fork.test tests.

Status: Needs review » Needs work
grimreaper’s picture

Thanks for the tests Izus.

To help debugging the do automated tests, would it be better to merge the patch commenting the test that does not pass so it will be easier to review small patches ?

izus’s picture

hi yes it may be good to merge what works and le the issue open for debugging the test that fails

grimreaper’s picture

Ok, this is now merged.

  • Grimreaper committed 8f314e9 on 7.x-1.x
    Issue #2447913 by izus, Grimreaper: Fix fork feature.
    
grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new2.25 KB

I suspect that it is the function to clear user session that does not work on the testbot. Let's see that.

Status: Needs review » Needs work

The last submitted patch, 21: do_not_merge-protected_node-debug_test_bot-2447913-21.patch, failed testing.

grimreaper’s picture

I don't understand why it is failing.

As said on: https://www.drupal.org/project/testbot

I test on simplytest.me, I test using the command line, I test without url rewriting. Each time it is ok.

And this is not a problem of clearing the session because there is a test on clearing session in protected_node.bulk.test and it is ok.

Hum... Maybe it is the way to format the URL of $this->drupalPost('protected-nodes', $form, t('OK'), array('query' => array('protected_pages' => $protected_pages)));

with $protected_pages = implode(',', array($node1->nid, $node2->nid));

Maybe on testbot the second nid is not well detected. I think of an improvement, in the function protected_node_get_nids_from_protected_pages_parameter() instead of manipulating $_GET, using the function drupal_get_query_parameters.

I will try that.

Status: Needs review » Needs work

The last submitted patch, 24: do_not_merge-protected_node-debug_test_bot-2447913-24.patch, failed testing.

grimreaper’s picture

StatusFileSize
new2.51 KB

Ok That is not the problem.

I will try creating another user to access the second node in the test.

grimreaper’s picture

Status: Needs work » Needs review
grimreaper’s picture

sending patch to testbot

The last submitted patch, 26: do_not_merge-protected_node-debug_test_bot-2447913-26.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 28: do_not_merge-protected_node-debug_test_bot-2447913-26.patch, failed testing.

izus’s picture

Hi,
as suggested before, try merging the tests that work so that we have just little code to debug.
i personnaly think it is due to redirections.
i experienced once an issue like that but didn't give it time to be sure of the following hypothesis :
- May be, in some situations that i didn't digg into, d.o redirects to /checkout/foo/bar when you ask it to redirect to /foo/bar

grimreaper’s picture

Hello,

It is already merged.

Yeah, I know you had those problems :), like you I will try using xpath to know what the testbot landing page looks like.

If that did not success, maybe I will post an issue on the testbot project.

grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new2.09 KB

With that patch, we will know the title of the falling page.

Status: Needs review » Needs work

The last submitted patch, 33: do_not_merge-protected_node-debug_test_bot-2447913-33.patch, failed testing.

grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new7.8 KB

Ok, so the user is on the password form. Let's see if it is in error.

Status: Needs review » Needs work

The last submitted patch, 35: do_not_merge-protected_node-debug_test_bot-2447913-35.patch, failed testing.

grimreaper’s picture

  1. +++ b/tests/protected_node.fork.test
    @@ -109,10 +108,15 @@ class ProtectedNodeFork extends ProtectedNodeBaseTestCase {
    +    $this->assertEqual($title, $page_title, "Node title: $title. Xpath found title: $page_title.", $this->group);
    

    So this time this assertion is green.

  2. +++ b/tests/protected_node.fork.test
    @@ -109,10 +108,15 @@ class ProtectedNodeFork extends ProtectedNodeBaseTestCase {
    +    $this->assertText('Incorrect password!', "the user has entered the wrong password", $this->group);
    

    But this one is not. So The user has arrived to the node2 page. Whereas in the previous patch he/she can't... Strange.

grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new2.07 KB

This time as previously the user has arrived to node 2. The tests should be green.

Status: Needs review » Needs work

The last submitted patch, 38: do_not_merge-protected_node-debug_test_bot-2447913-38.patch, failed testing.

Status: Needs work » Needs review
grimreaper’s picture

Ah! the test is green has predicted.

So with the same tests, one time the testbot returns red and the other time it is green... I don't know how to be sure we can trust the testbot.

Status: Needs review » Needs work

The last submitted patch, 38: do_not_merge-protected_node-debug_test_bot-2447913-38.patch, failed testing.

grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new2.09 KB

Status: Needs review » Needs work

The last submitted patch, 44: do_not_merge-protected_node-debug_test_bot-2447913-44.patch, failed testing.

grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new2.46 KB

Status: Needs review » Needs work

The last submitted patch, 46: do_not_merge-protected_node-debug_test_bot-2447913-46.patch, failed testing.

izus’s picture

izus’s picture

actually one possible method to be close to testbot is running test locally on a "subfolder installed drupal": (i'm not sure it's the only difference here)

the vhsot servername as drupal.local
the vhsot documentroot is the the *parent* folder of drupal
and settings.php base_url as http://drupal.local/drupal

actually even in drupal 8 core code we can read :
"// Base path gives problems on the testbot, so $correct_link is hard-coded." (466 LanguageUILanguageNegociationTest.php)
!

grimreaper’s picture

Hello,

Thanks for the suggestion. I will try with Drupal installed as a subfolder.

But I don't want to spend more time on this because I think (hope) it will be solved with the new Drupal CI that will replace the testbot.

grimreaper’s picture

Assigned: grimreaper » Unassigned

Hello,

The tests are green in local even with Drupal accessed as a subfolder.

grimreaper’s picture

Status: Needs work » Fixed

Hello,

I consider the issue fixed. The problem with the test should fixed in https://www.drupal.org/node/2277045#comment-10092654

Thanks.

izus’s picture

Status: Fixed » Needs work

idk why the testbot went ok, i guess it's related with news testbot deploy.
i just configured out tests frequency https://www.drupal.org/node/130911/qa
and run a test for 7.x branch
it fails on the fork feature

izus’s picture

digitgopher’s picture

Hand testing, it works. It is weird. Auto-testing locally, it fails intermittently. Around 50% of the time maybe. Sometimes I change the second parameter of
$this->drupalPost('admin/config/content/protected_node', array(), t('Clear sessions'));
to NULL, and that doesn't really make a difference.

grimreaper’s picture

Hello,

Thanks for the feedback. For me locally it works everytime (I need to check). Could you please give your configuration?

grimreaper’s picture

Status: Needs work » Fixed

Now every tests pass... Very very strange. I think I am becoming crazy...

Status: Fixed » Closed (fixed)

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