From 60e4ef9accad7ae99505bdb9b387c3f5177d678e 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) --- 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 90bd7e10780..13e4685b87e 100755 --- a/t/db_dependent/UsageStats.t +++ b/t/db_dependent/UsageStats.t @@ -68,7 +68,7 @@ subtest 'NeedUpdate() tests' => sub { subtest 'BuildReport() tests' => sub { - plan tests => 30; + plan tests => 32; $schema->storage->txn_begin; @@ -108,6 +108,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(); @@ -121,6 +122,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.39.5