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

test: add command tests #487

Merged
merged 10 commits into from
Mar 15, 2021
Merged

test: add command tests #487

merged 10 commits into from
Mar 15, 2021

Conversation

zepatrik
Copy link
Member

Related issue

multiple comments from the review

Proposed changes

  1. add tests for some commands
  2. add confirmation question to the migrate commands

@aeneasr aeneasr self-requested a review March 15, 2021 11:37
cmd/migrate/down.go Outdated Show resolved Hide resolved
cmd/migrate/up.go Outdated Show resolved Hide resolved
@@ -130,6 +134,10 @@ func (t *Tree) ToProto() *acl.SubjectTree {

// swagger:ignore
func TreeFromProto(t *acl.SubjectTree) (*Tree, error) {
if t == nil {
return nil, nil
Copy link
Member

Choose a reason for hiding this comment

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

Is passing a nil value here not an error?

Copy link
Member Author

Choose a reason for hiding this comment

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

That depends on whether the expand engine should never return nil. Currently there are two cases:

  1. depth of zero
  2. no such relation tuple exists

But that can be fixed, although I don't think they are an error.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, as long as the code is able to deal with nil trees downstream I think this is fine. Is that tested?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not too much (that's why I found it right now), I will add some more tests.

Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

lgtm from my side

Locally, this resulted in flaky tests as up and down migrations where applied racy.
@zepatrik zepatrik merged commit 61c28e4 into zanzibar Mar 15, 2021
@zepatrik zepatrik deleted the cmd-tests branch March 15, 2021 14:15
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

2 participants