Changeset 3833

Show
Ignore:
Timestamp:
27/07/10 19:17:59 (2 years ago)
Author:
ligne
Message:

fetch doesn't return results for services in any particular order, so make sure the tests allow for this.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/node/t/munin_node_spoolreader.t

    r3831 r3833  
    33use strict; 
    44 
    5 use Test::More tests => 18
     5use Test::More tests => 20
    66use Test::LongString; 
    77 
     
    139139    ]); 
    140140 
    141     is($reader->fetch(1234567800), <<EOS, 'Several plugins to fetch'); 
     141    ok(my $fetched = $reader->fetch(1234567800), 'Several services to fetch'); 
     142 
     143    my $f1 = <<EOT; 
     144timestamp 1234567890 
     145multigraph fnord 
     146graph_title CPU usage 
     147system.label system 
     148system.value 3 
     149EOT 
     150    my $f2 = <<EOT; 
    142151timestamp 1234567910 
    143152multigraph blort 
     
    145154slab.label slab 
    146155slab.value 123 
    147 timestamp 1234567890 
    148 multigraph fnord 
    149 graph_title CPU usage 
    150 system.label system 
    151 system.value 3 
    152 EOS 
     156EOT 
     157    like($fetched, qr(\A$f1$f2|$f2$f1\Z)m, 'Got results for both services, in either order, and nothing else'); 
     158 
    153159 
    154160    is($reader->fetch(1234567900), <<EOS, 'Several plugins to fetch, but only one is recent enough'); 
     
    179185    ]); 
    180186 
    181     is($reader->fetch(1234567800), <<EOS, 'Several plugins to fetch'); 
     187    ok(my $fetched = $reader->fetch(1234567800), 'Several sets of results to fetch'); 
     188 
     189    my $f1 = <<EOT; 
     190timestamp 1234567890 
     191multigraph fnord 
     192graph_title CPU usage 
     193system.label system 
     194system.value 3 
     195EOT 
     196    my $f2 = <<EOT; 
    182197timestamp 1234567990 
    183198multigraph fnord 
     
    185200system.label system 
    186201system.value 4 
    187 timestamp 1234567890 
    188 multigraph fnord 
    189 graph_title CPU usage 
    190 system.label system 
    191 system.value 3 
    192 EOS 
    193  
     202EOT 
     203    like($fetched, qr(\A$f1$f2|$f2$f1\Z)m, 'Got results for both services, in either order, and nothing else'); 
    194204} 
    195205