Skip to content

Commit 66172f1

Browse files
Adds SourceLink dependency to Product module (#1657)
## Why make this change? - Closes #1655 - The `SourceLink` NuGet health property is not `valid` due to the absence of SourceLink dependency ## What is this change? - `SourceLink` dependency is added to the `Product` module - `SourceLink` embeds the git commit ID to assembly metadata. So, the application name will be of the form `dab_oss_1.0.0+<commit_id>`. So, test assertion logic is updated. - This PR is a subsequent change for [PR #1656 ](#1656). It describes why the changes for fixing the NuGet health are broken down into two separate PRs. ## How was this tested? - [x] Manual Tests. Health of the NuGet after applying the changes from this PR and [PR #1656 ](#1656) was validated. ![image](https://github.com/Azure/data-api-builder/assets/11196553/859b507a-32d1-4990-967e-9d25884b1ea6) Co-authored-by: Aniruddh Munde <[email protected]>
1 parent 31a0e7d commit 66172f1

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Product/Azure.DataApiBuilder.Product.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@
1212
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
1313
</PropertyGroup>
1414

15+
<ItemGroup>
16+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
17+
</ItemGroup>
18+
1519
</Project>

src/Service.Tests/Configuration/ConfigurationTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,12 @@ public void TestConnectionStringIsCorrectlyUpdatedWithApplicationName(
504504
replaceEnvVar: true));
505505

506506
string actualUpdatedConnectionString = updatedRuntimeConfig.DataSource.ConnectionString;
507-
Assert.AreEqual(expectedUpdatedConnectionString, actualUpdatedConnectionString);
507+
508+
// SourceLink appends the commit ID to the assembly metadata. The application name is extracted from the
509+
// assembly metadata. So, the connection string after appending the application name will be of the form
510+
// dab_oss_1.0.0+<commit-id> or dab_hosted_1.0.0+<commit-id> depending on oss or hosted scenario respectively.
511+
// So, the updated connection string is validated to check if it starts with dab_oss_1.0.0 or dab_hosted_1.0.0.
512+
Assert.IsTrue(actualUpdatedConnectionString.StartsWith(expectedUpdatedConnectionString));
508513
}
509514

510515
[TestMethod("Validates that once the configuration is set, the config controller isn't reachable."), TestCategory(TestCategory.COSMOSDBNOSQL)]

0 commit comments

Comments
 (0)