Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed workspaces issues #1266

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions currencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
{
"name": "@elastic/elasticsearch",
"policy": "45-days",
"versions": ["7.9.0", "7.17.0", "8.15.0"],
Copy link
Contributor Author

@kirrg001 kirrg001 Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"versions": ">= 7"
"versions": ">= 7, 8.15.0"

testUtils.getVersions(versions, nameOfTheLib)
[latest7, latest8, latest9]

What is the currency bot doing?

  • Major updates?
  • Visibility: we want to know if a minor versions comes out and we are able to check the features
  • Visibility: on what is tested

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"versions": ">= 7"

If we use this notation in the currencies.json, we need to initially generate the currencies.json the following:

{
   "name": "@elastic/elasticsearch",
   "supportedVersions": ">= 7"
   "testedVersions": ["7.9.0", "8.15.0"]
   ...

In the test we use:

CURRENCY.testedVersions.forEach(...)

The currency bot in the night still runs a major and minor update check. If there is a new version, a PR is created for the currencies.json diff.

e.g. for major:

{
   "name": "@elastic/elasticsearch",
   "supportedVersions": ">= 7"
   "testedVersions": ["7.9.0", "8.15.0", "9.0.0"]
   ...

e.g. for minor

{
   "name": "@elastic/elasticsearch",
   "supportedVersions": ">= 7"
   "testedVersions": ["7.9.0", "8.16.0"]
   ...

This gives us visibility.
As soon as we merge the PR for the currencies.json, the testedVersions array is updated and the tests run against v9 or 8.16.0 or whatever.

"supportedVersions": ">= 7"

This can be publicly displayed and is the base how to generate the testedVersions array.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, this is a great approach!

"lastSupportedVersion": "",
"latestVersion": "",
"cloudNative": false,
Expand Down
155 changes: 6 additions & 149 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@
"@azure/storage-blob": "^12.24.0",
"@commitlint/cli": "^14.1.0",
"@commitlint/config-conventional": "^14.1.0",
"@elastic/elasticsearch": "^8.15.0",
"@elastic/elasticsearch-v7.17.0": "npm:@elastic/elasticsearch@^7.17.0",
"@elastic/elasticsearch-v7.9.0": "npm:@elastic/[email protected]",
"@google-cloud/pubsub": "^4.7.0",
"@google-cloud/storage": "^7.12.1",
"@grpc/grpc-js": "^1.11.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/collector/test/initEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ Object.keys(DEFAULT_ENV_VALUES).forEach(key => {
process.env[key] = DEFAULT_ENV_VALUES[key];
}
});

const currencies = require('../../../currencies.json');
const currenciesObj = {};

currencies.forEach(currency => {
currenciesObj[currency.name] = currency;
});

global.CURRENCIES = currenciesObj;
17 changes: 17 additions & 0 deletions packages/collector/test/test_util/ProcessControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const http2Promise = require('./http2Promise');
const testUtils = require('../../../core/test/test_util');
const globalAgent = require('../globalAgent');
const portFinder = require('./portfinder');
const { execSync } = require('child_process');
const sslDir = path.join(__dirname, '..', 'apps', 'ssl');
const cert = fs.readFileSync(path.join(sslDir, 'cert'));
const isLatestEsmSupportedVersion = require('@instana/core').tracing.isLatestEsmSupportedVersion;
Expand Down Expand Up @@ -156,6 +157,22 @@ class ProcessControls {
forkConfig.execArgv = this.execArgv;
}

if (this.env.CURRENCY_NAME && this.env.CURRENCY_VERSION) {
const installationDir = path.dirname(this.appPath);

// eslint-disable-next-line no-console
console.log(
`Installing currency package ${this.env.CURRENCY_NAME}@${this.env.CURRENCY_VERSION} in ${installationDir}`
);

await execSync(
`npm install ${this.env.CURRENCY_NAME}@${this.env.CURRENCY_VERSION} --prefix ${installationDir} --no-audit --no-package-lock --no-save`
);

// eslint-disable-next-line no-console
console.log('Currency package installed');
}

this.process = this.args ? fork(this.appPath, this.args || [], forkConfig) : fork(this.appPath, forkConfig);

this.process.on('message', message => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ process.on('SIGTERM', () => {
process.exit(0);
});

require('./mockVersion');
// require('./mockVersion');
const agentPort = process.env.INSTANA_AGENT_PORT;

require('../../../..')();
Expand All @@ -26,8 +26,8 @@ const { Client } = require('@elastic/elasticsearch');
const port = require('../../../test_util/app-port')();

const app = express();
const logPrefix = `Elasticsearch ${process.env.ELASTIC_VERSION} (${process.pid}):\t`;
const isLatest = process.env.ELASTIC_VERSION === 'latest';
const logPrefix = `Elasticsearch ${process.env.CURRENCY_VERSION} (${process.pid}):\t`;
const isLatest = process.env.CURRENCY_VERSION_IS_LATEST === 'true';

if (process.env.WITH_STDOUT) {
app.use(morgan(`${logPrefix}:method :url :status`));
Expand Down

This file was deleted.

Loading