-
Notifications
You must be signed in to change notification settings - Fork 251
Handle 404 from Scuba backend #5968
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
base: development/9.1
Are you sure you want to change the base?
Conversation
For Veeam reoutes, this will set 0 as the metric. The value is correct: if scuba returns a 404 error, it means there is no metric for the resource. Issue: CLDSRV-758
Hello williamlardier,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
... and 1 file with indirect coverage changes @@ Coverage Diff @@
## development/9.1 #5968 +/- ##
===================================================
+ Coverage 83.72% 84.00% +0.27%
===================================================
Files 191 191
Lines 12233 12238 +5
===================================================
+ Hits 10242 10280 +38
+ Misses 1991 1958 -33
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
it('GET capacity.xml should return 200 when scubaclient returns 404 (post-install scenario)', done => { | ||
// This test simulates the post-install scenario where scubaclient returns 404 | ||
// because no metrics are available yet. By not calling scuba.incrementBytesForBucket, | ||
// the mock scuba server will return 404 for this bucket. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do something to make sure it's the case ? My point is that if someone change the mock server, this test will continue to pass 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already tracked by this ticket: https://scality.atlassian.net/browse/CLDSRV-528
A bit too early to add scuba yet, we need to drop count items first
// This test reproduces the post-install scenario where scubaclient returns 404 | ||
// because no metrics are available yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's very pertinent to put it here. You describe this case already in the lib
. If we want to know why we have this case, we can check the code already.
|
||
getVeeamFile(request, response, bucketMd, log); | ||
|
||
// Give async callback time to execute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you use this logic in each test, we can create a function const giveAsyncCallbackTimeToExecute = setImmediate
and the in the test
giveAsyncCallbackTimeToExecute(() => {
...
});
Like that your logic will be clean in each tests
getVeeamFile(request, response, bucketMd, log); | ||
|
||
setImmediate(() => { | ||
// For 500 errors, we should return error to client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// For 500 errors, we should return error to client |
You already mention that in the it
getVeeamFile(request, response, bucketMd, log); | ||
|
||
setImmediate(() => { | ||
// For connection errors, we should return error to client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
getVeeamFile(request, response, bucketMd, log); | ||
|
||
setImmediate(() => { | ||
// Metadata errors are returned via responseXMLBody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Metadata errors are returned via responseXMLBody |
listVeeamFiles(request, response, null, log); | ||
|
||
setImmediate(() => { | ||
// Should return NoSuchBucket error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not asserted?
}); | ||
}); | ||
|
||
it('GET system.xml should return 200 even when scubaclient is down', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this new test is not directly related to the issue, right ?
It's just testing the logic in veeam/get.js that is not using scuba because of the !isSystemXML(request)
right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing much to add from Edouard's review, I still very much prefer functional tests over mocks, and I find mocks hard to read, but it's better than nothing
Nits : some variables could be replaced by constants in veeam-route.js : 'test-bucket', 'getBucket'.
I also prefer to not use default parameter for the object key in createRequest, but not very important
Co-authored-by: Edouard COMTET <edouard.comtet@gmail.com>
For Veeam reoutes, this will set 0 as the metric. The value is correct: if scuba returns a 404 error, it means there is no metric for the resource.
Issue: CLDSRV-758