You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add application name for PGSQL connections (#2208)
## Why make this change?
Closes#1635
## What is this change?
Checking if Application Name is already present in the PgSql connection
string. I f yes, we append DAB APP NAME with ',' as separator else, we
add an Application Name property to connection string.
## How was this tested?
- [ ] Unit Tests
## Sample Request(s)
If Application Name is specified by the developer, then DAB will append
to it, else will add Application Name property
---------
Co-authored-by: Aniruddh Munde <[email protected]>
Copy file name to clipboardExpand all lines: src/Cli.Tests/EndToEndTests.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -178,7 +178,7 @@ public void TestInitializingRestAndGraphQLGlobalSettings()
178
178
[DataRow(CliBool.None,"cosmosdb_nosql",DatabaseType.CosmosDB_NoSQL,DisplayName="Init command without '--graphql.multiple-create.enabled' option for cosmosdb_nosql database type")]
Copy file name to clipboardExpand all lines: src/Service.Tests/Configuration/ConfigurationTests.cs
+54-5Lines changed: 54 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -652,11 +652,64 @@ public void MsSqlConnStringSupplementedWithAppNameProperty(
652
652
message:"DAB did not properly set the 'Application Name' connection string property.");
653
653
}
654
654
655
+
/// <summary>
656
+
/// Validates that DAB supplements the PgSQL database connection strings with the property "ApplicationName" and
657
+
/// 1. Adds the property/value "Application Name=dab_oss_Major.Minor.Patch" when the env var DAB_APP_NAME_ENV is not set.
658
+
/// 2. Adds the property/value "Application Name=dab_hosted_Major.Minor.Patch" when the env var DAB_APP_NAME_ENV is set to "dab_hosted".
659
+
/// (DAB_APP_NAME_ENV is set in hosted scenario or when user sets the value.)
660
+
/// NOTE: "#pragma warning disable format" is used here to avoid removing intentional, readability promoting spacing in DataRow display names.
661
+
/// </summary>
662
+
/// <param name="configProvidedConnString">connection string provided in the config.</param>
663
+
/// <param name="expectedDabModifiedConnString">Updated connection string with Application Name.</param>
664
+
/// <param name="dabEnvOverride">Whether DAB_APP_NAME_ENV is set in environment. (Always present in hosted scenario or if user supplies value.)</param>
665
+
[DataTestMethod]
666
+
[DataRow("Host=foo;Username=testuser;","Host=foo;Username=testuser;Application Name=",false,DisplayName="[PGSQL]:DAB adds version 'dab_oss_major_minor_patch' to non-provided connection string property 'ApplicationName']")]
667
+
[DataRow("Host=foo;Username=testuser;","Host=foo;Username=testuser;Application Name=",true,DisplayName="[PGSQL]:DAB adds DAB_APP_NAME_ENV value 'dab_hosted' and version suffix '_major_minor_patch' to non-provided connection string property 'ApplicationName'.]")]
668
+
[DataRow("Host=foo;Username=testuser;Application Name=UserAppName","Host=foo;Username=testuser;Application Name=UserAppName,",false,DisplayName="[PGSQL]:DAB appends version 'dab_oss_major_minor_patch' to user supplied 'Application Name' property.]")]
669
+
[DataRow("Host=foo;Username=testuser;Application Name=UserAppName","Host=foo;Username=testuser;Application Name=UserAppName,",true,DisplayName="[PGSQL]:DAB appends version string 'dab_hosted' and version suffix '_major_minor_patch' to user supplied 'ApplicationName' property.]")]
/// This test validates that this behavior holds true when the DAB_APP_NAME_ENV environment variable
661
714
/// - is set (dabEnvOverride==true) -> (DAB hosted)
662
715
/// - is not set (dabEnvOverride==false) -> (DAB OSS).
@@ -673,10 +726,6 @@ public void MsSqlConnStringSupplementedWithAppNameProperty(
673
726
[DataRow(DatabaseType.MySQL,"Something;","Something;",true,DisplayName="[MYSQL|DAB hosted]:No addition of 'Application Name' or 'App' property to connection string.")]
[DataRow(DatabaseType.MySQL,"Something1;App=CustAppName;Something2;","Something1;App=CustAppName;Something2;",true,DisplayName="[MySQL|DAB hosted]:No modification of customer overridden 'App' property.")]
676
-
[DataRow(DatabaseType.PostgreSQL,"Something;","Something;",false,DisplayName="[PGSQL|DAB OSS]:No addition of 'Application Name' property to connection string.]")]
[DataRow(DatabaseType.PostgreSQL,"Something;","Something;",true,DisplayName="[PGSQL|DAB hosted]:No addition of 'Application Name' property to connection string.")]
[DataRow(DatabaseType.CosmosDB_NoSQL,"Something;","Something;",false,DisplayName="[COSMOSDB_NOSQL|DAB OSS]:No addition of 'Application Name' property to connection string.")]
[DataRow(DatabaseType.CosmosDB_NoSQL,"Something;","Something;",true,DisplayName="[COSMOSDB_NOSQL|DAB hosted]:No addition of 'Application Name' property to connection string.")]
0 commit comments