Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 463f1f9

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

File tree

8 files changed

+67
-3
lines changed

8 files changed

+67
-3
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,18 @@ parameters:
7373
- Project
7474
- Package
7575

76+
# The timeout, in minutes, for this job.
77+
- name: timeout
78+
type: string
79+
default: 90
80+
7681
jobs:
7782
- job: ${{ format('{0}', coalesce(parameters.jobDisplayName, parameters.image, 'unknown_image')) }}
7883

84+
# Some of our tests take longer than the default 60 minutes to run on some
85+
# OSes and configurations.
86+
timeoutInMinutes: ${{ parameters.timeout }}
87+
7988
pool:
8089
name: '${{ parameters.poolName }}'
8190
${{ if eq(parameters.hostedPool, true) }}:

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
@@ -20,11 +20,21 @@ parameters:
2020
- name: isPreview
2121
type: boolean
2222

23+
# The timeout, in minutes, for this job.
24+
- name: timeout
25+
type: string
26+
default: 90
27+
2328
jobs:
2429
- job: run_tests_package_reference
2530
displayName: 'Run tests with package reference'
2631
${{ if ne(parameters.dependsOn, 'empty')}}:
2732
dependsOn: '${{parameters.dependsOn }}'
33+
34+
# Some of our tests take longer than the default 60 minutes to run on some
35+
# OSes and configurations.
36+
timeoutInMinutes: ${{ parameters.timeout }}
37+
2838
pool:
2939
type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
3040
isCustom: true

eng/pipelines/common/templates/stages/ci-run-tests-stage.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ parameters:
3030
type: jobList
3131
default: []
3232

33+
# The timeout, in minutes, for each test job.
34+
- name: testsTimeout
35+
type: string
36+
default: 90
37+
3338
stages:
3439
- ${{ each config in parameters.testConfigurations }}:
3540
- ${{ each image in config.value.images }}:
@@ -47,6 +52,7 @@ stages:
4752
parameters:
4853
debug: ${{ parameters.debug }}
4954
buildType: ${{ parameters.buildType }}
55+
timeout: ${{ parameters.testsTimeout }}
5056
poolName: ${{ config.value.pool }}
5157
hostedPool: ${{ eq(config.value.hostedPool, true) }}
5258
image: ${{ image.value }}
@@ -72,6 +78,7 @@ stages:
7278
parameters:
7379
debug: ${{ parameters.debug }}
7480
buildType: ${{ parameters.buildType }}
81+
timeout: ${{ parameters.testsTimeout }}
7582
poolName: ${{ config.value.pool }}
7683
hostedPool: ${{ eq(config.value.hostedPool, true) }}
7784
image: ${{ image.value }}

eng/pipelines/dotnet-sqlclient-ci-core.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ parameters:
5757
type: string
5858
default: $(ci_var_defaultPoolName)
5959

60+
# The timeout, in minutes, for each test job.
61+
- name: testsTimeout
62+
type: string
63+
default: 90
64+
6065
variables:
6166
- template: libraries/ci-build-variables.yml@self
6267

@@ -78,6 +83,7 @@ stages:
7883
parameters:
7984
debug: ${{ parameters.debug }}
8085
buildType: ${{ parameters.buildType }}
86+
testsTimeout: ${{ parameters.testsTimeout }}
8187
${{ if eq(parameters.buildType, 'Package') }}:
8288
dependsOn: build_nugets
8389

eng/pipelines/dotnet-sqlclient-ci-package-reference-pipeline.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ parameters: # parameters are shown up in ADO UI in a build queue time
8181
- Project
8282
- Package
8383

84+
# The timeout, in minutes, for each test job.
85+
- name: testsTimeout
86+
displayName: 'Tests timeout (in minutes)'
87+
type: string
88+
default: 90
89+
8490
extends:
8591
template: dotnet-sqlclient-ci-core.yml@self
8692
parameters:
@@ -92,3 +98,4 @@ extends:
9298
useManagedSNI: ${{ parameters.useManagedSNI }}
9399
codeCovTargetFrameworks: ${{ parameters.codeCovTargetFrameworks }}
94100
buildType: ${{ parameters.buildType }}
101+
testsTimeout: ${{ parameters.testsTimeout }}

eng/pipelines/dotnet-sqlclient-ci-project-reference-pipeline.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ parameters: # parameters are shown up in ADO UI in a build queue time
7373
- Project
7474
- Package
7575

76+
# The timeout, in minutes, for each test job.
77+
- name: testsTimeout
78+
displayName: 'Tests timeout (in minutes)'
79+
type: string
80+
default: 90
81+
7682
extends:
7783
template: dotnet-sqlclient-ci-core.yml@self
7884
parameters:
@@ -84,3 +90,4 @@ extends:
8490
useManagedSNI: ${{ parameters.useManagedSNI }}
8591
codeCovTargetFrameworks: ${{ parameters.codeCovTargetFrameworks }}
8692
buildType: ${{ parameters.buildType }}
93+
testsTimeout: ${{ parameters.testsTimeout }}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ parameters: # parameters are shown up in ADO UI in a build queue time
6767
type: boolean
6868
default: false
6969

70+
# The timeout, in minutes, for each test job.
71+
- name: testsTimeout
72+
displayName: 'Tests timeout (in minutes)'
73+
type: string
74+
default: 90
75+
7076
variables:
7177
- template: /eng/pipelines/libraries/variables.yml@self
7278
- name: packageFolderName
@@ -175,6 +181,7 @@ extends:
175181
parameters:
176182
packageFolderName: $(packageFolderName)
177183
isPreview: ${{ parameters['isPreview'] }}
184+
timeout: ${{ parameters.testsTimeout }}
178185
downloadPackageStep:
179186
download: current
180187
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
@@ -575,7 +575,7 @@ public static string GetUniqueName(string prefix, bool withBracket = true)
575575
/// </summary>
576576
/// <param name="prefix">Add the prefix to the generate string.</param>
577577
/// <param name="withBracket">Database name must be pass with brackets by default.</param>
578-
/// <returns>Unique name by considering the Sql Server naming rules.</returns>
578+
/// <returns>Unique name by considering the Sql Server naming rules, never longer than 96 characters.</returns>
579579
public static string GetUniqueNameForSqlServer(string prefix, bool withBracket = true)
580580
{
581581
string extendedPrefix = string.Format(
@@ -585,10 +585,21 @@ public static string GetUniqueNameForSqlServer(string prefix, bool withBracket =
585585
Environment.MachineName,
586586
DateTime.Now.ToString("yyyy_MM_dd", CultureInfo.InvariantCulture));
587587
string name = GetUniqueName(extendedPrefix, withBracket);
588-
if (name.Length > 128)
588+
589+
// Truncate to no more than 96 characters.
590+
const int maxLen = 96;
591+
if (name.Length > maxLen)
589592
{
590-
throw new ArgumentOutOfRangeException("the name is too long - SQL Server names are limited to 128");
593+
if (withBracket)
594+
{
595+
name = name.Substring(0, maxLen - 1) + ']';
596+
}
597+
else
598+
{
599+
name = name.Substring(0, maxLen);
600+
}
591601
}
602+
592603
return name;
593604
}
594605

0 commit comments

Comments
 (0)