<commit_before>use warnings;
use strict;

use Carp qw(confess);
use Data::Dumper;
use IPC::Run3;
use Test::More;
use Test::SQL::Data;

use lib 't/lib';
use Test::Ravada;

my $test = Test::SQL::Data->new(config => 't/etc/sql.conf');

use_ok('Ravada');

my $RVD_BACK = rvd_back($test->connector);
my %ARG_CREATE_DOM = (
      kvm => [ id_iso => 1 ]
);

my @VMS = reverse keys %ARG_CREATE_DOM;
my $USER = create_user("foo","bar");

################################################################

clean();

for my $vm_name ( @{rvd_front->list_vm_types}) {

    my $vm = rvd_back->search_vm($vm_name);

    SKIP: {

        my $msg = "SKIPPED: No virtual managers found";
        if ($vm && $vm_name =~ /kvm/i && $>) {
            $msg = "SKIPPED: Test must run as root";
            $vm = undef;
        }

        skip($msg,10)   if !$vm;

        my $domain = create_domain($vm_name, $USER) or next;

        next if !$domain->can_hybernate();

        $domain->start($USER)   if !$domain->is_active;

        my $req = Ravada::Request->hybernate(
            id_domain => $domain->id
                  ,uid=> $USER->id
        );
        ok($req);
        rvd_back->process_requests();
        wait_request($req);

        is($domain->is_active,0);

        $domain->start($USER);
        is($domain->is_active,1);


    }
}

clean();

done_testing();
<commit_msg>Give another chance to start<commit_after>use warnings;
use strict;

use Carp qw(confess);
use Data::Dumper;
use IPC::Run3;
use Test::More;
use Test::SQL::Data;

use lib 't/lib';
use Test::Ravada;

my $test = Test::SQL::Data->new(config => 't/etc/sql.conf');

use_ok('Ravada');

my $RVD_BACK = rvd_back($test->connector);
my %ARG_CREATE_DOM = (
      kvm => [ id_iso => 1 ]
);

my @VMS = reverse keys %ARG_CREATE_DOM;
my $USER = create_user("foo","bar");

################################################################

clean();

for my $vm_name ( @{rvd_front->list_vm_types}) {

    my $vm = rvd_back->search_vm($vm_name);

    SKIP: {

        my $msg = "SKIPPED: No virtual managers found";
        if ($vm && $vm_name =~ /kvm/i && $>) {
            $msg = "SKIPPED: Test must run as root";
            $vm = undef;
        }

        skip($msg,10)   if !$vm;

        my $domain = create_domain($vm_name, $USER) or next;

        next if !$domain->can_hybernate();

        $domain->start($USER)   if !$domain->is_active;

        my $req = Ravada::Request->hybernate(
            id_domain => $domain->id
                  ,uid=> $USER->id
        );
        ok($req);
        rvd_back->process_requests();
        wait_request($req);

        is($domain->is_active,0);

        $domain->start($USER);
        if (!$domain->is_active) {
            sleep(1);
            $domain->start($USER)   if !$domain->is_active;
        }

        is($domain->is_active,1);


    }
}

clean();

done_testing();

{'fraction_non_alphanumeric': 0.2144100243647755, 'fraction_numerical': 0.004524886877828055, 'mean_word_length': 2.588014981273408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2939968', 'n_tokens_mistral': 1036, 'n_tokens_neox': 996, 'n_words': 210}