Skip to content

Commit

Permalink
Merge pull request #3443 from terascope/node-18-e2e-fixes
Browse files Browse the repository at this point in the history
re-enable node 18 tests, remove node 14 tests
  • Loading branch information
godber authored Oct 23, 2023
2 parents 3300119 + a693502 commit fa92728
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 33 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/publish-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# node-version: [14.21.3, 16.19.1, 18.16.0]
node-version: [14.21.3, 16.19.1]
node-version: [16.19.1, 18.16.0]
steps:
# we login to docker to publish new teraslice image
- name: Login to Docker Hub
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14.21.3
node-version: 18.16.0
cache: 'yarn'

- name: Install and build packages
Expand All @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.21.3, 16.19.1, 18.16.0]
node-version: [16.19.1, 18.16.0]
steps:
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -57,7 +57,7 @@ jobs:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: [14.21.3, 16.19.1, 18.16.0]
node-version: [16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: [14.21.3, 16.19.1, 18.16.0]
node-version: [16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14.21.3
node-version: 18.16.0
cache: 'yarn'

# we login to docker to avoid docker pull limit rates
Expand All @@ -154,7 +154,7 @@ jobs:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
node-version: [14.21.3, 16.19.1, 18.16.0]
node-version: [16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 14.21.3
node-version: 18.16.0
cache: 'yarn'

# we login to docker to avoid docker pull limit rates
Expand All @@ -218,10 +218,7 @@ jobs:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
# temporarily remove node18 from the e2e tests since they fail, see:
# https://github.com/terascope/teraslice/issues/3434
# node-version: [14.21.3, 16.19.1, 18.16.0]
node-version: [14.21.3, 16.19.1]
node-version: [16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NODE_VERSION is set by default in the config.ts, the following value will only
# be used if you build images by default with docker build
ARG NODE_VERSION=14.21.3
ARG NODE_VERSION=18.16.0
FROM terascope/node-base:${NODE_VERSION}

ENV NODE_ENV production
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "teraslice-workspace",
"displayName": "Teraslice",
"version": "0.86.5",
"version": "0.87.0",
"private": true,
"homepage": "https://github.com/terascope/teraslice",
"bugs": {
Expand Down Expand Up @@ -87,7 +87,7 @@
"registry": "https://registry.npmjs.org/"
},
"engines": {
"node": ">=14.17.0",
"node": ">=16.19.0",
"yarn": ">=1.22.19"
},
"version": 1
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { rules, overrides } = require('./lib');
module.exports = {
extends: ['airbnb-base'],
parserOptions: {
ecmaVersion: 2019,
ecmaVersion: 'latest',
sourceType: 'script',
},
env: {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@terascope/eslint-config",
"displayName": "Terascope ESLint Config",
"version": "0.7.1",
"version": "0.8.0",
"description": "A shared eslint config based on eslint-config-airbnb",
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/eslint-config#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/test/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('ESLint Config Index', () => {
it('should export js parserOptions by default', () => {
expect(Index).toHaveProperty('parserOptions');
expect(Index.parserOptions).toMatchObject({
ecmaVersion: 2019,
ecmaVersion: 'latest',
sourceType: 'script',
},);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@terascope/scripts",
"displayName": "Scripts",
"version": "0.59.0",
"version": "0.60.0",
"description": "A collection of terascope monorepo scripts",
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/scripts#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ export const SEARCH_TEST_HOST = testHost;
// This should match a node version from the base-docker-image repo:
// https://github.com/terascope/base-docker-image
// This overrides the value in the Dockerfile
export const NODE_VERSION = process.env.NODE_VERSION || '14.21.3';
export const NODE_VERSION = process.env.NODE_VERSION || '18.16.0';
22 changes: 14 additions & 8 deletions packages/teraslice/lib/cluster/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

const { Router } = require('express');
const bodyParser = require('body-parser');
const stream = require('stream');
const { promisify } = require('util');
const got = require('got');
const { pipeline: streamPipeline } = require('node:stream/promises');
const { RecoveryCleanupType } = require('@terascope/job-components');
const {
parseErrorInfo, parseList, logError, TSError, startsWith
Expand All @@ -20,7 +18,14 @@ const {
} = require('../../utils/api_utils');
const terasliceVersion = require('../../../package.json').version;

const pStreamPipeline = promisify(stream.pipeline);
let gotESMModule;

async function getGotESM() {
if (gotESMModule) return gotESMModule;
const module = await import('gotESM'); // eslint-disable-line
gotESMModule = module.default;
return module.default;
}

module.exports = function apiService(context, { assetsUrl, app }) {
const clusterConfig = context.sysconfig.teraslice;
Expand Down Expand Up @@ -488,23 +493,24 @@ module.exports = function apiService(context, { assetsUrl, app }) {
}

async function _redirect(req, res) {
const module = await getGotESM();
const options = {
prefixUrl: assetsUrl,
headers: req.headers,
searchParams: req.query,
throwHttpErrors: false,
timeout: clusterConfig.api_response_timeout,
timeout: { request: clusterConfig.api_response_timeout },
decompress: false,
retry: 0
retry: { limit: 0 }
};

const uri = req.url.replace(/^\//, '');
const method = req.method.toLowerCase();

try {
await pStreamPipeline(
await streamPipeline(
req,
got.stream[method](uri, options),
module.stream[method](uri, options),
res,
);
} catch (err) {
Expand Down
3 changes: 2 additions & 1 deletion packages/teraslice/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "teraslice",
"displayName": "Teraslice",
"version": "0.86.5",
"version": "0.87.0",
"description": "Distributed computing platform for processing JSON data",
"homepage": "https://github.com/terascope/teraslice#readme",
"bugs": {
Expand Down Expand Up @@ -56,6 +56,7 @@
"fs-extra": "^11.1.1",
"gc-stats": "^1.4.0",
"got": "^11.8.3",
"gotESM": "npm:got@^13.0.0",
"ip": "^1.1.8",
"kubernetes-client": "^9.0.0",
"lodash": "^4.17.21",
Expand Down
Loading

0 comments on commit fa92728

Please sign in to comment.