diff --git a/t/integration/complete.t b/t/integration/complete.t index 0a6f96fba..2ffbbe1df 100644 --- a/t/integration/complete.t +++ b/t/integration/complete.t @@ -8,16 +8,64 @@ use lib '/usr/local/cpanel/'; use Cpanel::OS (); +use Cpanel::JSON (); use Cpanel::SafeRun::Simple (); -use Test::More tests => 7; - -use Data::Dumper; +use Test::More; +use Test::FailWarnings; # Ensures that stderr from SafeRun causes fails is( Cpanel::OS->distro(), 'almalinux', 'System is Almalinux after upgrade.' ); is( Cpanel::OS->major(), '8', 'Verson 8 of OS.' ); is( -e '/var/log/elevate-cpanel.log', 1, 'Elevate log exists.' ); -like( Cpanel::SafeRun::Simple::saferun( '/bin/sh', '-c', '/scripts/restartsrv_httpd --status' ), qr/is running as root/, 'Apache is up and accepting connections.' ); -like( Cpanel::SafeRun::Simple::saferun( '/bin/sh', '-c', '/scripts/restartsrv_cpsrvd --status' ), qr/is running as root/, 'Chksrvd is up and accepting connections.' ); -like( Cpanel::SafeRun::Simple::saferun( '/bin/sh', '-c', '/scripts/restartsrv_named --status' ), qr/is running as named/, 'Nameserver is up and accepting connections.' ); -ok( Cpanel::SafeRun::Simple::saferun( '/bin/sh', '-c', 'pgrep elevate' ) eq '', 'No instance of elevate-cpanel currently running.' ); + +my $svcstatus = run_api( qw{whmapi1 servicestatus} ); +ok( $svcstatus->{'result'}, "whmapi1 servicestatus call works" ); +if( ref $svcstatus->{'data'}{'service'} eq 'ARRAY' ) { + foreach my $svc_info ($svcstatus->{'data'}{'service'}->@*) { + next if !$svc_info->{'enabled'}; + ok( $svc_info->{'running'}, "$svc_info->{'name'} is running" ); + } +} +ok( run( qw{pgrep elevate} ) eq '', 'No instance of elevate-cpanel currently running.' ); + +# Do some basic checks for other things +# Sadly, we don't ship anything useful for login checks, so just use curl +my $login_url = run('/usr/sbin/whmlogin'); +my $content = run( qw{curl -k -L}, $login_url ); +like( $content, qr/