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

Issue #26: Faulty reloading parsing #105

Merged
merged 21 commits into from
Nov 26, 2019

Conversation

mdimjasevic
Copy link
Contributor

This PR addresses the following question from issue #26 : What happens if at reloading, one rule (out of several) in one domain (out of several) can't be parsed?

Ratelimit keeps the original rules and this PR adds a test to Fencer to confirm it matches the behavior.

I have two remarks:

  • This PR adds a rule reloading test only, and not a server test. A server test would be cumbersome for this as symlinks would have to be manipulated in it and some code from Fencer.Main.main would have to be reimplemented. Given that there is no much benefit in such a server test, I added a rule reloading test only.
  • The branch is based on the mdimjasevic/26-cant-read-file branch. Therefore, please review PR Issue #26: Support handling configuration files without read permissions #102 first.

@mdimjasevic mdimjasevic self-assigned this Nov 15, 2019
@mdimjasevic mdimjasevic changed the title Mdimjasevic/26 faulty reloading parsing Issue #/26: Faulty reloading parsing Nov 15, 2019
@neongreen neongreen changed the title Issue #/26: Faulty reloading parsing Issue #26: Faulty reloading parsing Nov 22, 2019
assertBool "unexpected definitions"
(((==) `on` show)
(sortOn domainDefinitionId <$> result)
(Right $ sortOn domainDefinitionId definitions))

Choose a reason for hiding this comment

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

It's a little hard to read these lines. I'd probably use do-notation, but even just

          assertBool "unexpected definitions" $
            ((==) `on` show)
              (sortOn domainDefinitionId <$> result)
              (Right $ sortOn domainDefinitionId definitions)

is already more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a fair point! I addressed it with lets in an upcoming commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@effectfully: Any remaining issues to be addressed?

Copy link

@effectfully effectfully left a comment

Choose a reason for hiding this comment

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

Looks good.

@mdimjasevic mdimjasevic merged commit e403ff0 into master Nov 26, 2019
@mdimjasevic mdimjasevic deleted the mdimjasevic/26-faulty-reloading-parsing branch November 26, 2019 16:50
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.

2 participants