-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged PR 927262: EdgeAgent: EdgeAgentDockerModule should not compare…
… "version" property EdgeAgent module has a version property which is not expected to be set, and should not be considered when comparing modules (in case it is set). Also removing configurationInfo from the comparison
- Loading branch information
1 parent
2d6824b
commit 2fd4bf1
Showing
4 changed files
with
96 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
edge-agent/test/Microsoft.Azure.Devices.Edge.Agent.Docker.Test/EdgeAgentDockerModuleTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
namespace Microsoft.Azure.Devices.Edge.Agent.Docker.Test | ||
{ | ||
using System.Collections.Generic; | ||
using Microsoft.Azure.Devices.Edge.Agent.Core; | ||
using Microsoft.Azure.Devices.Edge.Util.Test.Common; | ||
using Xunit; | ||
|
||
public class EdgeAgentDockerModuleTest | ||
{ | ||
public static IEnumerable<object[]> GetEaModules() | ||
{ | ||
yield return new object[] | ||
{ | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo"), null, null), | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo"), null, null), | ||
true | ||
}; | ||
|
||
yield return new object[] | ||
{ | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo"), new ConfigurationInfo("c1"), new Dictionary<string, EnvVal>{ ["Env1"] = new EnvVal("EnvVal1")}, "version1"), | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo"), null, null), | ||
true | ||
}; | ||
|
||
yield return new object[] | ||
{ | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo"), new ConfigurationInfo("c1"), new Dictionary<string, EnvVal>{ ["Env1"] = new EnvVal("EnvVal1")}, "version1"), | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo"), new ConfigurationInfo("c2"), new Dictionary<string, EnvVal>{ ["Env2"] = new EnvVal("EnvVal2")}, "version2"), | ||
true | ||
}; | ||
|
||
yield return new object[] | ||
{ | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo", "{}"), new ConfigurationInfo("c1"), new Dictionary<string, EnvVal>{ ["Env1"] = new EnvVal("EnvVal1")}, "version1"), | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo", "{\"HostConfig\":{\"PortBindings\":{\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"), new ConfigurationInfo("c2"), new Dictionary<string, EnvVal>{ ["Env2"] = new EnvVal("EnvVal2")}, "version2"), | ||
true | ||
}; | ||
|
||
yield return new object[] | ||
{ | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Foo"), null, null), | ||
new EdgeAgentDockerModule("docker", new DockerConfig("Bar"), null, null), | ||
false | ||
}; | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(GetEaModules))] | ||
[Unit] | ||
public void EqualsTest(EdgeAgentDockerModule mod1, EdgeAgentDockerModule mod2, bool areEqual) | ||
{ | ||
// Act | ||
bool result = mod1.Equals(mod2); | ||
|
||
// Assert | ||
Assert.Equal(areEqual, result); | ||
} | ||
} | ||
} |