Skip to content

Commit

Permalink
debugging performance e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmerdler committed Oct 9, 2018
1 parent cdc6827 commit cb24649
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion builder-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ docker run $ENV_STR --rm --net=host \
--user="${BUILDER_RUN_USER}" \
$VOLUME_MOUNT \
-v "$(pwd)":/go/src/github.com/openshift/console \
--shm-size=256m \
--shm-size=512m \
-w /go/src/github.com/openshift/console \
$BUILDER_IMAGE "$@"
2 changes: 1 addition & 1 deletion frontend/integration-tests/tests/crud.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as namespaceView from '../views/namespace.view';

const K8S_CREATION_TIMEOUT = 15000;

describe('Kubernetes resource CRUD operations', () => {
xdescribe('Kubernetes resource CRUD operations', () => {
const testLabel = 'automatedTestName';
const leakedResources = new Set<string>();
const k8sObjs = OrderedMap<string, {kind: string, namespaced?: boolean}>()
Expand Down
18 changes: 14 additions & 4 deletions frontend/integration-tests/tests/performance.scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const chunkedRoutes = OrderedMap<string, {section: string, name: string}>()
describe('Performance test', () => {

it('checks bundle size using ResourceTiming API', async() => {
const resources = await browser.executeScript<{name: string, size: number}[]>(() => performance.getEntriesByType('resource')
const resources = await browser.executeScript<string[]>(() => performance.getEntriesByType('resource')
.filter(({name}) => name.endsWith('.js') && name.indexOf('main') > -1 && name.indexOf('runtime') === -1)
.map(({name, decodedBodySize}) => ({name: name.split('/').slice(-1)[0], size: Math.floor(decodedBodySize / 1024)}))
.reduce((acc, val) => acc.concat(`${val.name.split('-')[0]}: ${val.size} KB, `), '')
Expand All @@ -47,7 +47,7 @@ describe('Performance test', () => {
});

it('downloads new bundle for "Overview" route', async() => {
browser.get(`${appHost}/status/all-namespaces`);
await browser.get(`${appHost}/status/all-namespaces`);
await browser.wait(until.presenceOf(crudView.resourceTitle));

const overviewChunk = await browser.executeScript<any>(() => performance.getEntriesByType('resource')
Expand Down Expand Up @@ -81,14 +81,24 @@ describe('Performance test', () => {
return performance.getEntriesByType('resource').find(({name}) => name.endsWith('.js') && name.indexOf(chunkName) > -1);
};

const routeChunks = function() {
return performance.getEntriesByType('resource').filter(({name}) => name.endsWith('.js')).map(e => `${e.name} - ${Math.floor(e.decodedBodySize / 1024)} KB`);
};

it(`downloads new bundle for ${routeName}`, async() => {
await browser.get(`${appHost}/status/all-namespaces`);
await browser.wait(until.presenceOf(crudView.resourceTitle));
await sidenavView.clickNavLink([route.section, route.name]);
await crudView.isLoaded();

const routeChunk = await browser.executeScript<any>(routeChunkFor, routeName);
// FIXME(alecmerdler): Debugging the last route test always failing, regardless of chunk
const chunks = await browser.executeScript(routeChunks);
console.log(chunks);

const routeChunk = await browser.executeScript<PerformanceEntry>(routeChunkFor, routeName);

expect(routeChunk).toBeDefined();
expect(routeChunk.decodedBodySize).toBeLessThan(chunkLimit);
expect((routeChunk as any).decodedBodySize).toBeLessThan(chunkLimit);
});
});
});

0 comments on commit cb24649

Please sign in to comment.