Skip to content

Commit ec0bad2

Browse files
committed
Extra test for connection string setting on webapp
1 parent c63828d commit ec0bad2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Farmer/Builders/Builders.WebApp.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,9 +1299,9 @@ module Extensions =
12991299
}
13001300
|> this.Wrap state
13011301

1302-
// Turns on "modern App Insights" with automatic Log Analytics. If you have configured the AI instance, those settings will be preserved.
1302+
// Turns on "modern App Insights" with automatic Log Analytics. If you have already set the name of the AI instance before calling this, it will be overwritten with a default name.
13031303
[<CustomOperation "use_workspace_based_app_insights">]
1304-
member this.ModernAi(state: 'T) =
1304+
member this.WorkspaceBasedAi(state: 'T) =
13051305
let commonState = this.Get state
13061306

13071307
{
@@ -1341,7 +1341,7 @@ module Extensions =
13411341

13421342
member this.LinkToAi(state: 'T, config: AppInsightsConfig) = this.LinkToAi(state, config.Name)
13431343

1344-
/// Instead of creating a new AI instance, configure this webapp to point to an unmanaged AI instance (can be classic or modern AI)
1344+
/// Instead of creating a new AI instance, configure this webapp to point to an unmanaged AI instance (can be classic or workspace-based AI)
13451345
/// A dependency will not be set for this instance.
13461346
[<CustomOperation "link_to_unmanaged_app_insights">]
13471347
member this.LinkUnmanagedAppInsights(state: 'T, resourceId) =

src/Tests/WebApp.fs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ let tests =
5757
ai.Dependencies |> expectContains workspaces "test-logstore" "log analytics"
5858

5959
Expect.hasLength (resources |> getResource<LogAnalytics.Workspace>) 1 "Should be one log workspace"
60+
61+
Expect.contains
62+
(wa.AppSettings
63+
|> Option.defaultValue Map.empty
64+
|> Seq.toArray
65+
|> Array.map (fun x -> x.Key, x.Value.Value))
66+
("APPLICATIONINSIGHTS_CONNECTION_STRING",
67+
"[reference(resourceId('Microsoft.Insights/components', 'test-ai'), '2020-02-02').ConnectionString]")
68+
"Missing AI connection string"
6069
}
6170

6271
test "Using Workspace based AI uses a manually chosen name if set after turning on workspace-based AI" {

0 commit comments

Comments
 (0)