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

[IMPROVED] Make error actionable when adding operator+leafnodes #2449

Merged
merged 1 commit into from Aug 18, 2021

Conversation

alsuren
Copy link
Contributor

@alsuren alsuren commented Aug 17, 2021

There are many examples in the documentation for one half of this configuration or the other,
but none which configure a leafnode remote on an operator-authenticated cluster.

The error "operator mode requires account nkeys in remotes." is not very clear or actionable.
It was only chance googling that led us to nats-io/k8s#286 and gave us a hint about what we needed to do.

  • Build is green in Travis CI
  • You have certified that the contribution is your original work and that you license the work to the project under the Apache 2 license

/cc @nats-io/core

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

Reporting what staticcheck says:

server/leafnode.go:279:12: error strings should not end with punctuation or a newline (ST1005)

But more importantly, I wonder if instead of doing that, we should not make use of what @ripienaar has been introducing with errors. Should we start (in cases like that) have codes for non JetStream errors and keep adding to it when users report less than descriptive errors?
If so, R.I., would you mind showing us what it would take here to add a new error, etc..?

@ripienaar
Copy link
Contributor

You're right this is a good case where if we had those errors outside of JetStream would have been useful, but we are not really ready for that yet - the current work is very JS orientated and I think we're still gathering feedback on how they are to use before we consider moving them into the more senstive parts of things.

@kozlovic
Copy link
Member

@alsuren Ok, so based on RI response, I would suggest that you remove the terminal punctuation, otherwise staticcheck would reject this code change.

@alsuren alsuren force-pushed the patch-1 branch 2 times, most recently from c4baea1 to 28c53be Compare August 18, 2021 15:58
@alsuren
Copy link
Contributor Author

alsuren commented Aug 18, 2021

Hi. Sorry for the delay. Pushed.

=== RUN   TestJetStreamMaxMsgsPerAndDiscardNew/Memory
    jetstream_test.go:11193: Unexpected error: context deadline exceeded
--- FAIL: TestJetStreamMaxMsgsPerAndDiscardNew (11.98s)
    --- PASS: TestJetStreamMaxMsgsPerAndDiscardNew/File (0.68s)
    --- FAIL: TestJetStreamMaxMsgsPerAndDiscardNew/Memory (11.30s)

This feels unrelated, and passes locally. Is this test known to be flakey?

@alsuren alsuren marked this pull request as ready for review August 18, 2021 16:23
@kozlovic
Copy link
Member

That one yes, but maybe not this one. Please check if this test is not checking for the error that you have now changed.

=== RUN   TestLeafNodeOperatorBadCfg/operator_mode_requires_account_nkeys_in_remotes
    leafnode_test.go:2512: Expected error operator mode requires account nkeys in remotes but got operator mode requires account nkeys in remotes. Please add an `account` key to each remote in your `leafnodes` section, to assign it to an account. Each account value should be a 56 character public key, starting with the letter 'A'
--- FAIL: TestLeafNodeOperatorBadCfg (0.00s)
    --- PASS: TestLeafNodeOperatorBadCfg/operator_mode_does_not_allow_specifying_user_in_leafnode_config (0.00s)
    --- PASS: TestLeafNodeOperatorBadCfg/operator_mode_and_non_account_nkeys_are_incompatible (0.00s)
    --- FAIL: TestLeafNodeOperatorBadCfg/operator_mode_requires_account_nkeys_in_remotes (0.00s)

There are many examples in the documentation for one half of this configuration or the other,
but none which configure a leafnode remote on an operator-authenticated cluster.

The error "operator mode requires account nkeys in remotes." is not very clear or actionable.
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

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

LGTM

@kozlovic kozlovic changed the title make error actionable when adding operator+leafnodes [IMPROVED] Make error actionable when adding operator+leafnodes Aug 18, 2021
@kozlovic kozlovic merged commit f8d503f into nats-io:main Aug 18, 2021
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.

None yet

3 participants