Fixed the login timeout test (#1141)

This commit is contained in:
Jenny Tam 2020-06-10 12:23:06 -07:00 committed by GitHub
parent 06d7a496ae
commit c31ee0e48f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,14 +1,18 @@
--TEST--
False connection with LoginTimeout option
--DESCRIPTION--
Intentionally provide an invalid server name and set LoginTimeout. Verify the time elapsed.
Intentionally provide an invalid server and set LoginTimeout. Verify the time elapsed.
The difference in time elapsed is platform dependent. In some Linux distros, extra delay
may be caused by the attempts to resolve non-existent hostnames. Already set leeway to 2
seconds to allow some room of such errors, but this test remains fragile, especially
outside Windows. Thus, use an invalid IP address instead when running in any non-Windows platform.
--SKIPIF--
<?php require('skipif.inc'); ?>
--FILE--
<?php
require_once('MsSetup.inc');
$serverName = "WRONG_SERVER_NAME";
require_once('MsCommon.inc');
$serverName = isWindows()? 'WRONG_SERVER_NAME' : '1.2.3.4';
// Based on the following reference, a login timeout of less than approximately 10 seconds
// is not reliable. The defaut is 15 seconds so we fix it at 20 seconds.
@ -17,8 +21,6 @@ $timeout = 20;
$maxAttempts = 3;
$numAttempts = 0;
// The difference in time elapsed is platform dependent, and in some distros, such as Alpine or Suse, extra delay may be caused by the attempts to resolve non-existent hostnames
// Set leeway to 2 seconds to allow some room of such errors
$leeway = 2.0;
$missed = false;