@@ -18,7 +18,8 @@ namespace Microsoft.Azure.WebJobs.Script.Tests.Configuration
18
18
{
19
19
public class HostJsonFileConfigurationSourceTests
20
20
{
21
- private readonly string _defaultHostJson = "{\r \n \" version\" : \" 2.0\" ,\r \n \" extensionBundle\" : {\r \n \" id\" : \" Microsoft.Azure.Functions.ExtensionBundle\" ,\r \n \" version\" : \" [1.*, 2.0.0)\" \r \n }\r \n }" ;
21
+ private readonly string _hostJsonWithBundles = "{\r \n \" version\" : \" 2.0\" ,\r \n \" extensionBundle\" : {\r \n \" id\" : \" Microsoft.Azure.Functions.ExtensionBundle\" ,\r \n \" version\" : \" [1.*, 2.0.0)\" \r \n }\r \n }" ;
22
+ private readonly string _defaultHostJson = "{\r \n \" version\" : \" 2.0\" \r \n }" ;
22
23
private readonly ScriptApplicationHostOptions _options ;
23
24
private readonly string _hostJsonFile ;
24
25
private readonly TestLoggerProvider _loggerProvider = new TestLoggerProvider ( ) ;
@@ -55,7 +56,7 @@ public void MissingHostJson_CreatesDefaultFile()
55
56
56
57
AreExpectedMetricsGenerated ( testMetricsLogger ) ;
57
58
58
- Assert . Equal ( _defaultHostJson , File . ReadAllText ( _hostJsonFile ) ) ;
59
+ Assert . Equal ( _hostJsonWithBundles , File . ReadAllText ( _hostJsonFile ) ) ;
59
60
60
61
var log = _loggerProvider . GetAllLogMessages ( ) . Single ( l => l . FormattedMessage == "No host configuration file found. Creating a default host.json file." ) ;
61
62
Assert . Equal ( LogLevel . Information , log . Level ) ;
@@ -108,7 +109,10 @@ public void ReadOnlyFileSystem_SkipsDefaultHostJsonCreation()
108
109
TestMetricsLogger testMetricsLogger = new TestMetricsLogger ( ) ;
109
110
IConfiguration config = BuildHostJsonConfiguration ( testMetricsLogger , environment ) ;
110
111
AreExpectedMetricsGenerated ( testMetricsLogger ) ;
112
+ var configList = config . AsEnumerable ( ) . ToList ( ) ;
111
113
Assert . Equal ( config [ "AzureFunctionsJobHost:version" ] , "2.0" ) ;
114
+ Assert . Equal ( configList . Count , 2 ) ;
115
+ Assert . True ( configList . TrueForAll ( ( k ) => ! k . Key . Contains ( "extensionBundle" ) ) ) ;
112
116
113
117
var log = _loggerProvider . GetAllLogMessages ( ) . Single ( l => l . FormattedMessage == "No host configuration file found. Creating a default host.json file." ) ;
114
118
Assert . Equal ( LogLevel . Information , log . Level ) ;
0 commit comments