Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tempfilter with multi stage deployments #2248

Merged

Conversation

and-rewsmith
Copy link
Contributor

@and-rewsmith and-rewsmith commented Jan 6, 2020

TempFilter tests sometimes fail due to the modules starting before the necessary edgeHub routes are in place. I made a fix for this where the new e2e framework deploys in configurations. First it deploys edgeAgent / edgeHub, then the rest of the modules.

@@ -48,13 +48,18 @@ public async Task<EdgeDeployment> DeployConfigurationAsync(Action<EdgeConfigBuil
addConfig(builder);

DateTime deployTime = DateTime.Now;
EdgeConfiguration config = builder.Build();
IEnumerable<EdgeConfiguration> configs = builder.BuildConfigurationStages();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know what you think of this name change

@@ -72,21 +75,25 @@ public EdgeConfiguration Build()
var moduleNames = new List<string>();
var moduleImages = new List<string>();

foreach (ModuleConfiguration module in modules)
string edgeHubModuleId = "$edgeHub";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uses Constants.EdgeHubModuleIdentityName in EdgeAgent.Core project

@and-rewsmith and-rewsmith merged commit 7290eeb into Azure:master Jan 7, 2020
@and-rewsmith and-rewsmith changed the title Fix tempfilter with IEnumerable Fix tempfilter with multi stage deployments Jan 7, 2020
kodiakhq bot pushed a commit that referenced this pull request Feb 22, 2020
The end-to-end tests were recently updated (see #2248 and #2442) to do deployments in two stages: the first just adds the system modules (including any edge hub routes the test will need), and the second adds the remaining modules. This was done to give edge hub a chance to get routes set up before test devices/modules begin using them.

Following the changes, output showed that the staged deployments were happening as intended, but they weren't. A deployment config really breaks down into two major parts: edge agent's desired properties (which describe all the modules in the deployment), and all the other modules' desired properties (e.g. edge hub routes, test module config, etc.). The first deployment contained the first part and the second deployment contained the first and second parts, which means that all modules were being sent down to the device in the first deployment.

This change fixes the problem by calling the internal function `EdgeConfigBuilder.BuildEdgeAgent` twice--once for each deployment. Each call receives only the modules that are expected to start with that deployment (just system modules first, all modules second).

I also added constants for `$edgeAgent` and `$edgeHub`.
kodiakhq bot pushed a commit that referenced this pull request Jul 27, 2020
Given recent improvements to the end-to-end test framework (#2635, #2753), the logic that splits deployments into multiple stages (#2248) is no longer needed. This change removes that logic.

In verifying the changes, I also ran into occasional failures in the `ValidateMetrics` test because the stringized JSON labels that were recently added to Edge Agent containers failed to compare. The expected and actual twin reported properties always had the same JSON properties, but sometimes in different orders:

```
systemModules.edgeAgent.settings.createOptions: {"Labels":{"net.azure-devices.edge.create-options":"{}","net.azure-devices.edge.env":"{\"RuntimeLogLevel\":{\"value\":\"debug\"},\"PerformanceMetricsUpdateFrequency\":{\"value\":\"00:00:20\"}}","net.azure-devices.edge.owner":"Microsoft.Azure.Devices.Edge.Agent"}
systemModules.edgeAgent.settings.createOptions: {"Labels":{"net.azure-devices.edge.create-options":"{}","net.azure-devices.edge.env":"{\"PerformanceMetricsUpdateFrequency\":{\"value\":\"00:00:20\"},\"RuntimeLogLevel\":{\"value\":\"debug\"}}","net.azure-devices.edge.owner":"Microsoft.Azure.Devices.Edge.Agent"}
```

The logic that compares these properties is trying to confirm that the configuration has been deployed, and the agent's labels aren't related to the deployment so I just removed them from the comparison.
damonbarry added a commit to damonbarry/iotedge that referenced this pull request Aug 5, 2020
Given recent improvements to the end-to-end test framework (Azure#2635, Azure#2753), the logic that splits deployments into multiple stages (Azure#2248) is no longer needed. This change removes that logic.

In verifying the changes, I also ran into occasional failures in the `ValidateMetrics` test because the stringized JSON labels that were recently added to Edge Agent containers failed to compare. The expected and actual twin reported properties always had the same JSON properties, but sometimes in different orders:

```
systemModules.edgeAgent.settings.createOptions: {"Labels":{"net.azure-devices.edge.create-options":"{}","net.azure-devices.edge.env":"{\"RuntimeLogLevel\":{\"value\":\"debug\"},\"PerformanceMetricsUpdateFrequency\":{\"value\":\"00:00:20\"}}","net.azure-devices.edge.owner":"Microsoft.Azure.Devices.Edge.Agent"}
systemModules.edgeAgent.settings.createOptions: {"Labels":{"net.azure-devices.edge.create-options":"{}","net.azure-devices.edge.env":"{\"PerformanceMetricsUpdateFrequency\":{\"value\":\"00:00:20\"},\"RuntimeLogLevel\":{\"value\":\"debug\"}}","net.azure-devices.edge.owner":"Microsoft.Azure.Devices.Edge.Agent"}
```

The logic that compares these properties is trying to confirm that the configuration has been deployed, and the agent's labels aren't related to the deployment so I just removed them from the comparison.
ggjjj pushed a commit to ggjjj/iotedge that referenced this pull request Aug 20, 2020
Given recent improvements to the end-to-end test framework (Azure#2635, Azure#2753), the logic that splits deployments into multiple stages (Azure#2248) is no longer needed. This change removes that logic.

In verifying the changes, I also ran into occasional failures in the `ValidateMetrics` test because the stringized JSON labels that were recently added to Edge Agent containers failed to compare. The expected and actual twin reported properties always had the same JSON properties, but sometimes in different orders:

```
systemModules.edgeAgent.settings.createOptions: {"Labels":{"net.azure-devices.edge.create-options":"{}","net.azure-devices.edge.env":"{\"RuntimeLogLevel\":{\"value\":\"debug\"},\"PerformanceMetricsUpdateFrequency\":{\"value\":\"00:00:20\"}}","net.azure-devices.edge.owner":"Microsoft.Azure.Devices.Edge.Agent"}
systemModules.edgeAgent.settings.createOptions: {"Labels":{"net.azure-devices.edge.create-options":"{}","net.azure-devices.edge.env":"{\"PerformanceMetricsUpdateFrequency\":{\"value\":\"00:00:20\"},\"RuntimeLogLevel\":{\"value\":\"debug\"}}","net.azure-devices.edge.owner":"Microsoft.Azure.Devices.Edge.Agent"}
```

The logic that compares these properties is trying to confirm that the configuration has been deployed, and the agent's labels aren't related to the deployment so I just removed them from the comparison.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants