Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove maximum time testing from CRL #2545

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ public void testConnectionRetry(String replacedDbName, String addedRetryParams)

/**
* Tests that the correct number of retries are happening for all statement scenarios. Tests are expected to take
* a minimum of the sum of whatever has been defined for the waiting intervals, and maximum of the previous sum
* plus some amount of time to account for test environment slowness.
* a minimum of the sum of whatever has been defined for the waiting intervals. Maximum is not tested due to the
* unpredictable factor of slowness that can be applied to these tests.
*/
@Test
public void statementTimingTests() {
Expand Down Expand Up @@ -253,8 +253,6 @@ public void statementTimingTests() {
totalTime = System.currentTimeMillis() - timerStart;
assertTrue(totalTime > TimeUnit.SECONDS.toMillis(5),
"total time: " + totalTime + ", expected minimum time: " + TimeUnit.SECONDS.toMillis(5));
assertTrue(totalTime < TimeUnit.SECONDS.toMillis(15),
"total time: " + totalTime + ", expected maximum time: " + TimeUnit.SECONDS.toMillis(15));
}

timerStart = System.currentTimeMillis();
Expand All @@ -268,8 +266,6 @@ public void statementTimingTests() {
totalTime = System.currentTimeMillis() - timerStart;
assertTrue(totalTime > TimeUnit.SECONDS.toMillis(2),
"total time: " + totalTime + ", expected minimum time: " + TimeUnit.SECONDS.toMillis(8));
assertTrue(totalTime < TimeUnit.SECONDS.toMillis(18),
"total time: " + totalTime + ", expected maximum time: " + TimeUnit.SECONDS.toMillis(18));
}

timerStart = System.currentTimeMillis();
Expand All @@ -283,8 +279,6 @@ public void statementTimingTests() {
totalTime = System.currentTimeMillis() - timerStart;
assertTrue(totalTime > TimeUnit.SECONDS.toMillis(3),
"total time: " + totalTime + ", expected minimum time: " + TimeUnit.SECONDS.toMillis(10));
assertTrue(totalTime < TimeUnit.SECONDS.toMillis(20),
"total time: " + totalTime + ", expected maximum time: " + TimeUnit.SECONDS.toMillis(20));
}
}

Expand Down Expand Up @@ -496,14 +490,13 @@ public void testRetryChange() throws Exception {

/**
* Tests that the correct number of retries are happening for all connection scenarios. Tests are expected to take
* a minimum of the sum of whatever has been defined for the waiting intervals, and maximum of the previous sum
* plus some amount of time to account for test environment slowness.
* a minimum of the sum of whatever has been defined for the waiting intervals. Maximum is not tested due to the
* unpredictable factor of slowness that can be applied to these tests.
*/
@Test
public void connectionTimingTest() {
long totalTime;
long timerStart = System.currentTimeMillis();
long expectedMaxTime = 10;

// No retries since CRL rules override, expected time ~1 second
try {
Expand All @@ -517,18 +510,10 @@ public void connectionTimingTest() {
|| ((isSqlAzure() || isSqlAzureDW()) && e.getMessage().toLowerCase()
.contains(TestResource.getResource("R_connectTimedOut").toLowerCase())),
e.getMessage());

if (e.getMessage().toLowerCase().contains(TestResource.getResource("R_cannotOpenDatabase").toLowerCase())) {
// Only check the timing if the correct error, "cannot open database", is returned.
totalTime = System.currentTimeMillis() - timerStart;
assertTrue(totalTime < TimeUnit.SECONDS.toMillis(expectedMaxTime),
"total time: " + totalTime + ", expected time: " + TimeUnit.SECONDS.toMillis(expectedMaxTime));
}
}

timerStart = System.currentTimeMillis();
long expectedMinTime = 10;
expectedMaxTime = 35;

// (0s attempt + 0s attempt + 10s wait + 0s attempt) = expected 10s execution time
try {
Expand All @@ -546,8 +531,6 @@ public void connectionTimingTest() {
if (e.getMessage().toLowerCase().contains(TestResource.getResource("R_cannotOpenDatabase").toLowerCase())) {
// Only check the timing if the correct error, "cannot open database", is returned.
totalTime = System.currentTimeMillis() - timerStart;
assertTrue(totalTime < TimeUnit.SECONDS.toMillis(expectedMaxTime), "total time: " + totalTime
+ ", expected max time: " + TimeUnit.SECONDS.toMillis(expectedMaxTime));
assertTrue(totalTime > TimeUnit.SECONDS.toMillis(expectedMinTime), "total time: " + totalTime
+ ", expected min time: " + TimeUnit.SECONDS.toMillis(expectedMinTime));
}
Expand All @@ -571,8 +554,6 @@ public void connectionTimingTest() {
if (e.getMessage().toLowerCase().contains(TestResource.getResource("R_cannotOpenDatabase").toLowerCase())) {
// Only check the timing if the correct error, "cannot open database", is returned.
totalTime = System.currentTimeMillis() - timerStart;
assertTrue(totalTime < TimeUnit.SECONDS.toMillis(expectedMaxTime), "total time: " + totalTime
+ ", expected max time: " + TimeUnit.SECONDS.toMillis(expectedMaxTime));
assertTrue(totalTime > TimeUnit.SECONDS.toMillis(expectedMinTime), "total time: " + totalTime
+ ", expected min time: " + TimeUnit.SECONDS.toMillis(expectedMinTime));
}
Expand Down
Loading