Skip to content

Commit

Permalink
Update end-to-end build YAML for new tests (Azure#1727)
Browse files Browse the repository at this point in the history
Two new end-to-end tests have been added recently, but they both fail in automated builds because they rely on new context.json parameters and secrets that haven't been added to the YAML build. This change fixes that.

Note this change also makes the context.json parameter "caCertScriptPath" optional because it's only required for the TransparentGateway tests.
  • Loading branch information
damonbarry authored Sep 19, 2019
1 parent 989003a commit db0afce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions builds/e2e/templates/e2e-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ steps:
}
displayName: Run tests
env:
E2E_DPS_GROUP_KEY: $(TestDpsGroupKeySymmetric)
E2E_EVENT_HUB_ENDPOINT: $(TestEventHubCompatibleEndpoint)
E2E_IOT_HUB_CONNECTION_STRING: $(TestIotHubConnectionString)
E2E_REGISTRIES__0__PASSWORD: $(TestContainerRegistryPassword)
Expand Down
3 changes: 3 additions & 0 deletions builds/e2e/templates/e2e-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ steps:
keyVaultName: $(kv.name)
secretsFilter: >-
TestContainerRegistryPassword,
TestDpsGroupKeySymmetric,
TestEventHubCompatibleEndpoint,
TestIotedgedPackageRootSigningCert,
TestIotHubConnectionString,
Expand Down Expand Up @@ -107,8 +108,10 @@ steps:
$imageId = ($imageId -split '=')[1]
$imageTag = "$imageId-$(os)-$(arch)"
$context = @{
dpsIdScope = '$(dps.idScope)'
edgeAgentImage = "$imagePrefix-agent:$imageTag";
edgeHubImage = "$imagePrefix-hub:$imageTag";
tempFilterImage = "$imagePrefix-temperature-filter:$imageTag";
tempSensorImage = "$imagePrefix-simulated-temperature-sensor:$imageTag";
methodSenderImage = "$imagePrefix-direct-method-sender:$imageTag";
methodReceiverImage = "$imagePrefix-direct-method-receiver:$imageTag";
Expand Down
4 changes: 2 additions & 2 deletions test/Microsoft.Azure.Devices.Edge.Test/helpers/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Context()
string defaultId =
$"e2e-{string.Concat(Dns.GetHostName().Take(14)).TrimEnd(new[] { '-' })}-{DateTime.Now:yyMMdd'-'HHmmss'.'fff}";

this.CaCertScriptPath = Get("caCertScriptPath");
this.CaCertScriptPath = Option.Maybe(Get("caCertScriptPath"));
this.ConnectionString = Get("IOT_HUB_CONNECTION_STRING");
this.DeviceId = IdentityLimits.CheckEdgeId(GetOrDefault("deviceId", defaultId));
this.DpsIdScope = Option.Maybe(Get("dpsIdScope"));
Expand Down Expand Up @@ -107,7 +107,7 @@ public Context()

public static Context Current => Default.Value;

public string CaCertScriptPath { get; }
public Option<string> CaCertScriptPath { get; }

public string ConnectionString { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ await Profiler.Run(
{
(string, string, string) rootCa =
Context.Current.RootCaKeys.Expect(() => new InvalidOperationException("Missing root CA keys"));
string caCertScriptPath =
Context.Current.CaCertScriptPath.Expect(() => new InvalidOperationException("Missing CA cert script path"));

using (var cts = new CancellationTokenSource(Context.Current.SetupTimeout))
{
Expand All @@ -31,7 +33,7 @@ await Profiler.Run(
this.ca = await CertificateAuthority.CreateAsync(
Context.Current.DeviceId,
rootCa,
Context.Current.CaCertScriptPath,
caCertScriptPath,
token);

await this.daemon.ConfigureAsync(
Expand Down
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The end-to-end tests take several parameters, which they expect to find in a fil

| Name | Required | Description |
|------|----------|-------------|
| `caCertScriptPath` | | Path to the folder containing `certGen.sh` (Linux) or `ca-certs.ps1` (Windows). |
| `caCertScriptPath` | * | Path to the folder containing `certGen.sh` (Linux) or `ca-certs.ps1` (Windows). Required when running the test 'TransparentGateway', ignored otherwise. |
| `deviceId` || Name by which the edge device-under-test will be registered in IoT Hub. If not given, a name will automatically be generated in the format: `e2e-{device hostname}-{yyMMdd-HHmmss.fff}`. DPS tests will derive their "registration ID" from `deviceId` by appending the normalized test name (lowercased, with sequences of non-word characters replaced by a single dash). |
| `dpsIdScope` | * | The [ID Scope](https://docs.microsoft.com/en-us/azure/iot-dps/concepts-device#id-scope) assigned to a Device Provisioning Service. Required when running any DPS tests, ignored otherwise. |
| `edgeAgentImage` || Docker image to pull/use for Edge Agent. If not given, the default value `mcr.microsoft.com/azureiotedge-agent:1.0` is used. Note also that the default value is ALWAYS used in config.yaml to start IoT Edge; this setting only applies to any configurations deployed by the tests. |
Expand Down

0 comments on commit db0afce

Please sign in to comment.