my $path = mockd_start();
END { mockd_stop(); }
-sub filter_time { return map { delete $_->{time}; $_ } @_ }
-
sub test_query {
my ($s, $attr, $results) = @_;
my ($nresults, $resultdata) = @$results;
my @values = $s->listval;
is(scalar @values, 4984, "Correct number of results from LISTVAL");
-delete $values[1234]{time}; # won't be constant
is_deeply($values[1234], {
type_instance => 'nice',
plugin_instance => 21,
plugin => 'cpu',
type => 'cpu',
- host => 'h2gdf6120'
+ host => 'h2gdf6120',
+ time => 1479835354.434,
}, "Correct data returned for select element");
@values = ();
-is_deeply([ filter_time $s->listval_filter() ] , [ filter_time $s->listval ], "listval_filter() w/o filter equivalent to listval()");
+is_deeply([ $s->listval_filter() ] , [ $s->listval ], "listval_filter() w/o filter equivalent to listval()");
is_deeply(
- [ filter_time $s->listval_filter(host => 'a1d8f6310', plugin => 'disk', plugin_instance => 'vda6') ],
+ [ $s->listval_filter(host => 'a1d8f6310', plugin => 'disk', plugin_instance => 'vda6') ],
[
- { 'plugin_instance' => 'vda6', 'type' => 'disk_merged', 'plugin' => 'disk', 'host' => 'a1d8f6310' },
- { 'host' => 'a1d8f6310', 'plugin' => 'disk', 'plugin_instance' => 'vda6', 'type' => 'disk_octets' },
- { 'type' => 'disk_ops', 'plugin_instance' => 'vda6', 'plugin' => 'disk', 'host' => 'a1d8f6310' },
- { 'plugin' => 'disk', 'host' => 'a1d8f6310', 'type' => 'disk_time', 'plugin_instance' => 'vda6' }
+ { 'plugin_instance' => 'vda6', 'type' => 'disk_merged', 'plugin' => 'disk', 'host' => 'a1d8f6310', time => 1479835354.434 },
+ { 'host' => 'a1d8f6310', 'plugin' => 'disk', 'plugin_instance' => 'vda6', 'type' => 'disk_octets', time => 1479835356 },
+ { 'type' => 'disk_ops', 'plugin_instance' => 'vda6', 'plugin' => 'disk', 'host' => 'a1d8f6310', time => 1479835354 },
+ { 'plugin' => 'disk', 'host' => 'a1d8f6310', 'type' => 'disk_time', 'plugin_instance' => 'vda6', time => 1479835354 }
],
"Correct result from listval_filter on <host>, <plugin> and <plugin_instance>"
);