-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add Cluster properties and rename DeploymentId to ClusterId #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
}, | ||
{ | ||
"Id": "WebApp", | ||
"Version": "2.0.0", | ||
"DeploymentIds": [ "MY_DEPLOYMENT_ID" ] | ||
"TargetClusters": [ "MY_DEPLOYMENT_ID" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you update these to MY_CLUSTER_ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
{ | ||
return _apps.Keys; | ||
return (_apps != null ? _apps.GetHashCode() : 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure for what purpose this relevant to override, but are you certain that 2 different sets with the same values will return the same hashcode? or is that not what you want anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll test this a bit more. I generated it the implementation with Resharper. I'd expect that two sets with the same values would have the same hashcode (GetHashCode is supposed to be consistent with Equals) but I'll make sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible could be also EqualityComparer<HashSet<AppDeploymentConfig>.Default.GetHashCode(_apps)
, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdom was right, the default implementation doesn't handle IEnumerable's correctly. I fixed the implementation and added corresponding tests.
@@ -2,7 +2,7 @@ | |||
<package > | |||
<metadata> | |||
<id>Etg.Yams</id> | |||
<version>1.0.14</version> | |||
<version>1.1.0-test</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a lot of references to 1.1.0-test, is that something that you want merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No they should be replaced with the actual nuget version that will be published. I'll clean that up before merging, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with 1.1.0-rc
using Xunit; | ||
using Newtonsoft.Json.Linq; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace Etg.Yams.Test.Storage | ||
{ | ||
public class DeploymentConfigTestFixture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to add coverage for using the new AddApplication
overload that takes a deployment config with properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests added. Found some issues and ended up replacing the internal HashSet with a Dictionary which was more appropriate.
@jdom Please confirm if your comments have been addressed and then I'll merge and publish a NuGet. |
LGTM, ship it :P |
One last change. I made the cluster properties also available as tokens (properties added to the cluster at startup) and fixed a bug in resolving version tokens that was introduced by the switch to SemVersion (version.Patch should be used instead of version.Build). |
Cluster id concatenation is not needed anymore since Yams now supports cluster properties (see PR #34)
This PR addresses issue #33
For a quick overview of the changes in the Api and
DeploymentConfig.json
, take a look at the tests.The new
DeploymentConfig.json
is as follows:DeploymentIds
has been renamed toTargetClusters
and theDeploymentId
token has been renamed toClusterId
. I didn't end up adding the 'Yams' prefix because it was quickly spreading through the code and felt heavy. If that's a major concern we can rename it.Yams will match on properties by default (no need to create a custom matcher). To add properties to the cluster, you can use the
YamsConfigBuilder.AddClusterProperty("Foo", "Bar")
Api as shown in the tests. Only the properties that are added through YamsConfigBuilder will be used by the default matcher (other properties in theDeploymentConfig.json
will be carried over but not used for matching). All properties can be used as token in theAppConfig.json
(${propName}
).I also updated the sample and docs but not all of them. I'm hoping that Orleans guys (@jdom) will be able to help with the Orleans sample and cloud service sample.
Note that some of the Api changes are not backward compatible but should be easy to fix.
Finally, I extracted the
DeploymentConfig
serialization into its own interface so that it can be replaced. This means that you can now easily replace the json representation with whatever you prefer.Let me know what you think!