Skip to content

Commit

Permalink
Make OptimizeForPerformance Configurable. (Azure#282)
Browse files Browse the repository at this point in the history
* Make OptimizeForPerformance Configurable.

* Fixed typo.
  • Loading branch information
aribeironovaes authored Sep 14, 2018
1 parent 94621d5 commit 5155346
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 26 deletions.
45 changes: 25 additions & 20 deletions smoke/IotEdgeQuickstart/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,26 @@ All options to this command have defaults. If an option is not specified and
its corresponding environment variable is not defined, then the default will
be used.
Option Default value
--bootstrapper 'iotedged'
--bootstrapper-archive no path (archive is installed from apt or pypi)
--connection-string get the value from Key Vault
--device-id an auto-generated unique identifier
--edge-hostname 'quickstart'
--eventhub-endpoint get the value from Key Vault
--leave-running none (or 'all' if given as a switch)
--password anonymous, or Key Vault if --registry is specified
--registry mcr.microsoft.com (anonymous)
--tag '1.0'
--use-http if --bootstrapper=iotedged then use Unix Domain
Sockets, otherwise N/A
switch form uses local IP address as hostname
--username anonymous, or Key Vault if --registry is specified
--no-deployment deploy Edge Hub and temperature sensor modules
--no-verify false
--verify-data-from-module tempSensor
--deployment deployment json file
Option Default value
--bootstrapper 'iotedged'
--bootstrapper-archive no path (archive is installed from apt or pypi)
--connection-string get the value from Key Vault
--device-id an auto-generated unique identifier
--edge-hostname 'quickstart'
--eventhub-endpoint get the value from Key Vault
--leave-running none (or 'all' if given as a switch)
--password anonymous, or Key Vault if --registry is specified
--registry mcr.microsoft.com (anonymous)
--tag '1.0'
--use-http if --bootstrapper=iotedged then use Unix Domain
Sockets, otherwise N/A
switch form uses local IP address as hostname
--username anonymous, or Key Vault if --registry is specified
--no-deployment deploy Edge Hub and temperature sensor modules
--no-verify false
--optimize_for_performance true
--verify-data-from-module tempSensor
--deployment deployment json file
"
)]
[HelpOption]
Expand Down Expand Up @@ -102,6 +103,9 @@ class Program
[Option("--no-verify", CommandOptionType.NoValue, Description = "Don't verify the behavior of the deployment (e.g.: temp sensor)")]
public bool NoVerify { get; } = false;

[Option("--optimize_for_performance <true/false>", CommandOptionType.SingleValue, Description = "Add OptimizeForPerformance Flag on edgeHub. Only when no deployment is passed.")]
public bool OptimizeForPerformance { get; } = true;

[Option("--verify-data-from-module", Description = "Verify if a given module sent data do IoTHub.")]
public string VerifyDataFromModule { get; } = "tempSensor";

Expand Down Expand Up @@ -186,7 +190,8 @@ async Task<int> OnExecuteAsync()
deployment,
this.DeviceCaCert,
this.DeviceCaPk,
this.DeviceCaCerts);
this.DeviceCaCerts,
this.OptimizeForPerformance);
await test.RunAsync();
}
catch (Exception ex)
Expand Down
5 changes: 3 additions & 2 deletions smoke/IotEdgeQuickstart/Quickstart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public Quickstart(
Option<string> deploymentFileName,
string deviceCaCert,
string deviceCaPk,
string deviceCaCerts) :
base(bootstrapper, credentials, iothubConnectionString, eventhubCompatibleEndpointWithEntityPath, imageTag, deviceId, hostname, deploymentFileName, deviceCaCert, deviceCaPk, deviceCaCerts)
string deviceCaCerts,
bool optimizedForPerformance) :
base(bootstrapper, credentials, iothubConnectionString, eventhubCompatibleEndpointWithEntityPath, imageTag, deviceId, hostname, deploymentFileName, deviceCaCert, deviceCaPk, deviceCaCerts, optimizedForPerformance)
{
this.leaveRunning = leaveRunning;
this.noDeployment = noDeployment;
Expand Down
8 changes: 6 additions & 2 deletions smoke/IotEdgeQuickstart/details/Details.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Details
readonly string deviceCaCert;
readonly string deviceCaPk;
readonly string deviceCaCerts;
readonly bool optimizedForPerformance;

DeviceContext context;

Expand All @@ -43,7 +44,8 @@ protected Details(
Option<string> deploymentFileName,
string deviceCaCert,
string deviceCaPk,
string deviceCaCerts
string deviceCaCerts,
bool optimizedForPerformance
)
{
this.bootstrapper = bootstrapper;
Expand All @@ -57,6 +59,7 @@ string deviceCaCerts
this.deviceCaCert = deviceCaCert;
this.deviceCaPk = deviceCaPk;
this.deviceCaCerts = deviceCaCerts;
this.optimizedForPerformance = optimizedForPerformance;
}

protected Task VerifyEdgeIsNotAlreadyActive() => this.bootstrapper.VerifyNotActive();
Expand Down Expand Up @@ -328,6 +331,7 @@ string BuildImageName(string name)
json = Regex.Replace(json, "<image-edge-hub>", edgeHubImage);
json = Regex.Replace(json, "<image-temp-sensor>", tempSensorImage);
json = Regex.Replace(json, "<registry-info>", deployJsonRegistry);
json = Regex.Replace(json, "<optimized-for-performance>", this.optimizedForPerformance.ToString());
return json;
});

Expand Down Expand Up @@ -368,7 +372,7 @@ string BuildImageName(string name)
},
""env"": {
""OptimizeForPerformance"": {
""value"": ""false""
""value"": ""<optimized-for-performance>""
}
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"env": {
"OptimizeForPerformance": {
"value": "false"
"value": "<OptimizeForPerformance>"
}
},
"status": "running",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"env": {
"OptimizeForPerformance": {
"value": "false"
"value": "<OptimizeForPerformance>"
}
},
"status": "running",
Expand Down

0 comments on commit 5155346

Please sign in to comment.