From ef260c70165ae6360b144540b2a91bbe76895fff Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Wed, 15 Jan 2025 16:17:19 +0100 Subject: [PATCH] Bug 23898: Share more data to HEA : test plan It would be nice to get more data about which functionnality are used or not. This could be achieved with sharing some systempreferences. However some of the systempreferences may hold some private information. This patch propose a way to share some syspref usage without sharing their values. Test plan : - apply test patch - prove t/db_dependent/UsageStats.t -> fail - apply code patch - prove t/db_dependent/UsageStats.t -> green Once this patch is applied to a production environment with HEA enabled, more systempreferences will be shared but those which values are meant to be private will only send "Empty" or "Used" value instead of the actual value. This will help the community find out about unused or rarely used functionnality and debug some specific systempreference combinations which may cause an issue. (this commit holds the tests) Signed-off-by: Victor Grousset/tuxayo --- t/db_dependent/UsageStats.t | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t index d07ad04a3e..aa27890e45 100755 --- a/t/db_dependent/UsageStats.t +++ b/t/db_dependent/UsageStats.t @@ -49,7 +49,7 @@ my $schema = Koha::Database->new->schema; subtest 'BuildReport() tests' => sub { - plan tests => 30; + plan tests => 32; $schema->storage->txn_begin; @@ -89,6 +89,7 @@ subtest 'BuildReport() tests' => sub { t::lib::Mocks::mock_preference( "UsageStatsCountry", 'COUNTRY' ); t::lib::Mocks::mock_preference( "UsageStatsLibrariesInfo", 1 ); t::lib::Mocks::mock_preference( "UsageStatsGeolocation", 1 ); + t::lib::Mocks::mock_preference( "IntranetUserJS", 'This is some javascript' ); $report = C4::UsageStats->BuildReport(); @@ -102,6 +103,8 @@ subtest 'BuildReport() tests' => sub { is( $report->{installation}->{country}, 'COUNTRY', "UsageStatsCountry is good" ); is( $report->{installation}->{geolocation}, '1', "UsageStatsGeolocation is good" ); ok( exists $report->{systempreferences}, 'systempreferences is present' ); + is( $report->{systempreferences}->{IntranetUserJS}, 'Used', "IntranetUserJS is good" ); + is( $report->{systempreferences}->{IntranetUserCSS}, 'Empty', "IntranetUserCSS is good" ); isa_ok( $report, 'HASH', '$report is a HASH' ); isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' ); -- 2.52.0