Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Examples/ExampleApps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,13 @@ public static ExampleAppOptions BuildOptions(
StartupTimeoutSeconds: 180,
BuildEnv: o => new Dictionary<string, string>
{
// The example reads the _51DEGREES_ names. Released
// versions of it read the two older names, so both
// are set until every language has released.
["_51DEGREES_RESOURCE_KEY"] = o.ResourceKey,
["SUPER_RESOURCE_KEY"] = o.ResourceKey,
// the endpoint must include the api/v4 path
["_51DEGREES_CLOUD_ENDPOINT"] = new Uri(o.CloudEndpoint, "api/v4/").ToString(),
["FIFTYONE_CLOUD_ENDPOINT"] = new Uri(o.CloudEndpoint, "api/v4/").ToString(),
["ASPNETCORE_URLS"] = $"http://localhost:{o.Port}",
// run on a newer .NET runtime if the exact one isn't installed
Expand Down
20 changes: 20 additions & 0 deletions Examples/ExampleAppsTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

Expand Down Expand Up @@ -74,5 +76,23 @@ public void Descriptors_Rust_BuildsAndRunsWithCargo()
Assert.IsTrue(rust.Args.Contains("dd-web-getting-started-cloud"),
"run args should target the cloud getting-started web binary");
}

[TestMethod]
public void Descriptors_Dotnet_SetsTheUnderscoreNames()
{
var dotnet = ExampleApps.Descriptors["dotnet"];
var env = dotnet.BuildEnv(new ExampleAppOptions(
Port: 5123,
CloudEndpoint: new Uri("https://cloud.example.test/"),
ResourceKey: "key",
ExtraEnv: new Dictionary<string, string>()));
Assert.AreEqual("key", env["_51DEGREES_RESOURCE_KEY"],
"the example reads the resource key from this name");
Assert.AreEqual(
"https://cloud.example.test/api/v4/",
env["_51DEGREES_CLOUD_ENDPOINT"],
"the example reads the endpoint, with its api/v4 path, "
+ "from this name");
}
}
}
Loading