Skip to content

Commit

Permalink
Test quality metrics and DetailsCard (jaegertracing#577)
Browse files Browse the repository at this point in the history
* Test existing files + CircularProgressbar
* Test QualityMetrics/!index, move & rename Resizer
* Add key to metric details, test QualityMetrics
* Move ExamplesLink&DetailsCard, split&test DC
* Clean up types files
* Clean up types files
* Clean up tests

Signed-off-by: Everett Ross <reverett@uber.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
  • Loading branch information
everett980 committed May 19, 2020
1 parent 993d085 commit 01da88f
Show file tree
Hide file tree
Showing 51 changed files with 3,354 additions and 358 deletions.
6 changes: 3 additions & 3 deletions packages/jaeger-ui/src/api/jaeger.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ const JaegerAPI = {
archiveTrace(id) {
return getJSON(`${this.apiRoot}archive/${id}`, { method: 'POST' });
},
fetchQualityMetrics(service, lookback) {
return getJSON(`/qualitymetrics-v2`, { query: { service, lookback } });
},
fetchDecoration(url) {
return getJSON(url);
},
Expand All @@ -92,6 +89,9 @@ const JaegerAPI = {
fetchDependencies(endTs = new Date().getTime(), lookback = DEFAULT_DEPENDENCY_LOOKBACK) {
return getJSON(`${this.apiRoot}dependencies`, { query: { endTs, lookback } });
},
fetchQualityMetrics(service, lookback) {
return getJSON(`/qualitymetrics-v2`, { query: { service, lookback } });
},
fetchServiceOperations(serviceName) {
return getJSON(`${this.apiRoot}services/${encodeURIComponent(serviceName)}/operations`);
},
Expand Down
20 changes: 20 additions & 0 deletions packages/jaeger-ui/src/api/jaeger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ describe('archiveTrace', () => {
});
});

describe('fetchDecoration', () => {
it('GETs the specified url', () => {
const url = 'foo.bar.baz';
JaegerAPI.fetchDecoration(url);
expect(fetchMock).toHaveBeenLastCalledWith(url, defaultOptions);
});
});

describe('fetchDeepDependencyGraph', () => {
it('GETs the specified query', () => {
const query = { service: 'serviceName', start: 400, end: 800 };
Expand Down Expand Up @@ -81,6 +89,18 @@ describe('fetchDependencies', () => {
});
});

describe('fetchQualityMetrics', () => {
it('GETs the specified service and lookback', () => {
const lookback = '3h';
const service = 'test-service';
JaegerAPI.fetchQualityMetrics(service, lookback);
expect(fetchMock).toHaveBeenLastCalledWith(
`/qualitymetrics-v2?${queryString.stringify({ service, lookback })}`,
defaultOptions
);
});
});

describe('fetchServiceServerOps', () => {
it('GETs the specified query', () => {
const service = 'serviceName';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`JaegerUIApp does not explode 1`] = `
<Provider
store={
Object {
"dispatch": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],
Symbol(observable): [Function],
}
}
>
<ConnectedRouter
history={
Object {
"action": "POP",
"block": [Function],
"createHref": [Function],
"go": [Function],
"goBack": [Function],
"goForward": [Function],
"length": 1,
"listen": [Function],
"location": Object {
"hash": "",
"pathname": "/",
"search": "",
"state": undefined,
},
"push": [Function],
"replace": [Function],
}
}
>
<withRouter(Connect(PageImpl))>
<Switch>
<Route
component={[Function]}
path="/search"
/>
<Route
component={[Function]}
path="/trace/:a?\\\\.\\\\.\\\\.:b?"
/>
<Route
component={[Function]}
path="/trace/:id"
/>
<Route
component={[Function]}
path="/dependencies"
/>
<Route
component={[Function]}
path="/deep-dependencies"
/>
<Route
component={[Function]}
path="/quality-metrics"
/>
<Redirect
exact={true}
path="/"
push={false}
to="/search"
/>
<Redirect
exact={true}
path=""
push={false}
to="/search"
/>
<Redirect
exact={true}
path="/"
push={false}
to="/search"
/>
<Route
component={[Function]}
/>
</Switch>
</withRouter(Connect(PageImpl))>
</ConnectedRouter>
</Provider>
`;
7 changes: 5 additions & 2 deletions packages/jaeger-ui/src/components/App/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { shallow } from 'enzyme';

import JaegerUIApp from './index';

it('JaegerUIApp does not explode', () => {
shallow(<JaegerUIApp />);
describe('JaegerUIApp', () => {
it('does not explode', () => {
const wrapper = shallow(<JaegerUIApp />);
expect(wrapper).toMatchSnapshot();
});
});

This file was deleted.

Loading

0 comments on commit 01da88f

Please sign in to comment.