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

feat: introduce Namespace #229

Merged
merged 32 commits into from
Aug 31, 2023
Merged

feat: introduce Namespace #229

merged 32 commits into from
Aug 31, 2023

Conversation

winstxnhdw
Copy link
Contributor

@winstxnhdw winstxnhdw commented Jul 31, 2023

  • Add v1.7 Enterprise-only Namespace
  • Add unit tests for Namespace
  • Apply lint suggestions
  • Update documentation pertaining to Namespace
  • Make EnterpriseOnlyFact skippable
  • Closes Registering a service in a namespace #117

Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

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

Changes seem to be ok but it would be great if we have a test that makes sure that separation with namespaces actually works.

Consul/Client_Options.cs Show resolved Hide resolved
Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

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

Changes seem to be ok but it would be great if we have a test that makes sure that separation with namespaces actually works.

Consul/Client_Options.cs Outdated Show resolved Hide resolved
Consul/Client.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

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

Changes for the "namespace" feature are hard to spot due to many changes suggested by linter. I suggest moving the linter-induced changes to a new PR, so we can review it separately.

@winstxnhdw
Copy link
Contributor Author

Tests still fail for Consul version >= 1.10 because enterprise is not supported. Any suggestions on how we can skip these tests?

@marcin-krystianc
Copy link
Contributor

Tests still fail for Consul version >= 1.10 because enterprise is not supported. Any suggestions on how we can skip these tests?

Look at the Operator_GetLicense test.

@winstxnhdw
Copy link
Contributor Author

Look at the Operator_GetLicense test.

Hmm.. It still fails for <1.7

Shall I create a new attribute SkippableEnterpriseOnlyFact?

@marcin-krystianc
Copy link
Contributor

I think you also need to combine two checks:

  • a version, because it is 1.7+ version feature (Skip.If(AgentVersion < SemanticVersion.Parse("1.7.0"), $"...");
  • and whether to execute enterprise tests (SkippableEnterpriseOnlyFact)

I'm not sure, but I don't think it is necessary to implement a new attribute to achieve that.

@winstxnhdw
Copy link
Contributor Author

Currently I don’t think that EnterpriseOnlyFact is skippable.

@winstxnhdw
Copy link
Contributor Author

winstxnhdw commented Aug 29, 2023

Yup, just tested. We do need to create a new attribute. For now, I'll just make EnterpriseOnlyFact skippable instead.

Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

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

The changes look good, just left a few minor comments. I think it would be nice also to write a test that would exercise the namespaces feature in a way that is not yet presented in this PR. For example, we could use KV store (https://developer.hashicorp.com/consul/commands/kv) to show that it is possible to store values in different namespaces and assert that they are not visible to each other.

Consul.Test/NamespaceTest.cs Outdated Show resolved Hide resolved
{
public string Name { get; set; }

public string Description { get; set; } = "";
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'm not sure about this default initialization. Was it causing any trouble when it was null by default? Is there any benefit?

Copy link
Contributor Author

@winstxnhdw winstxnhdw Aug 30, 2023

Choose a reason for hiding this comment

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

It doesn't seem to cause any trouble when it is null but the Consul server expects an empty string and I am not sure if it could cause unforeseen effects otherwise. See here.

docs/docs/2-guides/1-basic-usage.mdx Show resolved Hide resolved
docs/docs/2-guides/3-supported-apis.mdx Show resolved Hide resolved
Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

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

Thank you for this amazing work. There is just single formatting issue remaining, apart from that all looks really good. Well done 🏆

Consul/Client.cs Outdated Show resolved Hide resolved
Consul/Client.cs Show resolved Hide resolved
@marcin-krystianc marcin-krystianc merged commit 16419e9 into G-Research:master Aug 31, 2023
147 checks passed
@winstxnhdw winstxnhdw deleted the namespace branch August 31, 2023 12:34
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.

Registering a service in a namespace
3 participants