-
Notifications
You must be signed in to change notification settings - Fork 89
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
Connect CA Roots #332
Connect CA Roots #332
Conversation
….cs, added possible test, changed test_config for the test
The only issue I have is with another test case that the Consul in Golang has: https://github.com/hashicorp/consul/blob/v1.9.17/api/connect_ca_test.go#L12 . |
You are right, but we don't have to replicate that test. The test you've already added is sufficient. It tests that the endpoint works and returns desired data. |
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.
Generally, it looks good. Please add more test assertions so we know that all the fields are named correctly.
Consul.Test/AgentTest.cs
Outdated
{ | ||
var caRoots = await _client.Agent.GetCARoots(); | ||
Assert.NotEqual((ulong)0, caRoots.LastIndex); | ||
Assert.Single(caRoots.Response.Roots); | ||
Assert.Equal("11111111-2222-3333-4444-555555555555.consul", caRoots.Response.TrustDomain); |
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.
This test could test all fields in the response (at least for fields being non-null). That would assure us that all fields in the newly added structures are named correctly.
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.
Just added the test assertions, ready for further review!
…ARoots and Root classes
That's what I thought, just had to make sure! :) |
…ov/consuldotnet into G-Research#331-add-connect-ca-roots
@marcin-krystianc I see that a few tests had failed because of an assertion error, expected that a bit, because I wasn't sure which kind of values can SerialNumber, CreateIndex and ModifyIndex take depending on conditions. PrivateKeyBits shouldn't be 0 though. Don't think that there is a way for me to initialize those values in config, except for PrivateKeyBits (https://developer.hashicorp.com/consul/docs/connect/ca/consul). Should I just delete the assert tests for SerialNumber, CreateIndex and ModifyIndex? |
It seem that the problem only occurs for version 1.6.10. So perhaps we can use consuldotnet/Consul.Test/BaseFixture.cs Line 15 in 219ecd4
1.7.0 ?
|
…alNumber of Root class, due to a fail at version 1.6.10
Makes sense, just added that AgentVersion check, can you run the tests @marcin-krystianc ? |
Consul.Test/AgentTest.cs
Outdated
Assert.Null(root.IntermediateCerts); | ||
Assert.True(root.Active); | ||
Assert.NotNull(root.PrivateKeyType); | ||
Assert.NotEqual(0, root.PrivateKeyBits); |
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 think this one needs to go inside the if (AgentVersion >= SemanticVersion.Parse("1.7.0"))
block.
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.
Yes, a bit surprising, but should be working now, fixed it!
…an 1.7.0 The field seems to be initialized to 0 in versions <= 1.7.0, which was causing a testing error
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 think now it is perfect, thank you!
Changes made
Issue ticket number and link