From eed9c064ae0ad5342a2196bd42feff2d8b7e9cdc Mon Sep 17 00:00:00 2001 From: yophilav <54859653+yophilav@users.noreply.github.com> Date: Fri, 31 Jul 2020 12:47:40 -0700 Subject: [PATCH] Rename reboot order from `priority` to be `startupOrder` (#3274) Rename reboot order from `priority` to be `startupOrder` --- doc/ModuleStartupOrder.md | 22 ++++++++--------- .../IModule.cs | 4 ++-- .../UnknownModule.cs | 2 +- .../planners/HealthRestartPlanner.cs | 4 ++-- .../planners/RestartPlanner.cs | 4 ++-- .../DockerEnvironment.cs | 4 ++-- .../DockerModule.cs | 14 +++++------ .../DockerRuntimeModule.cs | 10 ++++---- .../EdgeHubDockerModule.cs | 4 ++-- .../EdgeHubDockerRuntimeModule.cs | 10 ++++---- .../KubernetesEnvironment.cs | 4 ++-- .../KubernetesModule.cs | 12 +++++----- .../ModuleSetTest.cs | 6 ++--- .../TestModule.cs | 24 +++++++++---------- .../TestModuleTest.cs | 2 +- .../TestRuntimeModule.cs | 2 +- .../TestRuntimeModuleTest.cs | 2 +- .../configsources/FileConfigSourceTest.cs | 12 +++++----- .../planners/HealthRestartPlannerTest.cs | 8 +++---- .../DockerEnvironmentTest.cs | 8 +++---- .../DockerModuleTest.cs | 2 +- .../DockerRuntimeModuleTest.cs | 4 ++-- .../EdgeAgentDockerRuntimeModuleTest.cs | 10 ++++---- .../EdgeHubDockerRuntimeModuleTest.cs | 4 ++-- .../module-priority-test-config.json | 18 +++++++------- .../reporters/IoTHubReporterTest.cs | 12 +++++----- .../planners/KubernetesPlannerTest.cs | 6 ++--- 27 files changed, 107 insertions(+), 107 deletions(-) diff --git a/doc/ModuleStartupOrder.md b/doc/ModuleStartupOrder.md index 91855f9dbab..ae011df6d3f 100644 --- a/doc/ModuleStartupOrder.md +++ b/doc/ModuleStartupOrder.md @@ -2,7 +2,7 @@ By default, IoT Edge does not impose an ordering in the sequence in which modules are started, updated or stopped. Edge Agent by default is the first module that gets started and based on the edge deployment specification, it figures out which modules need to be started, updated or stopped and executes those operations in a non-deterministic order. -The processing order of modules can be controlled by specifying the value of a module-specific property called `priority` in the IoT Edge deployment. Modules that have been assigned a higher priority will be processed before modules that have been assigned a lower priority. +The processing order of modules can be controlled by specifying the value of a module-specific property called `startupOrder` in the IoT Edge deployment. Modules that have been assigned a higher priority will be processed before modules that have been assigned a lower priority. ## __Use case__ @@ -14,15 +14,15 @@ As an example, some customers want the Edge Hub module to be started before any ## __Configuration__ -Customers can optionally specify a `priority` value for each module in their IoT Edge deployment to achieve module boot ordering. Modules with a higher priority will be created and started first and only when an attempt has been made to start them, will other lower priority modules be created and started. +Customers can optionally specify a `startupOrder` value for each module in their IoT Edge deployment to achieve module boot ordering. Modules with a higher priority will be created and started first and only when an attempt has been made to start them, will other lower priority modules be created and started. -The value of `priority` will be positive and zero-based with 0 being the highest priority value. -A higher numeric `priority` value would indicate a lower priority assigned to that module. The maximum value of this property will be 4294967295. +The value of `startupOrder` will be positive and zero-based with 0 being the highest priority value. +A higher numeric `startupOrder` value would indicate a lower priority assigned to that module. The maximum value of this property will be 4294967295. Modules that possess the same priority will be created at the same time and will have no deterministic startup order imposed amongst themselves. Modules with higher priority values will be created and started first and once Edge Agent has made an attempt to create and start them (only the modules with a desired state of `Running` will be started), it will proceed with the creation (and optionally startup) of other lower priority modules in order. -**It must be noted that the Edge Agent module will not support the `priority` property and will by default have the highest priority. As is the behavior currently, Edge Agent will always be the first module to get started.** +**It must be noted that the Edge Agent module will not support the `startupOrder` property and will by default have the highest priority. As is the behavior currently, Edge Agent will always be the first module to get started.** -Modules that do not have a `priority` value specified will be started in a non-deterministic order and will be assigned a priority of 4294967295 which indicates the lowest possible priority. Edge Agent will trigger the creation of these modules after all modules with a higher priority have been created. +Modules that do not have a `startupOrder` value specified will be started in a non-deterministic order and will be assigned a priority of 4294967295 which indicates the lowest possible priority. Edge Agent will trigger the creation of these modules after all modules with a higher priority have been created. **Please note that Kubernetes mode of IoT Edge does not support module startup order priorities.** @@ -72,7 +72,7 @@ The following sample deployment manifest illustrates how priority values of modu "image": "mcr.microsoft.com/azureiotedge-hub:1.0", "createOptions": "" }, - "priority": 0 + "startupOrder": 0 } }, "modules": { @@ -85,7 +85,7 @@ The following sample deployment manifest illustrates how priority values of modu "image": "mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0", "createOptions": "{}" }, - "priority": 1 + "startupOrder": 1 }, "filtermodule": { "version": "1.0", @@ -118,9 +118,9 @@ The following sample deployment manifest illustrates how priority values of modu In the sample deployment manifest shown above: -* The `$edgeHub` module has been assigned a `priority` value of 0. -* The `SimulatedTemperatureSensor` module has been assigned a `priority` value of 1. -* The `filtermodule` module has not been assigned any `priority` value which means that it will by default assume the priority of 4294967295 which is the lowest priority value possible. +* The `$edgeHub` module has been assigned a `startupOrder` value of 0. +* The `SimulatedTemperatureSensor` module has been assigned a `startupOrder` value of 1. +* The `filtermodule` module has not been assigned any `startupOrder` value which means that it will by default assume the priority of 4294967295 which is the lowest priority value possible. When this deployment manifest is deployed to a device that does not have any modules running, `$edgeHub` is the first module that will come up followed by the `SimulatedTemperatureSensor` module and then the `filtermodule`. diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/IModule.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/IModule.cs index 841f48e711c..01c2a722425 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/IModule.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/IModule.cs @@ -112,8 +112,8 @@ public interface IModule : IEquatable [JsonProperty(PropertyName = "imagePullPolicy")] ImagePullPolicy ImagePullPolicy { get; } - [JsonProperty(PropertyName = "priority")] - uint Priority { get; } + [JsonProperty(PropertyName = "startupOrder")] + uint StartupOrder { get; } [JsonIgnore] ConfigurationInfo ConfigurationInfo { get; } diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/UnknownModule.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/UnknownModule.cs index be18d8f297b..8e838caeb7f 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/UnknownModule.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/UnknownModule.cs @@ -23,7 +23,7 @@ public virtual string Name public virtual ImagePullPolicy ImagePullPolicy => ImagePullPolicy.OnCreate; - public virtual uint Priority => Constants.DefaultPriority; + public virtual uint StartupOrder => Constants.DefaultPriority; public virtual ConfigurationInfo ConfigurationInfo => new ConfigurationInfo(); diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/planners/HealthRestartPlanner.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/planners/HealthRestartPlanner.cs index eedfd13a370..b03fcb9c9f1 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/planners/HealthRestartPlanner.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/planners/HealthRestartPlanner.cs @@ -80,8 +80,8 @@ public async Task PlanAsync( // We want to process all the modules in the deployment (desired modules) and also include the modules // that are not specified in the deployment but are currently running on the device. This is so that // their processing is done in the right priority order. - ILookup> desiredPriorityGroups = desired.Modules.ToLookup(x => x.Value.Priority); - ILookup> currentPriorityGroups = current.Modules.ToLookup(x => x.Value.Priority); + ILookup> desiredPriorityGroups = desired.Modules.ToLookup(x => x.Value.StartupOrder); + ILookup> currentPriorityGroups = current.Modules.ToLookup(x => x.Value.StartupOrder); ImmutableSortedSet orderedPriorities = desiredPriorityGroups.Select(x => x.Key).Union(currentPriorityGroups.Select(x => x.Key)).ToImmutableSortedSet(); var processedDesiredMatchingCurrentModules = new HashSet(); diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/planners/RestartPlanner.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/planners/RestartPlanner.cs index 291f37d48ac..34839546d7f 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/planners/RestartPlanner.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/planners/RestartPlanner.cs @@ -54,8 +54,8 @@ async Task CreatePlan(ModuleSet desired, ModuleSet current, IRuntimeInfo r // We want to process all the modules in the deployment (desired modules) and also include the modules // that are not specified in the deployment but are currently running on the device. This is so that // their processing is done in the right priority order. - ILookup> desiredPriorityGroups = desired.Modules.ToLookup(x => x.Value.Priority); - ILookup> currentPriorityGroups = current.Modules.ToLookup(x => x.Value.Priority); + ILookup> desiredPriorityGroups = desired.Modules.ToLookup(x => x.Value.StartupOrder); + ILookup> currentPriorityGroups = current.Modules.ToLookup(x => x.Value.StartupOrder); ImmutableSortedSet orderedPriorities = desiredPriorityGroups.Select(x => x.Key).Union(currentPriorityGroups.Select(x => x.Key)).ToImmutableSortedSet(); var processedDesiredMatchingCurrentModules = new HashSet(); diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironment.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironment.cs index 411e9801156..29f0f2db40b 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironment.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerEnvironment.cs @@ -92,7 +92,7 @@ public async Task GetModulesAsync(CancellationToken token) moduleState.LastRestartTimeUtc, moduleRuntimeStatus, dockerModule.ImagePullPolicy, - dockerModule.Priority, + dockerModule.StartupOrder, dockerModule.ConfigurationInfo, dockerModule.Env); break; @@ -130,7 +130,7 @@ public async Task GetModulesAsync(CancellationToken token) moduleState.LastRestartTimeUtc, moduleRuntimeStatus, dockerModule.ImagePullPolicy, - dockerModule.Priority, + dockerModule.StartupOrder, dockerModule.ConfigurationInfo, dockerModule.Env); break; diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerModule.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerModule.cs index e6095fc3d7b..6a2d4513447 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerModule.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerModule.cs @@ -19,7 +19,7 @@ public DockerModule( RestartPolicy restartPolicy, DockerConfig config, ImagePullPolicy imagePullPolicy, - uint priority, + uint startupOrder, ConfigurationInfo configurationInfo, IDictionary env) { @@ -29,7 +29,7 @@ public DockerModule( this.Config = Preconditions.CheckNotNull(config, nameof(config)); this.RestartPolicy = Preconditions.CheckIsDefined(restartPolicy); this.ImagePullPolicy = Preconditions.CheckIsDefined(imagePullPolicy); - this.Priority = priority; + this.StartupOrder = startupOrder; this.ConfigurationInfo = configurationInfo ?? new ConfigurationInfo(string.Empty); this.Env = env?.ToImmutableDictionary() ?? ImmutableDictionary.Empty; } @@ -50,11 +50,11 @@ public DockerModule( public virtual ImagePullPolicy ImagePullPolicy { get; } [JsonProperty( - PropertyName = "priority", + PropertyName = "startupOrder", Required = Required.DisallowNull, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] [DefaultValue(Core.Constants.DefaultPriority)] - public virtual uint Priority { get; } + public virtual uint StartupOrder { get; } [JsonProperty(Required = Required.Always, PropertyName = "type")] public virtual string Type => "docker"; @@ -91,7 +91,7 @@ public virtual bool Equals(IModule other) this.Config.Equals(other.Config) && this.RestartPolicy == other.RestartPolicy && this.ImagePullPolicy == other.ImagePullPolicy && - this.Priority == other.Priority && + this.StartupOrder == other.StartupOrder && EnvDictionaryComparer.Equals(this.Env, other.Env); } @@ -105,7 +105,7 @@ public virtual bool IsOnlyModuleStatusChanged(IModule other) this.Config.Equals(dockerModule.Config) && this.RestartPolicy == other.RestartPolicy && this.ImagePullPolicy == other.ImagePullPolicy && - this.Priority == other.Priority && + this.StartupOrder == other.StartupOrder && EnvDictionaryComparer.Equals(this.Env, other.Env); } @@ -124,7 +124,7 @@ public override int GetHashCode() hashCode = (hashCode * 397) ^ (this.Config != null ? this.Config.GetHashCode() : 0); hashCode = (hashCode * 397) ^ this.RestartPolicy.GetHashCode(); hashCode = (hashCode * 397) ^ this.ImagePullPolicy.GetHashCode(); - hashCode = (hashCode * 397) ^ this.Priority.GetHashCode(); + hashCode = (hashCode * 397) ^ this.StartupOrder.GetHashCode(); hashCode = (hashCode * 397) ^ EnvDictionaryComparer.GetHashCode(this.Env); return hashCode; } diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerRuntimeModule.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerRuntimeModule.cs index a7721d1afaa..401c2897669 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerRuntimeModule.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/DockerRuntimeModule.cs @@ -23,10 +23,10 @@ public DockerRuntimeModule( DateTime lastRestartTime, ModuleStatus runtimeStatus, ImagePullPolicy imagePullPolicy, - uint priority, + uint startupOrder, ConfigurationInfo configuration, IDictionary env) - : base(name, version, desiredStatus, restartPolicy, config, imagePullPolicy, priority, configuration, env) + : base(name, version, desiredStatus, restartPolicy, config, imagePullPolicy, startupOrder, configuration, env) { this.ExitCode = exitCode; this.StatusDescription = statusDescription; @@ -53,7 +53,7 @@ public DockerRuntimeModule( DateTime lastRestartTimeUtc, ModuleStatus runtimeStatus, ImagePullPolicy imagePullPolicy, - uint priority, + uint startupOrder, ConfigurationInfo configurationInfo, IDictionary env) : this( @@ -70,7 +70,7 @@ public DockerRuntimeModule( lastRestartTimeUtc, runtimeStatus, imagePullPolicy, - priority, + startupOrder, configurationInfo, env) { @@ -160,7 +160,7 @@ public override int GetHashCode() this.LastRestartTimeUtc, newStatus, this.ImagePullPolicy, - this.Priority, + this.StartupOrder, this.ConfigurationInfo, this.Env); } diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/EdgeHubDockerModule.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/EdgeHubDockerModule.cs index abffc620896..316c6864cdd 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/EdgeHubDockerModule.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/EdgeHubDockerModule.cs @@ -16,11 +16,11 @@ public EdgeHubDockerModule( RestartPolicy restartPolicy, DockerConfig settings, ImagePullPolicy imagePullPolicy, - uint priority, + uint startupOrder, ConfigurationInfo configuration, IDictionary env, string version = "") - : base(Core.Constants.EdgeHubModuleName, version, status, restartPolicy, settings, imagePullPolicy, priority, configuration, env) + : base(Core.Constants.EdgeHubModuleName, version, status, restartPolicy, settings, imagePullPolicy, startupOrder, configuration, env) { Preconditions.CheckArgument(type?.Equals("docker") ?? false); this.DesiredStatus = Preconditions.CheckIsDefined(status); diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/EdgeHubDockerRuntimeModule.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/EdgeHubDockerRuntimeModule.cs index 553264be4a6..4adc6b26754 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/EdgeHubDockerRuntimeModule.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Docker/EdgeHubDockerRuntimeModule.cs @@ -22,7 +22,7 @@ public EdgeHubDockerRuntimeModule( DateTime lastRestartTime, ModuleStatus runtimeStatus, ImagePullPolicy imagePullPolicy, - uint priority, + uint startupOrder, ConfigurationInfo configuration, IDictionary env, string version = "") @@ -40,7 +40,7 @@ public EdgeHubDockerRuntimeModule( lastRestartTime, runtimeStatus, imagePullPolicy, - priority, + startupOrder, configuration, env) { @@ -68,7 +68,7 @@ public EdgeHubDockerRuntimeModule( DateTime lastRestartTimeUtc, ModuleStatus runtimeStatus, ImagePullPolicy imagePullPolicy, - uint priority, + uint startupOrder, ConfigurationInfo configurationInfo, IDictionary env, string version = "") @@ -84,7 +84,7 @@ public EdgeHubDockerRuntimeModule( lastRestartTimeUtc, runtimeStatus, imagePullPolicy, - priority, + startupOrder, configurationInfo, env, version) @@ -114,7 +114,7 @@ public EdgeHubDockerRuntimeModule( this.LastRestartTimeUtc, newStatus, this.ImagePullPolicy, - this.Priority, + this.StartupOrder, this.ConfigurationInfo, this.Env); } diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Kubernetes/KubernetesEnvironment.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Kubernetes/KubernetesEnvironment.cs index cbed71398c4..5fdd9119d47 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Kubernetes/KubernetesEnvironment.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Kubernetes/KubernetesEnvironment.cs @@ -83,7 +83,7 @@ public async Task GetModulesAsync(CancellationToken token) moduleState.LastRestartTimeUtc, moduleRuntimeInfo.ModuleStatus, dockerModule.ImagePullPolicy, - dockerModule.Priority, + dockerModule.StartupOrder, dockerModule.ConfigurationInfo, dockerModule.Env); break; @@ -116,7 +116,7 @@ public async Task GetModulesAsync(CancellationToken token) moduleState.LastRestartTimeUtc, moduleRuntimeInfo.ModuleStatus, dockerModule.ImagePullPolicy, - dockerModule.Priority, + dockerModule.StartupOrder, dockerModule.ConfigurationInfo, dockerModule.Env); break; diff --git a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Kubernetes/KubernetesModule.cs b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Kubernetes/KubernetesModule.cs index dfa0089b6d2..a8b70ec5c74 100644 --- a/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Kubernetes/KubernetesModule.cs +++ b/edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Kubernetes/KubernetesModule.cs @@ -25,7 +25,7 @@ public KubernetesModule(IModule module, KubernetesConfig config, KubernetesModul this.ConfigurationInfo = module.ConfigurationInfo ?? new ConfigurationInfo(string.Empty); this.Env = module.Env?.ToImmutableDictionary() ?? ImmutableDictionary.Empty; this.ImagePullPolicy = module.ImagePullPolicy; - this.Priority = Core.Constants.DefaultPriority; + this.StartupOrder = Core.Constants.DefaultPriority; this.Config = config; this.Owner = owner; } @@ -52,7 +52,7 @@ public KubernetesModule( this.Env = env?.ToImmutableDictionary() ?? ImmutableDictionary.Empty; this.Config = settings; this.ImagePullPolicy = imagePullPolicy; - this.Priority = Core.Constants.DefaultPriority; + this.StartupOrder = Core.Constants.DefaultPriority; this.Owner = owner; } @@ -75,7 +75,7 @@ public KubernetesModule( public ImagePullPolicy ImagePullPolicy { get; } [JsonIgnore] - public uint Priority { get; } + public uint StartupOrder { get; } [JsonIgnore] public ConfigurationInfo ConfigurationInfo { get; } @@ -118,7 +118,7 @@ public bool Equals(KubernetesModule other) ConfigComparer.Equals(this.Config, other.Config) && this.RestartPolicy == other.RestartPolicy && this.ImagePullPolicy == other.ImagePullPolicy && - this.Priority == other.Priority && + this.StartupOrder == other.StartupOrder && EnvDictionaryComparer.Equals(this.Env, other.Env); } @@ -137,7 +137,7 @@ public override int GetHashCode() hashCode = (hashCode * 397) ^ (this.Config != null ? this.Config.GetHashCode() : 0); hashCode = (hashCode * 397) ^ this.RestartPolicy.GetHashCode(); hashCode = (hashCode * 397) ^ this.ImagePullPolicy.GetHashCode(); - hashCode = (hashCode * 397) ^ this.Priority.GetHashCode(); + hashCode = (hashCode * 397) ^ this.StartupOrder.GetHashCode(); hashCode = (hashCode * 397) ^ EnvDictionaryComparer.GetHashCode(this.Env); return hashCode; } @@ -153,7 +153,7 @@ public bool IsOnlyModuleStatusChanged(IModule other) ConfigComparer.Equals(this.Config, (other as KubernetesModule).Config) && this.RestartPolicy == other.RestartPolicy && this.ImagePullPolicy == other.ImagePullPolicy && - this.Priority == other.Priority && + this.StartupOrder == other.StartupOrder && EnvDictionaryComparer.Equals(this.Env, other.Env); } diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/ModuleSetTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/ModuleSetTest.cs index d4c7f3736e8..e32c362af95 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/ModuleSetTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/ModuleSetTest.cs @@ -39,9 +39,9 @@ public void TestDiff(ModuleSet start, ModuleSet end, Diff expected) [Unit] public void TestDeserialize() { - string validJson = "{\"Modules\":{\"mod1\":{\"Version\":\"version1\",\"Type\":\"test\",\"Status\":\"Running\",\"Settings\":{\"Image\":\"image1\"},\"RestartPolicy\":\"on-unhealthy\",\"ImagePullPolicy\":\"on-create\",\"Priority\":0,\"Configuration\":{\"id\":\"1\"}},\"mod2\":{\"Version\":\"version1\",\"Type\":\"test\",\"Status\":\"Running\",\"settings\":{\"image\":\"image1\"},\"RestartPolicy\":\"on-unhealthy\",\"ImagePullPolicy\":\"on-create\",\"configuration\":{\"id\":\"1\"}}}}"; - string validJsonAllLower = "{\"modules\":{\"mod1\":{\"version\":\"version1\",\"type\":\"test\",\"status\":\"running\",\"settings\":{\"image\":\"image1\"},\"restartpolicy\":\"on-unhealthy\",\"imagepullpolicy\":\"on-create\",\"priority\":0,\"Configuration\":{\"id\":\"1\"}},\"mod2\":{\"version\":\"version1\",\"type\":\"test\",\"status\":\"running\",\"settings\":{\"image\":\"image1\"},\"restartpolicy\":\"on-unhealthy\",\"imagepullpolicy\":\"on-create\",\"configuration\":{\"id\":\"1\"}}}}"; - string validJsonAllCap = "{\"MODULES\":{\"mod1\":{\"NAME\":\"mod1\",\"VERSION\":\"version1\",\"TYPE\":\"test\",\"STATUS\":\"RUNNING\",\"SETTINGS\":{\"IMAGE\":\"image1\"},\"RESTARTPOLICY\":\"on-unhealthy\",\"IMAGEPULLPOLICY\":\"on-create\",\"PRIORITY\":0,\"Configuration\":{\"id\":\"1\"}},\"mod2\":{\"NAME\":\"mod2\",\"VERSION\":\"version1\",\"TYPE\":\"test\",\"STATUS\":\"RUNNING\",\"SETTINGS\":{\"IMAGE\":\"image1\"},\"RESTARTPOLICY\":\"on-unhealthy\",\"IMAGEPULLPOLICY\":\"on-create\",\"CONFIGURATION\":{\"id\":\"1\"}}}}"; + string validJson = "{\"Modules\":{\"mod1\":{\"Version\":\"version1\",\"Type\":\"test\",\"Status\":\"Running\",\"Settings\":{\"Image\":\"image1\"},\"RestartPolicy\":\"on-unhealthy\",\"ImagePullPolicy\":\"on-create\",\"StartupOrder\":0,\"Configuration\":{\"id\":\"1\"}},\"mod2\":{\"Version\":\"version1\",\"Type\":\"test\",\"Status\":\"Running\",\"settings\":{\"image\":\"image1\"},\"RestartPolicy\":\"on-unhealthy\",\"ImagePullPolicy\":\"on-create\",\"configuration\":{\"id\":\"1\"}}}}"; + string validJsonAllLower = "{\"modules\":{\"mod1\":{\"version\":\"version1\",\"type\":\"test\",\"status\":\"running\",\"settings\":{\"image\":\"image1\"},\"restartpolicy\":\"on-unhealthy\",\"imagepullpolicy\":\"on-create\",\"startuporder\":0,\"Configuration\":{\"id\":\"1\"}},\"mod2\":{\"version\":\"version1\",\"type\":\"test\",\"status\":\"running\",\"settings\":{\"image\":\"image1\"},\"restartpolicy\":\"on-unhealthy\",\"imagepullpolicy\":\"on-create\",\"configuration\":{\"id\":\"1\"}}}}"; + string validJsonAllCap = "{\"MODULES\":{\"mod1\":{\"NAME\":\"mod1\",\"VERSION\":\"version1\",\"TYPE\":\"test\",\"STATUS\":\"RUNNING\",\"SETTINGS\":{\"IMAGE\":\"image1\"},\"RESTARTPOLICY\":\"on-unhealthy\",\"IMAGEPULLPOLICY\":\"on-create\",\"STARTUPORDER\":0,\"Configuration\":{\"id\":\"1\"}},\"mod2\":{\"NAME\":\"mod2\",\"VERSION\":\"version1\",\"TYPE\":\"test\",\"STATUS\":\"RUNNING\",\"SETTINGS\":{\"IMAGE\":\"image1\"},\"RESTARTPOLICY\":\"on-unhealthy\",\"IMAGEPULLPOLICY\":\"on-create\",\"CONFIGURATION\":{\"id\":\"1\"}}}}"; string noVersionJson = "{\"Modules\":{\"mod1\":{\"Type\":\"test\",\"Status\":\"Running\",\"Settings\":{\"Image\":\"image1\"},\"RestartPolicy\":\"on-unhealthy\",\"ImagePullPolicy\":\"on-create\",\"Configuration\":{\"id\":\"1\"}},\"mod2\":{\"Type\":\"test\",\"Status\":\"Running\",\"settings\":{\"image\":\"image1\"},\"RestartPolicy\":\"on-unhealthy\",\"ImagePullPolicy\":\"on-create\",\"configuration\":{\"id\":\"1\"}}}}"; string noTypeJson = "{\"Modules\":{\"mod1\":{\"Version\":\"version1\",\"Status\":\"Running\",\"Settings\":{\"Image\":\"image1\"},\"RestartPolicy\":\"on-unhealthy\",\"ImagePullPolicy\":\"on-create\",\"Configuration\":{\"id\":\"1\"}},\"mod2\":{\"Version\":\"version1\",\"Status\":\"Running\",\"settings\":{\"image\":\"image1\"},\"RestartPolicy\":\"on-unhealthy\",\"ImagePullPolicy\":\"on-create\",\"configuration\":{\"id\":\"1\"}}}}"; diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestModule.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestModule.cs index b539df101d2..8b0615488c0 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestModule.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestModule.cs @@ -57,7 +57,7 @@ public TestModuleBase( TConfig config, RestartPolicy restartPolicy, ImagePullPolicy imagePullPolicy, - uint priority, + uint startupOrder, ConfigurationInfo configuration, IDictionary env) { @@ -68,7 +68,7 @@ public TestModuleBase( this.Config = Preconditions.CheckNotNull(config, nameof(config)); this.RestartPolicy = Preconditions.CheckIsDefined(restartPolicy); this.ImagePullPolicy = Preconditions.CheckIsDefined(imagePullPolicy); - this.Priority = priority; + this.StartupOrder = startupOrder; this.ConfigurationInfo = configuration ?? new ConfigurationInfo(); this.Env = env?.ToImmutableDictionary() ?? ImmutableDictionary.Empty; } @@ -92,11 +92,11 @@ public TestModuleBase( public virtual ImagePullPolicy ImagePullPolicy { get; } [JsonProperty( - PropertyName = "priority", + PropertyName = "startupOrder", Required = Required.DisallowNull, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] [DefaultValue(Constants.DefaultPriority)] - public virtual uint Priority { get; } + public virtual uint StartupOrder { get; } [JsonProperty(Required = Required.Always, PropertyName = "status")] public virtual ModuleStatus DesiredStatus { get; } @@ -116,7 +116,7 @@ other is TestModuleBase testModuleBase && this.Config.Equals(testModuleBase.Config) && this.RestartPolicy == other.RestartPolicy && this.ImagePullPolicy == other.ImagePullPolicy && - this.Priority == other.Priority; + this.StartupOrder == other.StartupOrder; public override bool Equals(object obj) => this.Equals(obj as TestModuleBase); @@ -141,7 +141,7 @@ public virtual bool Equals(IModule other) this.Config.Equals(other.Config) && this.RestartPolicy == other.RestartPolicy && this.ImagePullPolicy == other.ImagePullPolicy && - this.Priority == other.Priority; + this.StartupOrder == other.StartupOrder; } public override int GetHashCode() @@ -158,7 +158,7 @@ public override int GetHashCode() hashCode = (hashCode * 397) ^ (this.Config != null ? this.Config.GetHashCode() : 0); hashCode = (hashCode * 397) ^ this.RestartPolicy.GetHashCode(); hashCode = (hashCode * 397) ^ this.ImagePullPolicy.GetHashCode(); - hashCode = (hashCode * 397) ^ this.Priority.GetHashCode(); + hashCode = (hashCode * 397) ^ this.StartupOrder.GetHashCode(); return hashCode; } } @@ -174,16 +174,16 @@ public TestModule( TestConfig config, RestartPolicy restartPolicy, ImagePullPolicy imagePullPolicy, - uint priority, + uint startupOrder, ConfigurationInfo configuration, IDictionary env) - : base(name, version, type, desiredStatus, config, restartPolicy, imagePullPolicy, priority, configuration, env) + : base(name, version, type, desiredStatus, config, restartPolicy, imagePullPolicy, startupOrder, configuration, env) { } public TestModule CloneWithImage(string image) { - return new TestModule(this.Name, this.Version, this.Type, this.DesiredStatus, new TestConfig(image), this.RestartPolicy, this.ImagePullPolicy, this.Priority, this.ConfigurationInfo, this.Env); + return new TestModule(this.Name, this.Version, this.Type, this.DesiredStatus, new TestConfig(image), this.RestartPolicy, this.ImagePullPolicy, this.StartupOrder, this.ConfigurationInfo, this.Env); } } @@ -214,8 +214,8 @@ public virtual IModule WithRuntimeStatus(ModuleStatus newStatus) public class TestHubModule : TestModule, IEdgeHubModule { - public TestHubModule(string name, string type, ModuleStatus desiredStatus, TestConfig config, RestartPolicy restartPolicy, ImagePullPolicy imagePullPolicy, uint priority, ConfigurationInfo configuration, IDictionary env) - : base(name ?? Constants.EdgeHubModuleName, string.Empty, type, desiredStatus, config, restartPolicy, imagePullPolicy, priority, configuration, env) + public TestHubModule(string name, string type, ModuleStatus desiredStatus, TestConfig config, RestartPolicy restartPolicy, ImagePullPolicy imagePullPolicy, uint startupOrder, ConfigurationInfo configuration, IDictionary env) + : base(name ?? Constants.EdgeHubModuleName, string.Empty, type, desiredStatus, config, restartPolicy, imagePullPolicy, startupOrder, configuration, env) { this.Version = string.Empty; } diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestModuleTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestModuleTest.cs index 96bc6b4acee..e712d2f0ef3 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestModuleTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestModuleTest.cs @@ -85,7 +85,7 @@ public class TestModuleTest ""Status"": ""running"", ""RestartPolicy"": ""on-unhealthy"", ""ImagePullPolicy"": ""on-create"", - ""Priority"": 0, + ""StartupOrder"": 0, ""Settings"": { ""Image"": ""image1"" }, diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestRuntimeModule.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestRuntimeModule.cs index 22f1160283d..be5c98057fd 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestRuntimeModule.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestRuntimeModule.cs @@ -117,7 +117,7 @@ public override int GetHashCode() this.LastRestartTimeUtc, newStatus, this.ImagePullPolicy, - this.Priority, + this.StartupOrder, this.ConfigurationInfo); } } diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestRuntimeModuleTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestRuntimeModuleTest.cs index f79a0df84df..99197d53f97 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestRuntimeModuleTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/TestRuntimeModuleTest.cs @@ -97,7 +97,7 @@ public static void TestWithRuntimeStatus() Assert.Equal(reportedModule.RestartCount, updatedModule.RestartCount); Assert.Equal(reportedModule.RestartPolicy, updatedModule.RestartPolicy); Assert.Equal(reportedModule.ImagePullPolicy, updatedModule.ImagePullPolicy); - Assert.Equal(reportedModule.Priority, updatedModule.Priority); + Assert.Equal(reportedModule.StartupOrder, updatedModule.StartupOrder); Assert.Equal(reportedModule.StatusDescription, updatedModule.StatusDescription); Assert.Equal(reportedModule.Type, updatedModule.Type); Assert.Equal(reportedModule.Version, updatedModule.Version); diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/configsources/FileConfigSourceTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/configsources/FileConfigSourceTest.cs index 9d53a7edb66..8fd3cd8e81d 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/configsources/FileConfigSourceTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/configsources/FileConfigSourceTest.cs @@ -30,7 +30,7 @@ public class FileConfigSourceTest : IDisposable ""edgeAgent"": { ""type"": ""test"", ""imagePullPolicy"": ""on-create"", - ""priority"": 10, + ""startupOrder"": 10, ""settings"": { ""image"": ""edge-agent"" }, @@ -43,7 +43,7 @@ public class FileConfigSourceTest : IDisposable ""status"": ""running"", ""restartPolicy"": ""always"", ""imagePullPolicy"": ""on-create"", - ""priority"": 10, + ""startupOrder"": 10, ""settings"": { ""image"": ""edge-hub:latest"" }, @@ -59,7 +59,7 @@ public class FileConfigSourceTest : IDisposable ""status"": ""running"", ""restartPolicy"": ""on-unhealthy"", ""imagePullPolicy"": ""never"", - ""priority"": 0, + ""startupOrder"": 0, ""settings"": { ""image"": ""image1"" }, @@ -86,7 +86,7 @@ public class FileConfigSourceTest : IDisposable ""edgeAgent"": { ""type"": ""test"", ""imagePullPolicy"": ""on-create"", - ""priority"": 10, + ""startupOrder"": 10, ""settings"": { ""image"": ""edge-agent"" }, @@ -99,7 +99,7 @@ public class FileConfigSourceTest : IDisposable ""status"": ""running"", ""restartPolicy"": ""always"", ""imagePullPolicy"": ""on-create"", - ""priority"": 10, + ""startupOrder"": 10, ""settings"": { ""image"": ""edge-hub:latest"" }, @@ -115,7 +115,7 @@ public class FileConfigSourceTest : IDisposable ""status"": ""stopped"", ""restartPolicy"": ""on-unhealthy"", ""imagePullPolicy"": ""never"", - ""priority"": 0, + ""startupOrder"": 0, ""settings"": { ""image"": ""image1"" }, diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/planners/HealthRestartPlannerTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/planners/HealthRestartPlannerTest.cs index e2970663a81..7d59d1f9974 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/planners/HealthRestartPlannerTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Core.Test/planners/HealthRestartPlannerTest.cs @@ -294,7 +294,7 @@ public async Task TestStartStoppedModule() // build expected execution list IList expectedExecutionList = data - .OrderBy(m => m.UpdatedModule.Priority) + .OrderBy(m => m.UpdatedModule.StartupOrder) .Where(d => d.UpdatedModule.RestartPolicy > RestartPolicy.Never || d.RunningModule.LastStartTimeUtc == DateTime.MinValue) .Select(d => new TestRecordType(TestCommandType.TestStart, d.RunningModule)) .ToList(); @@ -315,7 +315,7 @@ public async Task TestStartStoppedModule() // Asserting whether the execution list commands are ordered based on module priority. for (int i = 1; i < r.ExecutionList.Count; i++) { - Assert.True(r.ExecutionList[i - 1].Module.Priority <= r.ExecutionList[i].Module.Priority); + Assert.True(r.ExecutionList[i - 1].Module.StartupOrder <= r.ExecutionList[i].Module.StartupOrder); } }); } @@ -388,7 +388,7 @@ public async Task TestUpdateStateChangedKitchenSink() // Asserting whether the execution list commands are ordered based on module priority. for (int i = 1; i < r.ExecutionList.Count; i++) { - Assert.True(r.ExecutionList[i - 1].Module.Priority <= r.ExecutionList[i].Module.Priority); + Assert.True(r.ExecutionList[i - 1].Module.StartupOrder <= r.ExecutionList[i].Module.StartupOrder); } }); } @@ -454,7 +454,7 @@ public async Task TestUpdateStateChanged_Offline_NoIdentities() // Asserting whether the execution list commands are ordered based on module priority. for (int i = 1; i < r.ExecutionList.Count; i++) { - Assert.True(r.ExecutionList[i - 1].Module.Priority <= r.ExecutionList[i].Module.Priority); + Assert.True(r.ExecutionList[i - 1].Module.StartupOrder <= r.ExecutionList[i].Module.StartupOrder); } }); } diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerEnvironmentTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerEnvironmentTest.cs index 186a3aa97ac..a8fa1104253 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerEnvironmentTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerEnvironmentTest.cs @@ -178,7 +178,7 @@ public async Task GetModulesTest() Assert.Equal(ModuleStatus.Stopped, receivedDockerModule1.DesiredStatus); Assert.Equal(RestartPolicy.Always, receivedDockerModule1.RestartPolicy); Assert.Equal(ImagePullPolicy.OnCreate, receivedDockerModule1.ImagePullPolicy); - Assert.Equal(Constants.DefaultPriority, receivedDockerModule1.Priority); + Assert.Equal(Constants.DefaultPriority, receivedDockerModule1.StartupOrder); Assert.Equal("mod1:v1", receivedDockerModule1.Config.Image); Assert.Equal("{\"Env\":[\"foo=bar\"]}", JsonConvert.SerializeObject(receivedDockerModule1.Config.CreateOptions)); Assert.Equal(ModuleStatus.Stopped, receivedDockerModule1.RuntimeStatus); @@ -197,7 +197,7 @@ public async Task GetModulesTest() Assert.Equal(ModuleStatus.Running, receivedDockerModule2.DesiredStatus); Assert.Equal(RestartPolicy.OnUnhealthy, receivedDockerModule2.RestartPolicy); Assert.Equal(ImagePullPolicy.Never, receivedDockerModule2.ImagePullPolicy); - Assert.Equal(Constants.DefaultPriority, receivedDockerModule2.Priority); + Assert.Equal(Constants.DefaultPriority, receivedDockerModule2.StartupOrder); Assert.Equal("mod2:v2", receivedDockerModule2.Config.Image); Assert.Equal("{\"Env\":[\"foo2=bar2\"]}", JsonConvert.SerializeObject(receivedDockerModule2.Config.CreateOptions)); Assert.Equal(ModuleStatus.Failed, receivedDockerModule2.RuntimeStatus); @@ -216,7 +216,7 @@ public async Task GetModulesTest() Assert.Equal(ModuleStatus.Running, receivedDockerEdgeHub.DesiredStatus); Assert.Equal(RestartPolicy.Always, receivedDockerEdgeHub.RestartPolicy); Assert.Equal(ImagePullPolicy.OnCreate, receivedDockerEdgeHub.ImagePullPolicy); - Assert.Equal(Constants.HighestPriority, receivedDockerEdgeHub.Priority); + Assert.Equal(Constants.HighestPriority, receivedDockerEdgeHub.StartupOrder); Assert.Equal("edgehub:v1", receivedDockerEdgeHub.Config.Image); Assert.Equal("{\"Env\":[\"foo3=bar3\"]}", JsonConvert.SerializeObject(receivedDockerEdgeHub.Config.CreateOptions)); Assert.Equal(ModuleStatus.Running, receivedDockerEdgeHub.RuntimeStatus); @@ -234,7 +234,7 @@ public async Task GetModulesTest() Assert.Equal(string.Empty, receivedDockerEdgeAgent.Version); Assert.Equal(ModuleStatus.Running, receivedDockerEdgeAgent.RuntimeStatus); Assert.Equal(ImagePullPolicy.OnCreate, receivedDockerEdgeAgent.ImagePullPolicy); - Assert.Equal(Constants.HighestPriority, receivedDockerEdgeAgent.Priority); + Assert.Equal(Constants.HighestPriority, receivedDockerEdgeAgent.StartupOrder); Assert.Equal("edgeAgent:v1", receivedDockerEdgeAgent.Config.Image); Assert.Equal("{\"Env\":[\"foo4=bar4\"]}", JsonConvert.SerializeObject(receivedDockerEdgeAgent.Config.CreateOptions)); Assert.Equal(new DateTime(2017, 10, 10), receivedDockerEdgeAgent.LastStartTimeUtc); diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerModuleTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerModuleTest.cs index 9814028ad51..96e1cc6a727 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerModuleTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerModuleTest.cs @@ -260,7 +260,7 @@ public class DockerModuleTest ""Status"":""running"", ""RestartPolicy"": ""on-unhealthy"", ""ImagePullPolicy"": ""on-create"", - ""Priority"": 0, + ""StartupOrder"": 0, ""Settings"":{ ""Image"":""image1:42"", ""CreateOptions"": { diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerRuntimeModuleTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerRuntimeModuleTest.cs index 2f3306497e9..d1b569c7a9d 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerRuntimeModuleTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/DockerRuntimeModuleTest.cs @@ -494,7 +494,7 @@ public class DockerRuntimeModuleTest ""Status"":""running"", ""RestartPolicy"":""on-failure"", ""ImagePullPolicy"": ""on-create"", - ""Priority"": 0, + ""StartupOrder"": 0, ""Settings"":{ ""Image"":""image1:42"" }, @@ -752,7 +752,7 @@ public void TestWithRuntimeStatus() Assert.Equal(m2.RestartCount, newM2.RestartCount); Assert.Equal(m2.RestartPolicy, newM2.RestartPolicy); Assert.Equal(m2.ImagePullPolicy, newM2.ImagePullPolicy); - Assert.Equal(m2.Priority, newM2.Priority); + Assert.Equal(m2.StartupOrder, newM2.StartupOrder); Assert.Equal(m2.StatusDescription, newM2.StatusDescription); Assert.Equal(m2.Type, newM2.Type); Assert.Equal(m2.Version, newM2.Version); diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeAgentDockerRuntimeModuleTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeAgentDockerRuntimeModuleTest.cs index 5b17f253fd2..38e53f6388e 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeAgentDockerRuntimeModuleTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeAgentDockerRuntimeModuleTest.cs @@ -45,7 +45,7 @@ public void TestJsonSerialize() statusDescription = string.Empty, type = "docker", imagePullPolicy = "on-create", - priority = Constants.HighestPriority, + startupOrder = Constants.HighestPriority, settings = new { image = "booyah:latest", @@ -91,7 +91,7 @@ public void TestJsonDeserialize() // TODO - Change Config for Runtime to DockerReportedConfig. // Assert.Equal("someSha", (edgeAgent.Config as DockerReportedConfig)?.ImageHash); Assert.Equal(lastStartTimeUtc, edgeAgent.LastStartTimeUtc); - Assert.Equal(Constants.HighestPriority, edgeAgent.Priority); + Assert.Equal(Constants.HighestPriority, edgeAgent.StartupOrder); } [Fact] @@ -126,7 +126,7 @@ public void TestJsonDeserialize2() // TODO - Change Config for Runtime to DockerReportedConfig. // Assert.Equal("someSha", (edgeAgent.Config as DockerReportedConfig)?.ImageHash); Assert.Equal("bing", edgeAgent.ConfigurationInfo.Id); - Assert.Equal(Constants.HighestPriority, edgeAgent.Priority); + Assert.Equal(Constants.HighestPriority, edgeAgent.StartupOrder); } [Fact] @@ -149,7 +149,7 @@ public void TestJsonDeserializeWithNonHighestPriority() { id = "bing" }, - priority = 10 + startupOrder = 10 }); // Act @@ -162,7 +162,7 @@ public void TestJsonDeserializeWithNonHighestPriority() // TODO - Change Config for Runtime to DockerReportedConfig. // Assert.Equal("someSha", (edgeAgent.Config as DockerReportedConfig)?.ImageHash); Assert.Equal("bing", edgeAgent.ConfigurationInfo.Id); - Assert.Equal(Constants.HighestPriority, edgeAgent.Priority); + Assert.Equal(Constants.HighestPriority, edgeAgent.StartupOrder); } [Fact] diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeHubDockerRuntimeModuleTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeHubDockerRuntimeModuleTest.cs index 152ea6b08ed..ce46d4aa8e4 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeHubDockerRuntimeModuleTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeHubDockerRuntimeModuleTest.cs @@ -205,7 +205,7 @@ public void TestJsonSerializeWithNonDefaultPriority() ""status"": ""running"", ""restartPolicy"": ""always"", ""imagePullPolicy"": ""never"", - ""priority"": 10, + ""startupOrder"": 10, ""exitCode"": 0, ""statusDescription"": """", ""lastStartTimeUtc"": ""0001-01-01T00:00:00"", @@ -235,7 +235,7 @@ public void TestJsonDeserializeWithNonDefaultPriority() ""status"": ""running"", ""restartPolicy"": ""always"", ""imagePullPolicy"": ""never"", - ""priority"": 10, + ""startupOrder"": 10, ""exitCode"": 0, ""statusDescription"": """", ""lastStartTimeUtc"": ""0001-01-01T00:00:00"", diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Integration.Test/test-configs/module-priority-test-config.json b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Integration.Test/test-configs/module-priority-test-config.json index 3b0bf446ed3..ca5c078518d 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Integration.Test/test-configs/module-priority-test-config.json +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Integration.Test/test-configs/module-priority-test-config.json @@ -40,7 +40,7 @@ "image": "edgebuilds.azurecr.io/microsoft/azureiotedge-simulated-temperature-sensor:20191106.7-linux-amd64", "createOptions": "" }, - "priority": 2, + "startupOrder": 2, "status": "running", "restartPolicy": "always" } @@ -53,7 +53,7 @@ "runtimeStatus": "running", "status": "running", "restartPolicy": "always", - "priority": 2, + "startupOrder": 2, "type": "docker", "settings": { "image": "edgebuilds.azurecr.io/microsoft/azureiotedge-simulated-temperature-sensor:20191106.8-linux-amd64", @@ -65,7 +65,7 @@ "runtimeStatus": "running", "status": "running", "restartPolicy": "always", - "priority": 1, + "startupOrder": 1, "type": "docker", "settings": { "image": "edgebuilds.azurecr.io/microsoft/azureiotedge-simulated-temperature-sensor:20191106.8-linux-amd64", @@ -131,7 +131,7 @@ "image": "mcr.microsoft.com/azureiotedge-agent:1.0", "createOptions": "{}" }, - "priority": 2, + "startupOrder": 2, "env": { } }, @@ -143,7 +143,7 @@ }, "env": { }, - "priority": 0, + "startupOrder": 0, "status": "running", "restartPolicy": "always" } @@ -155,7 +155,7 @@ "image": "edgebuilds.azurecr.io/microsoft/azureiotedge-simulated-temperature-sensor:20191106.7-linux-amd64", "createOptions": "" }, - "priority": 1, + "startupOrder": 1, "status": "running", "restartPolicy": "always" }, @@ -177,7 +177,7 @@ "runtimeStatus": "running", "status": "running", "restartPolicy": "always", - "priority": 2, + "startupOrder": 2, "type": "docker", "settings": { "image": "mcr.microsoft.com/azureiotedge-agent:2.0", @@ -189,7 +189,7 @@ "runtimeStatus": "running", "status": "running", "restartPolicy": "always", - "priority": 4, + "startupOrder": 4, "type": "docker", "settings": { "image": "edgebuilds.azurecr.io/microsoft/azureiotedge-simulated-temperature-sensor:20191106.7-linux-amd64", @@ -201,7 +201,7 @@ "runtimeStatus": "running", "status": "running", "restartPolicy": "always", - "priority": 3, + "startupOrder": 3, "type": "docker", "settings": { "image": "edgebuilds.azurecr.io/microsoft/azureiotedge-simulated-temperature-sensor:20191106.8-linux-amd64", diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.IoTHub.Test/reporters/IoTHubReporterTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.IoTHub.Test/reporters/IoTHubReporterTest.cs index 3893426a8c5..aea096c2a5f 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.IoTHub.Test/reporters/IoTHubReporterTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.IoTHub.Test/reporters/IoTHubReporterTest.cs @@ -225,7 +225,7 @@ public async void ClearAndGenerateNewReportedInfoIfDeserializeFails() edgeAgent = new { type = "docker", - priority = 0, + startupOrder = 0, settings = new { image = "EdgeAgentImage" @@ -396,7 +396,7 @@ public async void ReportedPatchTest() edgeAgent = new { type = "docker", - priority = 0, + startupOrder = 0, settings = new { image = "EdgeAgentImage" @@ -575,7 +575,7 @@ public async void ReportedPatchNoneStatusTest() edgeAgent = new { type = "docker", - priority = 0, + startupOrder = 0, settings = new { image = "EdgeAgentImage" @@ -769,7 +769,7 @@ public async void ReportedPatchTestStripMetadata() edgeAgent = new { type = "docker", - priority = 0, + startupOrder = 0, settings = new { image = "EdgeAgentImage" @@ -1375,7 +1375,7 @@ public async void ReportedPatchIncludesEdgeHubInSystemModulesTest() edgeAgent = new { type = "docker", - priority = 0, + startupOrder = 0, settings = new { image = "EdgeAgentImage" @@ -1886,7 +1886,7 @@ public async void ReportedPatchWithEnvVarsTest() edgeAgent = new { type = "docker", - priority = 0, + startupOrder = 0, settings = new { image = "EdgeAgentImage" diff --git a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Kubernetes.Test/planners/KubernetesPlannerTest.cs b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Kubernetes.Test/planners/KubernetesPlannerTest.cs index fbffb77cce1..78ab67488f1 100644 --- a/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Kubernetes.Test/planners/KubernetesPlannerTest.cs +++ b/edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Kubernetes.Test/planners/KubernetesPlannerTest.cs @@ -291,7 +291,7 @@ public async void KubernetesPlannerShutdownTest() class NonDockerModule : IModule { - public NonDockerModule(string name, string version, string type, ModuleStatus desiredStatus, global::Microsoft.Azure.Devices.Edge.Agent.Core.RestartPolicy restartPolicy, ImagePullPolicy imagePullPolicy, uint priority, ConfigurationInfo configurationInfo, IDictionary env, string config) + public NonDockerModule(string name, string version, string type, ModuleStatus desiredStatus, global::Microsoft.Azure.Devices.Edge.Agent.Core.RestartPolicy restartPolicy, ImagePullPolicy imagePullPolicy, uint startupOrder, ConfigurationInfo configurationInfo, IDictionary env, string config) { this.Name = name; this.Version = version; @@ -299,7 +299,7 @@ public NonDockerModule(string name, string version, string type, ModuleStatus de this.DesiredStatus = desiredStatus; this.RestartPolicy = restartPolicy; this.ImagePullPolicy = imagePullPolicy; - this.Priority = priority; + this.StartupOrder = startupOrder; this.ConfigurationInfo = configurationInfo; this.Env = env; this.Config = config; @@ -319,7 +319,7 @@ public NonDockerModule(string name, string version, string type, ModuleStatus de public ImagePullPolicy ImagePullPolicy { get; } - public uint Priority { get; } + public uint StartupOrder { get; } public ConfigurationInfo ConfigurationInfo { get; }