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
Copy file name to clipboardExpand all lines: src/Service.Tests/UnitTests/RuntimeConfigLoaderJsonDeserializerTests.cs
+7-19Lines changed: 7 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@
6
6
usingSystem.Data;
7
7
usingSystem.IO;
8
8
usingSystem.IO.Abstractions.TestingHelpers;
9
+
usingSystem.Linq;
9
10
usingSystem.Text;
10
11
usingSystem.Text.Json;
11
12
usingAzure.DataApiBuilder.Config;
@@ -485,10 +486,10 @@ public void TestLoadRuntimeConfigFailures(
485
486
}
486
487
487
488
/// <summary>
488
-
/// Method to validate that config loading fails when a sub-data source file is not found.
489
-
/// Previously this test asserted that the missing child was silently skipped;
490
-
/// after the fix for https://github.com/Azure/data-api-builder/issues/3271,
491
-
/// a missing child config now correctly causes the parent config to fail loading.
489
+
/// Method to validate that when a sub-data source file is not found, it is gracefully
490
+
/// skipped and the parent config loads successfully. Non-existent child files are
491
+
/// tolerated to support late-configured scenarios where data-source-files may reference
492
+
/// files not present on the host.
492
493
/// </summary>
493
494
[TestMethod]
494
495
publicvoidTestLoadRuntimeConfigSubFilesFails()
@@ -508,21 +509,8 @@ public void TestLoadRuntimeConfigSubFilesFails()
508
509
""data-source-files"":[""FileNotFound.json""],
509
510
""entities"":{ }
510
511
}";
511
-
512
-
TextWriteroriginalError=Console.Error;
513
-
StringWritersw=new();
514
-
Console.SetError(sw);
515
-
516
-
try
517
-
{
518
-
Assert.IsFalse(RuntimeConfigLoader.TryParseConfig(actualJson,outRuntimeConfig_),"Config loading should fail when a child config file cannot be found.");
519
-
stringerror=sw.ToString();
520
-
Assert.IsTrue(error.Contains("Failed to load datasource file"),"Error message should indicate the child config file that failed.");
521
-
}
522
-
finally
523
-
{
524
-
Console.SetError(originalError);
525
-
}
512
+
Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(actualJson,outRuntimeConfigruntimeConfig),"Should parse the data-source-files correctly.");
0 commit comments