Skip to content

Commit

Permalink
More logging, again. :(
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneseymour committed Sep 3, 2020
1 parent 095ed32 commit 0b03baa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import expect from '@kbn/expect';
import { ciRunUrl, coveredFilePath, itemizeVcs, prokPrevious, teamAssignment } from '../transforms';
import { ToolingLog } from '@kbn/dev-utils';

describe(`Transform fn`, () => {
describe(`ciRunUrl`, () => {
Expand Down Expand Up @@ -93,11 +94,15 @@ x-pack/plugins/reporting/server/browsers/extract/index.js kibana-reporting
x-pack/plugins/reporting/server/browsers/extract/unzip.js kibana-reporting
x-pack/plugins/reporting/server/browsers/index.ts kibana-reporting
x-pack/plugins/reporting/server/browsers/install.ts kibana-reporting`;
const log = new ToolingLog({
level: 'info',
writeTo: process.stdout,
});

describe(`with a coveredFilePath of ${coveredFilePath}`, () => {
const expected = 'kibana-reporting';
it(`should resolve to ${expected}`, () => {
const actual = teamAssignment(getData)(teamAssignmentsPath)(obj);
const actual = teamAssignment(getData)(teamAssignmentsPath)(log)(obj);
const { team } = actual;
expect(team).to.eql(expected);
});
Expand Down
4 changes: 2 additions & 2 deletions src/dev/code_coverage/ingest_coverage/ingest.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const { Client } = require('@elastic/elasticsearch');
import { createFailError } from '@kbn/dev-utils';
import { RESEARCH_CI_JOB_NAME } from './constants';
import { errMsg, redact, whichIndex } from './ingest_helpers';
import { pretty, green, pink } from './utils';
import { pretty, green } from './utils';
import { right, left } from './either';

const node = process.env.ES_HOST || 'http://localhost:9200';
Expand Down Expand Up @@ -75,7 +75,7 @@ const sendMsg = (actuallySent, redactedEsHostUrl, payload) => {
return `### ${actuallySent ? 'Sent' : 'Fake Sent'}:
${redactedEsHostUrl ? `\t### ES Host: ${redactedEsHostUrl}` : ''}
\t### Index: ${green(index)}
\t### payload.body: ${pink(body)}
\t### payload.body: ${body}
`;
};

Expand Down
2 changes: 1 addition & 1 deletion src/dev/code_coverage/ingest_coverage/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const addTestRunnerAndStaticSiteUrl = pipe(testRunner, staticSite(staticSiteUrlB
const transform = (jsonSummaryPath) => (log) => (vcsInfo) => (teamAssignmentsPath) => {
const objStream = jsonStream(jsonSummaryPath).on('done', noop);
const itemizeVcsInfo = itemizeVcs(vcsInfo);
const assignTeams = teamAssignment(getData)(teamAssignmentsPath);
const assignTeams = teamAssignment(getData)(teamAssignmentsPath)(log);

const jsonSummary$ = (_) => objStream.on('node', '!.*', _);

Expand Down
7 changes: 5 additions & 2 deletions src/dev/code_coverage/ingest_coverage/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import * as Either from './either';
import * as Maybe from './maybe';
import { always, id, noop } from './utils';
import { always, id, noop, pink } from './utils';

const maybeTotal = (x) => (x === 'total' ? Either.left(x) : Either.right(x));

Expand Down Expand Up @@ -102,8 +102,11 @@ const assign = (getData) => (teamAssignmentsPath) => (x) =>
.match(new RegExp(`${x}.*$`, 'gm'))[0]
.match(/.+\s{1,3}(.+)$/, 'gm')[1];

export const teamAssignment = (getData) => (teamAssignmentsPath) => (obj) => {
export const teamAssignment = (getData) => (teamAssignmentsPath) => (log) => (obj) => {
const { coveredFilePath } = obj;

log.debug(`\n### Team Assignment - coveredFilePath: \n\t${pink(coveredFilePath)}\n`);

const assignTeams = assign(getData)(teamAssignmentsPath);

return Either.fromNullable(obj.isTotal).isRight()
Expand Down

0 comments on commit 0b03baa

Please sign in to comment.