Skip to content

Commit cc6cd33

Browse files
committed
User Story 38467: Backport mac server name fix
- Backported part of #3494 and #3591: - Added configurable test jobs timeout, defaulting to 90 minutes. - Reduced generated database names to 96 chars to try to fix macOS test failures.
1 parent 0b1f00b commit cc6cd33

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,21 @@ parameters:
1717
type: string
1818
default: empty
1919

20+
# The timeout, in minutes, for this job.
21+
- name: timeout
22+
type: string
23+
default: 90
24+
2025
jobs:
2126
- job: run_tests_package_reference
2227
displayName: 'Run tests with package reference'
2328
${{ if ne(parameters.dependsOn, 'empty')}}:
2429
dependsOn: '${{parameters.dependsOn }}'
30+
31+
# Some of our tests take longer than the default 60 minutes to run on some
32+
# OSes and configurations.
33+
timeoutInMinutes: ${{ parameters.timeout }}
34+
2535
pool:
2636
type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
2737
isCustom: true

eng/pipelines/dotnet-sqlclient-signing-pipeline.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ parameters: # parameters are shown up in ADO UI in a build queue time
6565
- NonOfficial
6666
- Official
6767

68+
# The timeout, in minutes, for each test job.
69+
- name: testsTimeout
70+
displayName: 'Tests timeout (in minutes)'
71+
type: string
72+
default: 90
73+
6874
variables:
6975
- template: /eng/pipelines/libraries/variables.yml@self
7076
- name: packageFolderName
@@ -164,6 +170,7 @@ extends:
164170
- template: eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml@self
165171
parameters:
166172
packageFolderName: $(packageFolderName)
173+
timeout: ${{ parameters.testsTimeout }}
167174
downloadPackageStep:
168175
download: current
169176
artifact: $(packageFolderName)

src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ public static string GetUniqueName(string prefix, bool withBracket = true)
573573
/// </summary>
574574
/// <param name="prefix">Add the prefix to the generate string.</param>
575575
/// <param name="withBracket">Database name must be pass with brackets by default.</param>
576-
/// <returns>Unique name by considering the Sql Server naming rules.</returns>
576+
/// <returns>Unique name by considering the Sql Server naming rules, never longer than 96 characters.</returns>
577577
public static string GetUniqueNameForSqlServer(string prefix, bool withBracket = true)
578578
{
579579
string extendedPrefix = string.Format(
@@ -583,10 +583,21 @@ public static string GetUniqueNameForSqlServer(string prefix, bool withBracket =
583583
Environment.MachineName,
584584
DateTime.Now.ToString("yyyy_MM_dd", CultureInfo.InvariantCulture));
585585
string name = GetUniqueName(extendedPrefix, withBracket);
586-
if (name.Length > 128)
586+
587+
// Truncate to no more than 96 characters.
588+
const int maxLen = 96;
589+
if (name.Length > maxLen)
587590
{
588-
throw new ArgumentOutOfRangeException("the name is too long - SQL Server names are limited to 128");
591+
if (withBracket)
592+
{
593+
name = name.Substring(0, maxLen - 1) + ']';
594+
}
595+
else
596+
{
597+
name = name.Substring(0, maxLen);
598+
}
589599
}
600+
590601
return name;
591602
}
592603

0 commit comments

Comments
 (0)