Skip to content

Commit a28d626

Browse files
committed
doc: Fix listed supported categories
Added dedicated test
1 parent 7816ba9 commit a28d626

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

.github/workflows/glpi-agent-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
make test
5151
- name: Run Author tests
5252
run: |
53-
make test TEST_AUTHOR=1 TEST_FILES="t/02critic.t t/03var.t t/04pod-syntax.t t/06pod-spelling.t t/07whitespaces.t t/09cpanmeta.t"
53+
make test TEST_AUTHOR=1 TEST_FILES="t/02critic.t t/03var.t t/04pod-syntax.t t/06pod-spelling.t t/06pod-listed-categories.t t/07whitespaces.t t/09cpanmeta.t"
5454
5555
windows-test:
5656

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ Revision history for GLPI agent
22

33
1.15 not yet released
44

5+
core:
6+
* Fix glpi-agent script listed supported categories
7+
58
packaging:
69
* Update Windows packaging to use:
710
- gcc 14.2.0posix-19.1.7-12.0.0-msvcrt-r3

bin/glpi-agent

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,8 @@ categories are:
499499
500500
=item * accesslog
501501
502+
=item * antivirus
503+
502504
=item * battery
503505
504506
=item * bios
@@ -513,6 +515,8 @@ categories are:
513515
514516
=item * environment
515517
518+
=item * firewall
519+
516520
=item * hardware
517521
518522
=item * input

t/06pod-listed-categories.t

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/perl
2+
3+
use strict;
4+
use warnings;
5+
6+
use Test::More;
7+
use UNIVERSAL::require;
8+
use English qw(-no_match_vars);
9+
10+
use GLPI::Agent::Tools;
11+
12+
use constant LISTED_CATEGORY_COUNT => 37;
13+
14+
plan(skip_all => 'Author test, set $ENV{TEST_AUTHOR} to a true value to run')
15+
if !$ENV{TEST_AUTHOR};
16+
17+
# Check all categtories are listed in glpi-agent pod part
18+
19+
plan tests => 2;
20+
21+
my %categories;
22+
foreach my $line (getAllLines(command => "bin/glpi-agent --list-categories")) {
23+
chomp($line);
24+
next unless $line =~ /^ - (.+)$/;
25+
$categories{$1} = 1;
26+
}
27+
28+
my $count = scalar keys(%categories);
29+
ok($count == LISTED_CATEGORY_COUNT, "Listed categories count: $count should be ".LISTED_CATEGORY_COUNT);
30+
31+
foreach my $line (getAllLines(file => "bin/glpi-agent")) {
32+
chomp($line);
33+
next unless $line =~ /^=item \* (.+)$/;
34+
delete $categories{$1};
35+
}
36+
37+
my @missing = keys(%categories);
38+
39+
map { warn "Category '$_' is missing in bin/glpi-agent pod\n" } @missing;
40+
41+
ok(scalar(@missing) == 0, "Listed categories in bin/glpi-agent");

0 commit comments

Comments
 (0)