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

fix: 3198 cherry pick npm package version #3200

Merged
merged 2 commits into from
Oct 31, 2024
Merged
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
2 changes: 2 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "root",
"version": "0.59.0-rc2",
quiet-node marked this conversation as resolved.
Show resolved Hide resolved
"devDependencies": {
"@hashgraph/hedera-local": "^2.31.0",
"@open-rpc/schema-utils-js": "^1.16.1",
Expand Down
5 changes: 3 additions & 2 deletions packages/config-service/src/services/globalConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,11 @@ export class GlobalConfig {
required: false,
defaultValue: null,
},
NPM_PACKAGE_VERSION: {
// the actual env var in the node process is npm_package_version
npm_package_version: {
Nana-EC marked this conversation as resolved.
Show resolved Hide resolved
envName: 'npm_package_version',
type: 'string',
required: false,
required: true,
ebadiere marked this conversation as resolved.
Show resolved Hide resolved
defaultValue: null,
},
OPERATOR_ID_ETH_SENDRAWTRANSACTION: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import chai, { expect } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { GlobalConfig } from '../../../dist/services/globalConfig';
import { ValidationService } from '../../../dist/services/validationService';
import { overrideEnvsInMochaDescribe } from '../../../../relay/tests/helpers';

chai.use(chaiAsPromised);

Expand All @@ -31,6 +32,7 @@ describe('ValidationService tests', async function () {
CHAIN_ID: '0x12a',
HEDERA_NETWORK: '{"127.0.0.1:50211":"0.0.3"}',
MIRROR_NODE_URL: 'http://127.0.0.1:5551',
npm_package_version: '1.0.0',
OPERATOR_ID_MAIN: '0.0.1002',
OPERATOR_KEY_MAIN:
'302000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
Expand All @@ -55,6 +57,30 @@ describe('ValidationService tests', async function () {
});
});

describe('package-version', () => {
overrideEnvsInMochaDescribe({
npm_package_version: undefined,
});

const mandatoryStartUpFields = {
CHAIN_ID: '0x12a',
HEDERA_NETWORK: '{"127.0.0.1:50211":"0.0.3"}',
MIRROR_NODE_URL: 'http://127.0.0.1:5551',
OPERATOR_ID_MAIN: '0.0.1002',
OPERATOR_KEY_MAIN:
'302000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
SERVER_PORT: '7546',
};

it('should fail fast if npm_package_version is not set', async () => {
expect(() =>
ValidationService.startUp({
...mandatoryStartUpFields,
}),
).to.throw('npm_package_version is a mandatory and the relay cannot operate without its value.');
});
});

describe('typeCasting', () => {
it('should be able to use default value for missing env if default value is set', async () => {
const castedEnvs = ValidationService.typeCasting({});
Expand Down
3 changes: 0 additions & 3 deletions packages/server/tests/acceptance/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ global.relayIsLocal = RELAY_URL === LOCAL_RELAY_URL;
describe('RPC Server Acceptance Tests', function () {
this.timeout(240 * 1000); // 240 seconds

let relayServer; // Relay Server
let socketServer;

global.servicesNode = new ServicesClient(
NETWORK,
OPERATOR_ID,
Expand Down
Loading