Skip to content

Commit

Permalink
simple ping tests + add hostname to log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
eserte committed Jul 14, 2024
1 parent 569a873 commit ff8fdd9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bin/setup-cpantestersmatrix-doit.pl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
sub unpriv_setup {
my $unpriv_doit = shift;

Doit::Log::set_label("\@ $dest_system(unpriv)");

my $repo_localdir = "$ENV{HOME}/src/CPAN/CPAN-Testers-Matrix";
my $repo_branch = 'master';

Expand Down Expand Up @@ -54,6 +56,8 @@ sub unpriv_setup {
sub priv_setup {
my($priv_doit, $info) = @_;

Doit::Log::set_label("\@ $dest_system(priv)");

my $repo_localdir = $info->{repo_localdir} // error "Missing information: repo_localdir";
my $unit_restart = $info->{unit_restart} // error "Missing information:: unit_restart";

Expand Down Expand Up @@ -131,4 +135,14 @@ sub check_dest_system_hostname {
my $priv_doit = $doit->do_ssh_connect($dest_system, as => 'root');
$priv_doit->call_with_runner('priv_setup', $info);

# simple ping test
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
my $url = "http://$dest_system:5002";
my $resp = $ua->get($url);
$resp->is_success or error "Fetching $url failed: " . $resp->dump;
$resp->decoded_content =~ /CPAN Testers Matrix/ or error "Unexpected content on $url: " . $resp->decoded_content;
info "Fetching $url was successful: " . $resp->status_line;

__END__

0 comments on commit ff8fdd9

Please sign in to comment.