Skip to content

Commit

Permalink
Merge pull request #537 from OpenFn/simplify-version-reporting
Browse files Browse the repository at this point in the history
Simplify version reporting
  • Loading branch information
josephjclark authored Dec 8, 2023
2 parents c0705e2 + caeea15 commit 60f19c8
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
7 changes: 7 additions & 0 deletions integration-tests/worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @openfn/integration-tests-worker

## 1.0.25

### Patch Changes

- Updated dependencies
- @openfn/ws-worker@0.3.1

## 1.0.24

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/worker/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openfn/integration-tests-worker",
"private": true,
"version": "1.0.24",
"version": "1.0.25",
"description": "Lightning WOrker integration tests",
"author": "Open Function Group <[email protected]>",
"license": "ISC",
Expand Down
6 changes: 6 additions & 0 deletions packages/ws-worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ws-worker

## 0.3.1

### Patch Changes

- Don't log compiler and runtime version logs

## 0.3.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ws-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/ws-worker",
"version": "0.3.0",
"version": "0.3.1",
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
"main": "dist/index.js",
"type": "module",
Expand Down
8 changes: 5 additions & 3 deletions packages/ws-worker/src/util/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ export default (runId: string, versions: Versions, adaptor?: string) => {
let str = `Versions for run ${runId}:
${prefix('node.js')}${versions.node || 'unknown'}
${prefix('worker')}${versions.worker || 'unknown'}
${prefix('engine')}${versions.engine || 'unknown'}
${prefix('runtime')}${versions.runtime || 'unknown'}
${prefix('compiler')}${versions.compiler || 'unknown'}`;
${prefix('engine')}${versions.engine || 'unknown'}`;

// Unfortunately the runtime and compiler versions get reported as workspace:* in prod right now
// ${prefix('runtime')}${versions.runtime || 'unknown'}
// ${prefix('compiler')}${versions.compiler || 'unknown'}`;

if (Object.keys(adaptors).length) {
let allAdaptors = Object.keys(adaptors);
Expand Down
2 changes: 1 addition & 1 deletion packages/ws-worker/test/events/run-start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,5 @@ test('also logs the version number', async (t) => {
t.log(message);
// This just a light test of the string to make sure it's here
// It uses src/util/versions, which is tested elsewhere
t.regex(message, /(node\.js).+(worker).+(engine).+(compiler)/is);
t.regex(message, /(node\.js).+(worker).+(engine)/is);
});
20 changes: 7 additions & 13 deletions packages/ws-worker/test/util/versions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import calculateVersionString from '../../src/util/versions';
// keys in this obejct are scrambled on purpose
const versions = {
worker: '2',
compiler: '5',
// compiler: '5',
node: '1',
engine: '3',
runtime: '4',
// runtime: '4',
};

// Util function to parse a version string into something easier to test
Expand All @@ -35,9 +35,7 @@ test('calculate version string', (t) => {
`Versions for run run-1:
▸ node.js 1
▸ worker 2
▸ engine 3
▸ runtime 4
▸ compiler 5`
▸ engine 3`
);
});

Expand All @@ -49,8 +47,6 @@ test('helper should parse a version string and return the correct order', (t) =>
['node.js', '1'],
['worker', '2'],
['engine', '3'],
['runtime', '4'],
['compiler', '5'],
]);
});

Expand All @@ -63,8 +59,6 @@ test("show unknown if a version isn't passed", (t) => {
['node.js', 'unknown'],
['worker', 'unknown'],
['engine', 'unknown'],
['runtime', 'unknown'],
['compiler', 'unknown'],
]);
});

Expand All @@ -75,7 +69,7 @@ test('show adaptors last', (t) => {
});

const parsed = parse(str);
const common = parsed[5];
const common = parsed[3];
t.deepEqual(common, ['@openfn/language-common', '1.0.0']);
});

Expand All @@ -89,9 +83,9 @@ test('sort and list multiple adaptors', (t) => {

const parsed = parse(str);

const a = parsed[5];
const j = parsed[6];
const z = parsed[7];
const a = parsed[3];
const j = parsed[4];
const z = parsed[5];

t.deepEqual(a, ['a', '1']);
t.deepEqual(j, ['j', '2']);
Expand Down

0 comments on commit 60f19c8

Please sign in to comment.