owncloud / testing

🔧 app for testing ownCloud
GNU Affero General Public License v3.0
3 stars 4 forks source link

Undefined index: value #138

Closed phil-davis closed 4 years ago

phil-davis commented 4 years ago

While running some password_policy tests locally I noticed my PHP dev server output:

...
[Wed Mar 18 17:29:32 2020] 192.168.1.22:35444 [200]: /status.php
[Wed Mar 18 17:29:32 2020] 192.168.1.22:35446 [200]: /status.php
[Wed Mar 18 17:29:32 2020] 192.168.1.22:35448 [200]: /status.php
[Wed Mar 18 17:29:32 2020] 192.168.1.22:35450 [200]: /status.php
[Wed Mar 18 17:29:32 2020] 192.168.1.22:35452 [207]: /remote.php/webdav/folder-to-share
[Wed Mar 18 17:29:32 2020] Undefined index: value at /home/phil/git/owncloud/core/apps-external/testing/lib/Config.php#102
[Wed Mar 18 17:29:32 2020] 192.168.1.22:35458 [200]: /ocs/v2.php/apps/testing/api/v1/apps
[Wed Mar 18 17:29:32 2020] 192.168.1.22:35460 [200]: /ocs/v2.php/apps/testing/api/v1/apps
[Wed Mar 18 17:29:33 2020] 192.168.1.22:35466 [200]: /ocs/v2.php/apps/testing/api/v1/occ
[Wed Mar 18 17:29:33 2020] 192.168.1.22:35474 [200]: /ocs/v2.php/apps/testing/api/v1/opcache
[Wed Mar 18 17:29:33 2020] 192.168.1.22:35476 [200]: /ocs/v2.php/apps/testing/api/v1/occ
[Wed Mar 18 17:29:33 2020] 192.168.1.22:35480 [200]: /ocs/v2.php/apps/testing/api/v1/opcache
[Wed Mar 18 17:29:34 2020] 192.168.1.22:35484 [200]: /ocs/v2.php/apps/testing/api/v1/lockprovisioning
[Wed Mar 18 17:29:34 2020] 192.168.1.22:35488 [200]: /ocs/v1.php/apps/testing/api/v1/apps
[Wed Mar 18 17:29:34 2020] 192.168.1.22:35490 [200]: /ocs/v2.php/apps/testing/api/v1/occ
[Wed Mar 18 17:29:34 2020] 192.168.1.22:35492 [200]: /ocs/v2.php/apps/testing/api/v1/opcache
...

Something is calling the testing app to set some setting(s) and is not sending value

Investigate.

(Probably this will be something in run.sh or a BeforeScenario of the ordinary test environment setup - ~likely it needs fixing in core - just a guess~ - it does not happen when I run a core scenario, so next guess is something in password_policy BeforeScenario)

phil-davis commented 4 years ago

An example test scenario run is:

make test-acceptance-webui BEHAT_FEATURE=tests/acceptance/features/webUIPasswordChangeUsersPage/passwordChangeLowercaseLetters.feature:25

And I see output like:

[Tue Mar 24 09:52:15 2020] 172.17.0.3:59492 [200]: /index.php/settings/users/changepassword
[Tue Mar 24 09:52:16 2020] 10.49.210.9:39956 [200]: /ocs/v2.php/cloud/users/user1
[Tue Mar 24 09:52:16 2020] 10.49.210.9:39958 [200]: /remote.php/webdav/textfile0.txt
[Tue Mar 24 09:52:16 2020] Login failed: 'user1' (Remote IP: '10.49.210.9')
[Tue Mar 24 09:52:16 2020] 10.49.210.9:39960 [401]: /remote.php/webdav/textfile0.txt
[Tue Mar 24 09:52:16 2020] Undefined index: value at /home/phil/git/owncloud/core/apps-external/testing/lib/Config.php#102
[Tue Mar 24 09:52:16 2020] 10.49.210.9:39962 [200]: /ocs/v2.php/apps/testing/api/v1/apps
[Tue Mar 24 09:52:16 2020] 10.49.210.9:39964 [200]: /ocs/v2.php/apps/testing/api/v1/apps
[Tue Mar 24 09:52:16 2020] 10.49.210.9:39966 [200]: /ocs/v2.php/apps/testing/api/v1/occ
[Tue Mar 24 09:52:16 2020] 10.49.210.9:39968 [200]: /ocs/v2.php/apps/testing/api/v1/opcache
[Tue Mar 24 09:52:17 2020] 10.49.210.9:39970 [200]: /ocs/v2.php/apps/testing/api/v1/occ

It seems to happen with UI tests.

IMO that "login failed" was meant to be part of the test - the test scenario does check for trying to download with a wrong password. That might help debugging - the Undefined index comes after the test step, so it could be that the problem is in an AfterScenario

Talank commented 4 years ago

While doing var dump in one of the After Scenario for the test

make test-acceptance-webui BEHAT_FEATURE=tests/acceptance/features/webUIPasswordChangeUsersPage/passwordChangeLowercaseLetters.feature:25

The output was Like this

....../core/tests/TestHelpers/AppConfigHelper.php:299:
      │  array(3) {
            .
            .
            .
      │    [2] =>
      │    array(3) {
      │      'configkey' =>
      │      string(5) "types"
      │      'value' =>
      │      array(0) {
      │      }
      │      'appid' =>
      │      string(15) "password_policy"
      │    }
      │  }

Here, The value is an empty array, which is responsible for the undefined index value output in server log. The problem has been fixed by the PR https://github.com/owncloud/core/pull/37162 by converting the array of value into string