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

Fix search.maxLimit configuration #533

Merged
merged 3 commits into from
Mar 9, 2020

Conversation

rubenvp8510
Copy link
Collaborator

Signed-off-by: Ruben Vargas [email protected]

Which problem is this PR solving?

Short description of the changes

  • now the getConfigValue is used instead of the default exported getConfig

@rubenvp8510 rubenvp8510 changed the title Fix the way of getting search.maxLimit configuration Fix search.maxLimit configuration Feb 26, 2020
@@ -34,7 +34,7 @@ import * as jaegerApiActions from '../../actions/jaeger-api';
import { formatDate, formatTime } from '../../utils/date';
import reduxFormFieldAdapter from '../../utils/redux-form-field-adapter';
import { DEFAULT_OPERATION, DEFAULT_LIMIT, DEFAULT_LOOKBACK } from '../../constants/search-form';
import getConfigValue from '../../utils/config/get-config';
import { getConfigValue } from '../../utils/config/get-config';
Copy link
Member

Choose a reason for hiding this comment

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

should there be a unit test that would catch this?

Choose a reason for hiding this comment

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

Also, here maybe problem with build, package, dockerize etc. Because I did not see this deleted 37th row, when I am debugging in Chrome. I suggest testing after building into docker.

Copy link
Collaborator Author

@rubenvp8510 rubenvp8510 Feb 26, 2020

Choose a reason for hiding this comment

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

I'll add tests. not sure why this is not in the docker image, may be an issue related too the release and dockerization.

Copy link
Member

Choose a reason for hiding this comment

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

Docker image contains JS transpiled to ES5. I'd assume the code to look very different there (also minified).

Choose a reason for hiding this comment

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

image
screenshot from chrome devtools.

@codecov
Copy link

codecov bot commented Feb 26, 2020

Codecov Report

Merging #533 into master will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #533      +/-   ##
==========================================
+ Coverage   92.95%   92.97%   +0.02%     
==========================================
  Files         197      197              
  Lines        4840     4840              
  Branches     1174     1174              
==========================================
+ Hits         4499     4500       +1     
+ Misses        301      300       -1     
  Partials       40       40
Impacted Files Coverage Δ
...er-ui/src/components/SearchTracePage/SearchForm.js 89.07% <ø> (ø) ⬆️
...eViewer/TimelineHeaderRow/TimelineViewingLayer.tsx 91.52% <0%> (+1.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0882bde...771c4d0. Read the comment docs.

@rubenvp8510
Copy link
Collaborator Author

Tests added.

@@ -392,6 +392,19 @@ describe('<SearchForm>', () => {
btn = wrapper.find(`[data-test="${markers.SUBMIT_BTN}"]`);
expect(btn.prop('disabled')).toBeTruthy();
});

it('uses config.search.maxLimit', () => {
const maxLimit = Math.floor(Math.random() * 7000) + 3000;
Copy link
Member

Choose a reason for hiding this comment

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

a fixed constant would do just as well, e.g. 1234 (unlikely to be the default value elsewhere)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I'll use a constant.

window.getJaegerUiConfig = jest.fn(() => config);
wrapper = shallow(<SearchForm {...defaultProps} selectedService="svcA" />);
const field = wrapper.find(`Field[name="resultsLimit"]`);
expect(field.prop('props').max).toEqual(maxLimit);
Copy link
Member

Choose a reason for hiding this comment

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

did you confirm that this test breaks without the fix above?

Copy link
Collaborator Author

@rubenvp8510 rubenvp8510 Feb 27, 2020

Choose a reason for hiding this comment

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

Yes

Without this fix:

Error: expect(received).toEqual(expected)

Expected value to equal:
  4854
Received:
 {"archiveEnabled": false, "dependencies": {"dagMaxNumServices": 100, "menuEnabled": true}, "linkPatterns": [], "menu": [{"items": [{"label": "GitHub", "url": "https://github.com/uber/jaeger"}, {"label": "Docs", "url": "http://jaeger.readthedocs.io/en/latest/"}, {"label": "Twitter", "url": "https://twitter.com/JaegerTracing"}, {"label": "Discussion Group", "url": "https://groups.google.com/forum/#!forum/jaeger-tracing"}, {"label": "Gitter.im", "url": "https://gitter.im/jaegertracing/Lobby"}, {"label": "Blog", "url": "https://medium.com/jaegertracing/"}], "label": "About Jaeger"}], "search": {"maxLimit": 4854, "maxLookback": {"label": "2 Days", "value": "2d"}}, "tracking": {"gaID": null, "trackErrors": true}}

@pavolloffay
Copy link
Member

@rubenvp8510 is this ready to be merged?

@yurishkuro can this be merged so 1.17.1 can be released?

@rubenvp8510
Copy link
Collaborator Author

@pavolloffay if there is no more comments, is ready.

@yurishkuro yurishkuro merged commit f158a12 into jaegertracing:master Mar 9, 2020
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
* Fix the way of getting search.maxLimit configuration

Signed-off-by: Ruben Vargas <[email protected]>

* Add tests for srarch.maxLimit configuration

Signed-off-by: Ruben Vargas <[email protected]>

Co-authored-by: Yuri Shkuro <[email protected]>
Signed-off-by: vvvprabhakar <[email protected]>
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.

search.maxLimit is not working in UI
4 participants