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

[sdk#809] Refresh should not happen after failed request #1017

Merged

Conversation

Bolodya1997
Copy link

Description

Disable refresh if request fails.

Issue link

#809

How Has This Been Tested?

  • Added unit testing to cover
  • Tested manually
  • Tested by integration testing
  • Have not tested

Types of changes

  • Bug fix
  • New functionallity
  • Documentation
  • Refactoring
  • CI

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
})
require.Error(t, err)

goleak.VerifyNone(t)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this?

Suggested change
goleak.VerifyNone(t)

Copy link
Author

Choose a reason for hiding this comment

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

To validate that there is no pending refresh action.

Copy link
Member

@denis-tingaikin denis-tingaikin Jul 13, 2021

Choose a reason for hiding this comment

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

I don't quite follow we already have the check on cleaning at line 273

Copy link
Member

Choose a reason for hiding this comment

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

@Bolodya1997 Could you please explain this line?

Copy link
Author

Choose a reason for hiding this comment

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

It is not the same, because [1] check we are making after the test context cancel.
We can remove [1], but with it test looks more consistent.

Copy link
Member

Choose a reason for hiding this comment

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

Can we use clockmock instead of an additional goleak call?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, fixed.

@denis-tingaikin denis-tingaikin self-requested a review July 13, 2021 13:37
@@ -267,3 +268,24 @@ func TestRefreshClient_Sandbox(t *testing.T) {
return refreshSrv.getState() == testRefreshStateDoneRequest
}, sandboxTotalTimeout, sandboxStepDuration)
}

func TestRefreshClient_NoRefreshOnFailure(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

It seems to me this test is incorrect due to there are no expire time in request.

  1. Please add expiration time and use clockmock to check that there are no new requests after getting an error on the request.
  2. Please add test for Close use-case. As I can see you've added a major return statement at pkg/networkservice/common/refresh/client.go:133. So this scenario should be covered.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, added.

Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
@denis-tingaikin denis-tingaikin merged commit f36729d into networkservicemesh:main Jul 14, 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.

3 participants