Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data from migrations table to report #64

Merged
merged 1 commit into from
Sep 12, 2018
Merged

Conversation

sharidas
Copy link
Contributor

@sharidas sharidas commented Sep 4, 2018

Add data from migrations table to the
report.

Signed-off-by: Sujith H sharidasan@owncloud.com

@sharidas sharidas self-assigned this Sep 4, 2018
@sharidas sharidas added this to the development milestone Sep 4, 2018
@sharidas
Copy link
Contributor Author

sharidas commented Sep 4, 2018

Fixes #63

@codecov-io
Copy link

codecov-io commented Sep 4, 2018

Codecov Report

Merging #64 into master will decrease coverage by 0.4%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##             master    #64      +/-   ##
==========================================
- Coverage       7.1%   6.7%   -0.41%     
- Complexity       52     53       +1     
==========================================
  Files             6      6              
  Lines           183    194      +11     
==========================================
  Hits             13     13              
- Misses          170    181      +11
Impacted Files Coverage Δ Complexity Δ
lib/AppInfo/Application.php 0% <0%> (ø) 3 <0> (ø) ⬇️
lib/Command/ConfigReport.php 0% <0%> (ø) 3 <0> (ø) ⬇️
lib/ReportDataCollector.php 0% <0%> (ø) 37 <1> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c11fdcb...d1c1795. Read the comment docs.

@sharidas sharidas force-pushed the add-oc-migration-data branch from 4f6aebb to 5245a1d Compare September 4, 2018 17:24
@patrickjahns
Copy link
Contributor

patrickjahns commented Sep 4, 2018

Would be great to expand the test-matrix now, to test configreport app in combination with several Database backends. ( mysql / postgres / oracle ) - so we can ensure that the report still works expected with the different supported databases

Database test improvments here:
#65

@patrickjahns patrickjahns mentioned this pull request Sep 4, 2018
@sharidas sharidas force-pushed the add-oc-migration-data branch from 5245a1d to d7fb726 Compare September 5, 2018 07:10
@sharidas sharidas changed the title [WIP] Add data from migrations table to report Add data from migrations table to report Sep 5, 2018
@sharidas sharidas force-pushed the add-oc-migration-data branch from d7fb726 to 2eaaf8c Compare September 5, 2018 07:14
->willReturn($expectedResult);

$this->connection
->method('getQueryBuilder')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might have been better to put actual data into the oc_migrations table, but I guess there might be data there already due to setup

or check that the result contains some old known migrations from the real data ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PVince81 I captured the data from my dev machine and updated the test. Let me know if the updated test looks ok. For testing I used sqlite. Below is the console log:

➜  unit git:(add-oc-migration-data) ✗ /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit ReportDataCollectorTest.php
Cannot load Xdebug - it was already loaded
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.9-1+ubuntu18.04.1+deb.sury.org+1 with Xdebug 2.6.0
Configuration: /home/sujith/test/owncloud3/apps/configreport/tests/unit/phpunit.xml

.                                                                   1 / 1 (100%)

Time: 10.24 seconds, Memory: 44.00MB

OK (1 test, 181 assertions)

Generating code coverage report in Clover XML format ... done
➜  unit git:(add-oc-migration-data) ✗ 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch hold on... I will ping again here. Just hold on for review. Until I fix this...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so the failure as of now is ..Makefile:41: recipe for target 'test-php-unit-dbg' failed https://drone.owncloud.com/owncloud/configreport/125/64.

@PVince81 Let me know the updated tests look ok.

@PVince81
Copy link
Contributor

PVince81 commented Sep 5, 2018

this will also need a backport

@PVince81
Copy link
Contributor

PVince81 commented Sep 5, 2018

wot

phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "../../lib/composer/bin/phpunit" --configuration ./tests/unit/phpunit.xml
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

Runtime:       PHPDBG 7.1.20-1+ubuntu16.04.1+deb.sury.org+1
Configuration: /var/www/owncloud/apps/configreport/tests/unit/phpunit.xml

..Makefile:41: recipe for target 'test-php-unit-dbg' failed

https://drone.owncloud.com/owncloud/configreport/121/64

@patrickjahns

@sharidas sharidas force-pushed the add-oc-migration-data branch 4 times, most recently from 3011f3b to dc7db3d Compare September 5, 2018 08:58
$this->assertArrayHasKey('app', $result);
$this->assertArrayHasKey('version', $result);
$values = \array_values($result);
$this->assertContains($values[0], ['core', 'dav', 'files_sharing', 'files_trashbin', 'notifications', 'dav', 'files_external', 'federatedfilesharing', 'customgroups']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will likely fail as we don't bundle "customgroups", etc

only pick the ones present in the core repository

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the test, removed customgroups. I can't delete notifications, though. As the bundle owncloud-daily-master-qa.tar.bz2 has notifications app.

@sharidas sharidas force-pushed the add-oc-migration-data branch 6 times, most recently from 7927e57 to bd242c4 Compare September 5, 2018 11:41
@PVince81
Copy link
Contributor

PVince81 commented Sep 5, 2018

@sharidas you cannot list all migrations anyway, so only a few is enough.
As for apps, you also used assertContains() which is not an exact match but only a few, so removing "notifications" is ok.

@sharidas sharidas force-pushed the add-oc-migration-data branch 2 times, most recently from 8a03de7 to ac41883 Compare September 5, 2018 12:42
@sharidas
Copy link
Contributor Author

sharidas commented Sep 5, 2018

Updated the test. Removed notifications from the list. The iteration is done over an array of results, and if an app which is not part of the core app is found then no assertions are checked. If the apps are from core the assertions are checked. @PVince81

@PVince81
Copy link
Contributor

PVince81 commented Sep 5, 2018

@patrickjahns should we ignore / disable to unblock this ?

+ if [ -z "true" ]; then make test-php-unit; fi
+ if [ "true" = "true" ]; then make test-php-unit-dbg; fi
phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "../../lib/composer/bin/phpunit" --configuration ./tests/unit/phpunit.xml
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

Runtime:       PHPDBG 7.1.20-1+ubuntu16.04.1+deb.sury.org+1
Configuration: /var/www/owncloud/apps/configreport/tests/unit/phpunit.xml

make: *** [test-php-unit-dbg] Error 255
..Makefile:41: recipe for target 'test-php-unit-dbg' failed

not sure if related to this PR

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good 👍

@sharidas
Copy link
Contributor Author

sharidas commented Sep 5, 2018

Code looks good

I am going to push the change for backport then. Thanks.

@sharidas
Copy link
Contributor Author

sharidas commented Sep 5, 2018

Backport to stable10 branch #68

@patrickjahns
Copy link
Contributor

patrickjahns commented Sep 5, 2018

not sure if related to this PR

Before this PR, the debugger would not cause segfaults and run out of memory. 4G should be limited to 2G anyway.

Neither the less - needs looking into, as we don't know what is causing the memory bloat when running the unit tests

@patrickjahns
Copy link
Contributor

Removing the test and running it in drone results in no failure. So the test added here is the culprit.

Looking at the tests, this is not a simple unit test, it's trigger a large integration test.
Debugging further - the static call at https://github.com/owncloud/configreport/blob/master/lib/ReportDataCollector.php#L126 lets everything explode.

The whole reporter class should be refactored to become testable. Right now in the current state this will 💥 in our face

@PVince81
Copy link
Contributor

Any solutions in scope for 10.0.10 RC2 ?

@sharidas sharidas force-pushed the add-oc-migration-data branch from 22ad0db to 937c025 Compare September 10, 2018 14:41
Add data from migrations table to the
report.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
@sharidas sharidas force-pushed the add-oc-migration-data branch from 937c025 to d1c1795 Compare September 10, 2018 15:08
@sharidas
Copy link
Contributor Author

The pr is updated by skipping the test.

@PVince81 PVince81 merged commit b9f141c into master Sep 12, 2018
@PVince81 PVince81 deleted the add-oc-migration-data branch September 12, 2018 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants