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 case for retained message on negated subsciption bug #227

Merged
merged 4 commits into from
Feb 1, 2019

Conversation

GavinDmello
Copy link
Collaborator

Hey @mcollina
This PR includes a failing test case for the bug mentioned in #200

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

Would you like to attempt a fix?

} else {
t.pass('Message not received')
}
}, 1000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you reduce this timer? Is there another test without a timer?

var s = connect(setup(broker))
var receivedPacket = null
s.outStream.once('data', function (packet) {
receivedPacket = packet
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can just call t.fail() here.

Copy link
Collaborator Author

@GavinDmello GavinDmello Jan 21, 2019

Choose a reason for hiding this comment

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

The test process would not exit using this approach as t.fail() will never be called(once we fix the issue) and the plan takes 3 assertions.

@GavinDmello
Copy link
Collaborator Author

@mcollina I've reduced the timer for now. Let me know if you have a better way.
I'll try to suggest a fix till then.

@GavinDmello
Copy link
Collaborator Author

GavinDmello commented Jan 27, 2019

I noticed that we were calling addSubscription as well, which should not happen. Right now the fix has redundant checks in every series function which does not look good. Maybe we could break out of the series in this case ?

@mcollina
Copy link
Collaborator

I noticed that we were calling addSubscription as well, which should not happen. Right now the fix has redundant checks in every series function which does not look good. Maybe we could break out of the series in this case ?

I don't understand. However, +1 to the change.

@GavinDmello
Copy link
Collaborator Author

There are redundant null checks in every series function with my approach. For eg https://github.com/mcollina/aedes/blob/0ea4a0c324f027165c2c2f834f943e08b018d89f/lib/handlers/subscribe.js#L68-L71 and https://github.com/mcollina/aedes/blob/0ea4a0c324f027165c2c2f834f943e08b018d89f/lib/handlers/subscribe.js#L97-L99. Ideally, I would have a check in the first series function and then complete the series somehow.

Anyway, we could merge this now and optimize later if required. 👍

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