### ----------------------------------------------------
### -- MongoDB
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman, Paweł Pabian
### -- File: xt/Tests/Basic/300-Monitor.rakutest
### ----------------------------------------------------
use Test;

use MongoDB;
#use MongoDB::Server::Monitor;

#-------------------------------------------------------------------------------
my Str $log-path = @*ARGS[0];
my Version $version .= new(@*ARGS[1]);
my @server-ports = @*ARGS[2..*];
#note "args: $log-path, $version, @server-ports";

#-------------------------------------------------------------------------------
drop-send-to('mongodb');
drop-send-to('screen');
#modify-send-to( 'screen', :level(MongoDB::MdbLoglevels::Trace));
my $handle = $log-path.IO.open( :mode<wo>, :append);
add-send-to( 'mdb', :to($handle), :min-level(MongoDB::MdbLoglevels::Debug));
#set-filter(|<ObserverEmitter Timer Socket>);

info-message("Test $?FILE start");

my $m;
require ::("MongoDB::Server::Monitor");

dies-ok {$m = ::("MongoDB::Server::Monitor").new;}, 'dies on .new()';

$m = ::("MongoDB::Server::Monitor").instance;
is $m.^name, 'MongoDB::Server::Monitor', '.instance()';

#my MongoDB::Server::Monitor $m .= instance;

#-------------------------------------------------------------------------------
info-message("Test $?FILE stop");
done-testing();


