Skip to content

Commit

Permalink
Im so confused
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffery-Wasty committed Oct 18, 2023
1 parent 379ed1c commit 5c0e32d
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public void testConnectCountInLoginAndCorrectRetryCount() {

int connectRetryCount = 3;
int connectRetryInterval = 1;
int longLoginTimeout = loginTimeOutInSeconds * 4; // 120 seconds
int longLoginTimeout = loginTimeOutInSeconds * 4; // 40 seconds

try {
SQLServerDataSource ds = new SQLServerDataSource();
Expand All @@ -480,12 +480,12 @@ public void testConnectCountInLoginAndCorrectRetryCount() {
long totalTime = System.currentTimeMillis() - timerStart;
int expectedMinimumTimeInMillis = (connectRetryCount * connectRetryInterval) * 1000; // 3 seconds

System.out.println("TOTAL TIME: " + totalTime);
System.out.println("testConnectCountInLoginAndCorrectRetryCount TOTAL TIME: " + totalTime);

// Minimum time is 0 seconds per attempt and connectRetryInterval * connectRetryCount seconds of interval.
// Maximum is unknown, but is needs to be less than longLoginTimeout or else this is an issue.
assertTrue(totalTime > expectedMinimumTimeInMillis, TestResource.getResource("R_executionNotLong"));
assertTrue(totalTime < 0.9 * (longLoginTimeout * 1000L), TestResource.getResource("R_executionTooLong"));
assertTrue(totalTime < longLoginTimeout * 1000L, TestResource.getResource("R_executionTooLong"));

}
}
Expand All @@ -500,7 +500,7 @@ public void testConnectCountInLoginAndCorrectRetryCountWithZeroRetry() {

int connectRetryCount = 0;
int connectRetryInterval = 60;
int longLoginTimeout = loginTimeOutInSeconds * 3; // 90 seconds
int longLoginTimeout = loginTimeOutInSeconds * 3; // 30 seconds

try {
SQLServerDataSource ds = new SQLServerDataSource();
Expand All @@ -518,10 +518,10 @@ public void testConnectCountInLoginAndCorrectRetryCountWithZeroRetry() {
assertTrue(e.getMessage().contains(TestResource.getResource("R_cannotOpenDatabase")), e.getMessage());
long totalTime = System.currentTimeMillis() - timerStart;

System.out.println("TOTAL TIME: " + totalTime);
System.out.println("testConnectCountInLoginAndCorrectRetryCountWithZeroRetry TOTAL TIME: " + totalTime);

// Maximum is unknown, but is needs to be less than longLoginTimeout or else this is an issue.
assertTrue(totalTime < 0.9 * (longLoginTimeout * 1000L), TestResource.getResource("R_executionTooLong"));
assertTrue(totalTime < longLoginTimeout * 1000L, TestResource.getResource("R_executionTooLong"));
}
}

Expand Down

0 comments on commit 5c0e32d

Please sign in to comment.