ZOOM::IRSpy::Test - base class for tests in IRSpy


ZOOM-IRSpy documentation Contained in the ZOOM-IRSpy distribution.

Index


Code Index:

NAME

Top

ZOOM::IRSpy::Test - base class for tests in IRSpy

SYNOPSIS

Top

 ## To follow

DESCRIPTION

Top

## To follow

SEE ALSO

Top

ZOOM::IRSpy

AUTHOR

Top

Mike Taylor, <mike@indexdata.com>

COPYRIGHT AND LICENSE

Top


ZOOM-IRSpy documentation Contained in the ZOOM-IRSpy distribution.
package ZOOM::IRSpy::Test;

use 5.008;
use strict;
use warnings;

use Scalar::Util;

use Exporter 'import';
our @EXPORT = qw(zoom_error_timeout_update zoom_error_timeout_check); 


sub subtests { () }

sub timeout { undef }

sub start {
    my $class = shift();
    my($conn) = @_;

    die "can't start the base-class test";
}


our $max_timeout_errors = $ZOOM::IRSpy::max_timeout_errors;

sub zoom_error_timeout_update {
    my ($conn, $exception) = @_;

    if ($exception =~ /Timeout/i) {
        $conn->record->zoom_error->{TIMEOUT}++;
        $conn->log("irspy_test", "Increase timeout error counter to: " .
                $conn->record->zoom_error->{TIMEOUT});
    }
}

sub zoom_error_timeout_check {
    my $conn = shift;

    if ($conn->record->zoom_error->{TIMEOUT} >= $max_timeout_errors) {
        $conn->log("irspy_test", "Got $max_timeout_errors or more timeouts, give up...");
        return  1;
    }

    return 0;
}

1;