From 4efbc6da326e1f401a4dd0d0bd591148023e0348 Mon Sep 17 00:00:00 2001 From: ndrpp Date: Thu, 19 Feb 2026 15:19:56 +0200 Subject: [PATCH 1/8] fix: add unhandled exception/rejection logs --- src/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/index.ts b/src/index.ts index 532dc363d..119445706 100644 --- a/src/index.ts +++ b/src/index.ts @@ -218,3 +218,10 @@ if (config.hasHttp) { // Call the function to schedule the cron job to delete old logs scheduleCronJobs(oceanNode) } + +process.on('unhandledRejection', (reason) => { + console.log({ reason }) +}) +process.on('uncaughtException', (reason) => { + console.log({ reason }) +}) From 1d36549e225e493a608a0b2e43faba0dbd637e11 Mon Sep 17 00:00:00 2001 From: ndrpp Date: Thu, 19 Feb 2026 17:24:14 +0200 Subject: [PATCH 2/8] fix: init fresh instance for download test suite --- src/test/unit/download.test.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/unit/download.test.ts b/src/test/unit/download.test.ts index da45d1d8d..2c8810c9f 100644 --- a/src/test/unit/download.test.ts +++ b/src/test/unit/download.test.ts @@ -20,6 +20,7 @@ import { AssetUtils, isConfidentialChainDDO } from '../../utils/asset.js' import { DEVELOPMENT_CHAIN_ID, KNOWN_CONFIDENTIAL_EVMS } from '../../utils/address.js' import { DDO } from '@oceanprotocol/ddo-js' import { Wallet, ethers } from 'ethers' +import { KeyManager } from '../../components/KeyManager/index.js' let envOverrides: OverrideEnvConfig[] let config: OceanNodeConfig @@ -35,8 +36,18 @@ describe('Should validate files structure for download', () => { ) envOverrides = await setupEnvironment(TEST_ENV_CONFIG_FILE, envOverrides) config = await getConfiguration(true) + const keyManager = new KeyManager(config) db = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, db) + oceanNode = OceanNode.getInstance( + config, + db, + null, + null, + null, + keyManager, + null, + true + ) consumerAccount = new Wallet(process.env.PRIVATE_KEY) }) From 62b464f642d3b9089dc6e6409285a607b709a17a Mon Sep 17 00:00:00 2001 From: ndrpp Date: Mon, 23 Feb 2026 10:13:26 +0200 Subject: [PATCH 3/8] fix: test with sequential integration & system tests actions --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 353ead21a..74d9f8b17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -186,6 +186,7 @@ jobs: test_system: runs-on: ubuntu-latest + needs: [test_integration] steps: - name: Checkout code From 1de6572be233c1e2d3ec6ed53de6bd70e8cf58ad Mon Sep 17 00:00:00 2001 From: ndrpp Date: Mon, 23 Feb 2026 10:50:55 +0200 Subject: [PATCH 4/8] fix: wait_for in es queries | new node instance in tests | missing awaits --- .github/workflows/ci.yml | 1 - .../database/ElasticSearchDatabase.ts | 18 ++++++++++++------ src/test/integration/algorithmsAccess.test.ts | 7 ++++--- src/test/integration/auth.test.ts | 2 +- src/test/integration/compute.test.ts | 5 +++-- src/test/integration/configAdmin.test.ts | 2 +- src/test/integration/configDatabase.test.ts | 7 ++++--- src/test/integration/credentials.test.ts | 7 ++++--- src/test/integration/download.test.ts | 7 ++++--- src/test/integration/encryptDecryptDDO.test.ts | 7 ++++--- src/test/integration/encryptFile.test.ts | 2 +- src/test/integration/getJobs.test.ts | 2 +- src/test/integration/indexer.test.ts | 7 ++++--- .../integration/operationsDashboard.test.ts | 5 +++-- src/test/integration/pricing.test.ts | 5 +++-- .../integration/transactionValidation.test.ts | 7 ++++--- 16 files changed, 53 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74d9f8b17..353ead21a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -186,7 +186,6 @@ jobs: test_system: runs-on: ubuntu-latest - needs: [test_integration] steps: - name: Checkout code diff --git a/src/components/database/ElasticSearchDatabase.ts b/src/components/database/ElasticSearchDatabase.ts index f43f039ff..84caea3ab 100644 --- a/src/components/database/ElasticSearchDatabase.ts +++ b/src/components/database/ElasticSearchDatabase.ts @@ -391,7 +391,8 @@ export class ElasticsearchOrderDatabase extends AbstractOrderDatabase { await this.provider.index({ index: this.getSchema().index, id: orderId, - body: document + body: document, + refresh: 'wait_for' }) return document } catch (error) { @@ -441,7 +442,8 @@ export class ElasticsearchOrderDatabase extends AbstractOrderDatabase { body: { doc: document, doc_as_upsert: true - } + }, + refresh: 'wait_for' }) return document } catch (error) { @@ -457,7 +459,8 @@ export class ElasticsearchOrderDatabase extends AbstractOrderDatabase { try { await this.provider.delete({ index: this.getSchema().index, - id: orderId + id: orderId, + refresh: 'wait_for' }) return { id: orderId } } catch (error) { @@ -582,7 +585,8 @@ export class ElasticsearchDdoDatabase extends AbstractDdoDatabase { const response = await this.client.index({ index: schema.index, id: ddo.id, - body: ddo + body: ddo, + refresh: 'wait_for' }) return response } else { @@ -654,7 +658,8 @@ export class ElasticsearchDdoDatabase extends AbstractDdoDatabase { id: ddo.id, body: { doc: ddo - } + }, + refresh: 'wait_for' }) // make sure we do not have different responses 4 between DBs // do the same thing on other methods @@ -693,7 +698,8 @@ export class ElasticsearchDdoDatabase extends AbstractDdoDatabase { try { const response = await this.client.delete({ index: schema.index, - id + id, + refresh: 'wait_for' }) isDeleted = response.result === 'deleted' if (isDeleted) { diff --git a/src/test/integration/algorithmsAccess.test.ts b/src/test/integration/algorithmsAccess.test.ts index 12cc2e114..811098677 100644 --- a/src/test/integration/algorithmsAccess.test.ts +++ b/src/test/integration/algorithmsAccess.test.ts @@ -22,7 +22,7 @@ import { import { Database } from '../../components/database/index.js' import { OceanNode } from '../../OceanNode.js' import { OceanNodeConfig } from '../../@types/OceanNode.js' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' import { Readable } from 'stream' import { waitToIndex } from './testUtils.js' import { streamToObject } from '../../utils/util.js' @@ -109,7 +109,7 @@ describe('Trusted algorithms Flow', () => { ) config = await getConfiguration(true) dbconn = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, dbconn, null, null, null) + oceanNode = await OceanNode.getInstance(config, dbconn, null, null, null, null, null, true) indexer = new OceanIndexer( dbconn, config.indexingNetworks, @@ -499,6 +499,7 @@ describe('Trusted algorithms Flow', () => { }) after(async () => { await tearDownEnvironment(previousConfiguration) - indexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await indexer.stopAllChainIndexers() }) }) diff --git a/src/test/integration/auth.test.ts b/src/test/integration/auth.test.ts index 2a0672032..25709faba 100644 --- a/src/test/integration/auth.test.ts +++ b/src/test/integration/auth.test.ts @@ -48,7 +48,7 @@ describe('Auth Token Integration Tests', () => { config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, database) + oceanNode = await OceanNode.getInstance(config, database, null, null, null, null, null, true) provider = new JsonRpcProvider(mockSupportedNetworks['8996'].rpc) diff --git a/src/test/integration/compute.test.ts b/src/test/integration/compute.test.ts index 2dbe382c8..6104c66a5 100644 --- a/src/test/integration/compute.test.ts +++ b/src/test/integration/compute.test.ts @@ -35,7 +35,7 @@ import { import { Database } from '../../components/database/index.js' import { OceanNode } from '../../OceanNode.js' import { OceanNodeConfig } from '../../@types/OceanNode.js' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' import { Readable } from 'stream' import { expectedTimeoutFailure, waitToIndex } from './testUtils.js' import { getEventFromTx, streamToObject } from '../../utils/util.js' @@ -2025,7 +2025,8 @@ describe('Compute', () => { after(async () => { await tearDownEnvironment(previousConfiguration) - indexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await indexer.stopAllChainIndexers() }) }) diff --git a/src/test/integration/configAdmin.test.ts b/src/test/integration/configAdmin.test.ts index e971d5508..929645444 100644 --- a/src/test/integration/configAdmin.test.ts +++ b/src/test/integration/configAdmin.test.ts @@ -53,7 +53,7 @@ describe('Config Admin Endpoints Integration Tests', () => { config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database) + oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) }) after(async () => { diff --git a/src/test/integration/configDatabase.test.ts b/src/test/integration/configDatabase.test.ts index 401075947..fbead80be 100644 --- a/src/test/integration/configDatabase.test.ts +++ b/src/test/integration/configDatabase.test.ts @@ -1,7 +1,7 @@ import { Database } from '../../components/database/index.js' import { OceanNode } from '../../OceanNode.js' import { expect, assert } from 'chai' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' import { buildEnvOverrideConfig, getMockSupportedNetworks, @@ -62,7 +62,7 @@ describe('Config Database', () => { assert(initialVersionNull.value === null, 'Initial version should be null') }) - const oceanNode = await OceanNode.getInstance(await getConfiguration(true), database) + const oceanNode = await OceanNode.getInstance(await getConfiguration(true), database, null, null, null, null, null, true) oceanIndexer = new OceanIndexer( database, getMockSupportedNetworks(), @@ -106,7 +106,8 @@ describe('Config Database', () => { assert(version.value === updatedVersion, `Version should be ${updatedVersion}`) }) after(async () => { - oceanIndexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await oceanIndexer.stopAllChainIndexers() await tearDownEnvironment(previousConfiguration) }) }) diff --git a/src/test/integration/credentials.test.ts b/src/test/integration/credentials.test.ts index d2bd88d56..fa9884a04 100644 --- a/src/test/integration/credentials.test.ts +++ b/src/test/integration/credentials.test.ts @@ -16,7 +16,7 @@ import { expect, assert } from 'chai' import { JsonRpcProvider, Signer, ethers, Contract, EventLog } from 'ethers' import { Database } from '../../components/database/index.js' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' import { OceanNode } from '../../OceanNode.js' import { RPCS, SupportedNetwork } from '../../@types/blockchain.js' import { streamToObject } from '../../utils/util.js' @@ -139,7 +139,7 @@ describe('[Credentials Flow] - Should run a complete node flow.', () => { config = await getConfiguration(true) // Force reload the configuration const database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database) + oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) const indexer = new OceanIndexer( database, config.indexingNetworks, @@ -630,6 +630,7 @@ describe('[Credentials Flow] - Should run a complete node flow.', () => { after(async () => { await tearDownEnvironment(previousConfiguration) - oceanNode.getIndexer().stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await oceanNode.getIndexer().stopAllChainIndexers() }) }) diff --git a/src/test/integration/download.test.ts b/src/test/integration/download.test.ts index 1b5194950..a49e11e73 100644 --- a/src/test/integration/download.test.ts +++ b/src/test/integration/download.test.ts @@ -1,7 +1,7 @@ import { expect, assert } from 'chai' import { JsonRpcProvider, Signer, ethers } from 'ethers' import { Database } from '../../components/database/index.js' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' import { OceanNode } from '../../OceanNode.js' import { RPCS } from '../../@types/blockchain.js' import { streamToString, streamToObject } from '../../utils/util.js' @@ -89,7 +89,7 @@ describe('[Download Flow] - Should run a complete node flow.', () => { config = await getConfiguration(true) // Force reload the configuration database = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, database) + oceanNode = await OceanNode.getInstance(config, database, null, null, null, null, null, true) indexer = new OceanIndexer( database, config.indexingNetworks, @@ -327,6 +327,7 @@ describe('[Download Flow] - Should run a complete node flow.', () => { }) after(async () => { await tearDownEnvironment(previousConfiguration) - indexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await indexer.stopAllChainIndexers() }) }) diff --git a/src/test/integration/encryptDecryptDDO.test.ts b/src/test/integration/encryptDecryptDDO.test.ts index cfaffb163..847035339 100644 --- a/src/test/integration/encryptDecryptDDO.test.ts +++ b/src/test/integration/encryptDecryptDDO.test.ts @@ -38,7 +38,7 @@ import { import { DecryptDDOCommand } from '../../@types/commands.js' import { EncryptMethod } from '../../@types/fileObject.js' import { homedir } from 'os' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' describe('Should encrypt and decrypt DDO', () => { let database: Database @@ -104,7 +104,7 @@ describe('Should encrypt and decrypt DDO', () => { ) const config = await getConfiguration() database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database) + oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) // will be used later indexer = new OceanIndexer( database, @@ -392,6 +392,7 @@ describe('Should encrypt and decrypt DDO', () => { after(async () => { await tearDownEnvironment(previousConfiguration) - indexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await indexer.stopAllChainIndexers() }) }) diff --git a/src/test/integration/encryptFile.test.ts b/src/test/integration/encryptFile.test.ts index aa55e3ab5..45b354a05 100644 --- a/src/test/integration/encryptFile.test.ts +++ b/src/test/integration/encryptFile.test.ts @@ -34,7 +34,7 @@ describe('Encrypt File', () => { ) config = await getConfiguration(true) // Force reload the configuration const dbconn = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, dbconn) + oceanNode = await OceanNode.getInstance(config, dbconn, null, null, null, null, null, true) anotherConsumerWallet = new ethers.Wallet( '0xef4b441145c1d0f3b4bc6d61d29f5c6e502359481152f869247c7a4244d45209' ) diff --git a/src/test/integration/getJobs.test.ts b/src/test/integration/getJobs.test.ts index 0f405a66b..9b4994af1 100644 --- a/src/test/integration/getJobs.test.ts +++ b/src/test/integration/getJobs.test.ts @@ -74,7 +74,7 @@ describe('GetJobsHandler integration', () => { previousConfiguration = await setupEnvironment(TEST_ENV_CONFIG_FILE) const config = await getConfiguration(true) db = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, db) + oceanNode = await OceanNode.getInstance(config, db, null, null, null, null, null, true) handler = new GetJobsHandler(oceanNode) diff --git a/src/test/integration/indexer.test.ts b/src/test/integration/indexer.test.ts index 1c83d4b42..04c4c86a7 100644 --- a/src/test/integration/indexer.test.ts +++ b/src/test/integration/indexer.test.ts @@ -16,7 +16,7 @@ import ERC721Template from '@oceanprotocol/contracts/artifacts/contracts/templat import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json' with { type: 'json' } import { Database } from '../../components/database/index.js' import { DatabaseFactory } from '../../components/database/DatabaseFactory.js' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' import { RPCS } from '../../@types/blockchain.js' import { getEventFromTx, streamToObject } from '../../utils/util.js' import { waitToIndex, expectedTimeoutFailure } from './testUtils.js' @@ -100,7 +100,7 @@ describe('Indexer stores a new metadata events and orders.', () => { const config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database) + oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) indexer = new OceanIndexer( database, mockSupportedNetworks, @@ -656,6 +656,7 @@ describe('Indexer stores a new metadata events and orders.', () => { after(async () => { await tearDownEnvironment(previousConfiguration) - indexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await indexer.stopAllChainIndexers() }) }) diff --git a/src/test/integration/operationsDashboard.test.ts b/src/test/integration/operationsDashboard.test.ts index 8f102b741..a70f7d8bd 100644 --- a/src/test/integration/operationsDashboard.test.ts +++ b/src/test/integration/operationsDashboard.test.ts @@ -117,7 +117,8 @@ describe('Should test admin operations', () => { null, null, keyManager, - blockchainRegistry + blockchainRegistry, + true ) indexer = new OceanIndexer( dbconn, @@ -417,6 +418,6 @@ describe('Should test admin operations', () => { after(async () => { await tearDownEnvironment(previousConfiguration) INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() - indexer.stopAllChainIndexers() + await indexer.stopAllChainIndexers() }) }) diff --git a/src/test/integration/pricing.test.ts b/src/test/integration/pricing.test.ts index fed4f9d15..376773c6a 100644 --- a/src/test/integration/pricing.test.ts +++ b/src/test/integration/pricing.test.ts @@ -15,7 +15,7 @@ import ERC721Template from '@oceanprotocol/contracts/artifacts/contracts/templat import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json' with { type: 'json' } import Dispenser from '@oceanprotocol/contracts/artifacts/contracts/pools/dispenser/Dispenser.sol/Dispenser.json' with { type: 'json' } import { Database } from '../../components/database/index.js' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' import { RPCS } from '../../@types/blockchain.js' import { getEventFromTx } from '../../utils/util.js' import { waitToIndex, expectedTimeoutFailure } from './testUtils.js' @@ -376,6 +376,7 @@ describe('Publish pricing scehmas and assert ddo stats - FRE & Dispenser', () => }) after(async () => { await tearDownEnvironment(previousConfiguration) - indexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await indexer.stopAllChainIndexers() }) }) diff --git a/src/test/integration/transactionValidation.test.ts b/src/test/integration/transactionValidation.test.ts index 651be6af9..8f8a9cdeb 100644 --- a/src/test/integration/transactionValidation.test.ts +++ b/src/test/integration/transactionValidation.test.ts @@ -11,7 +11,7 @@ import { } from '../../utils/address.js' import { publishAsset, orderAsset, reOrderAsset } from '../utils/assets.js' import { RPCS } from '../../@types/blockchain.js' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' import { OceanNode } from '../../OceanNode.js' import { OceanNodeConfig } from '../../@types/OceanNode.js' import { ENVIRONMENT_VARIABLES, EVENTS, getConfiguration } from '../../utils/index.js' @@ -69,7 +69,7 @@ describe('validateOrderTransaction Function with Orders', () => { config = await getConfiguration(true) // Force reload the configuration const dbconn = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, dbconn) + oceanNode = await OceanNode.getInstance(config, dbconn, null, null, null, null, null, true) indexer = new OceanIndexer( dbconn, config.indexingNetworks, @@ -239,6 +239,7 @@ describe('validateOrderTransaction Function with Orders', () => { }) after(async () => { await tearDownEnvironment(previousConfiguration) - indexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await indexer.stopAllChainIndexers() }) }) From b39ef12f42e6938383c73760484833bb66864bbc Mon Sep 17 00:00:00 2001 From: ndrpp Date: Mon, 23 Feb 2026 10:54:11 +0200 Subject: [PATCH 5/8] fix: formatting --- src/test/integration/algorithmsAccess.test.ts | 16 ++++++++++++++-- src/test/integration/auth.test.ts | 11 ++++++++++- src/test/integration/compute.test.ts | 5 ++++- src/test/integration/configAdmin.test.ts | 11 ++++++++++- src/test/integration/configDatabase.test.ts | 16 ++++++++++++++-- src/test/integration/credentials.test.ts | 16 ++++++++++++++-- src/test/integration/download.test.ts | 16 ++++++++++++++-- src/test/integration/encryptDecryptDDO.test.ts | 16 ++++++++++++++-- src/test/integration/encryptFile.test.ts | 11 ++++++++++- src/test/integration/getJobs.test.ts | 11 ++++++++++- src/test/integration/indexer.test.ts | 16 ++++++++++++++-- src/test/integration/pricing.test.ts | 5 ++++- .../integration/transactionValidation.test.ts | 16 ++++++++++++++-- 13 files changed, 146 insertions(+), 20 deletions(-) diff --git a/src/test/integration/algorithmsAccess.test.ts b/src/test/integration/algorithmsAccess.test.ts index 811098677..068bfedad 100644 --- a/src/test/integration/algorithmsAccess.test.ts +++ b/src/test/integration/algorithmsAccess.test.ts @@ -22,7 +22,10 @@ import { import { Database } from '../../components/database/index.js' import { OceanNode } from '../../OceanNode.js' import { OceanNodeConfig } from '../../@types/OceanNode.js' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { Readable } from 'stream' import { waitToIndex } from './testUtils.js' import { streamToObject } from '../../utils/util.js' @@ -109,7 +112,16 @@ describe('Trusted algorithms Flow', () => { ) config = await getConfiguration(true) dbconn = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, dbconn, null, null, null, null, null, true) + oceanNode = await OceanNode.getInstance( + config, + dbconn, + null, + null, + null, + null, + null, + true + ) indexer = new OceanIndexer( dbconn, config.indexingNetworks, diff --git a/src/test/integration/auth.test.ts b/src/test/integration/auth.test.ts index 25709faba..03460550b 100644 --- a/src/test/integration/auth.test.ts +++ b/src/test/integration/auth.test.ts @@ -48,7 +48,16 @@ describe('Auth Token Integration Tests', () => { config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, database, null, null, null, null, null, true) + oceanNode = await OceanNode.getInstance( + config, + database, + null, + null, + null, + null, + null, + true + ) provider = new JsonRpcProvider(mockSupportedNetworks['8996'].rpc) diff --git a/src/test/integration/compute.test.ts b/src/test/integration/compute.test.ts index 6104c66a5..bb9733905 100644 --- a/src/test/integration/compute.test.ts +++ b/src/test/integration/compute.test.ts @@ -35,7 +35,10 @@ import { import { Database } from '../../components/database/index.js' import { OceanNode } from '../../OceanNode.js' import { OceanNodeConfig } from '../../@types/OceanNode.js' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { Readable } from 'stream' import { expectedTimeoutFailure, waitToIndex } from './testUtils.js' import { getEventFromTx, streamToObject } from '../../utils/util.js' diff --git a/src/test/integration/configAdmin.test.ts b/src/test/integration/configAdmin.test.ts index 929645444..9b0fc5952 100644 --- a/src/test/integration/configAdmin.test.ts +++ b/src/test/integration/configAdmin.test.ts @@ -53,7 +53,16 @@ describe('Config Admin Endpoints Integration Tests', () => { config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) + oceanNode = OceanNode.getInstance( + config, + database, + null, + null, + null, + null, + null, + true + ) }) after(async () => { diff --git a/src/test/integration/configDatabase.test.ts b/src/test/integration/configDatabase.test.ts index fbead80be..d80e45974 100644 --- a/src/test/integration/configDatabase.test.ts +++ b/src/test/integration/configDatabase.test.ts @@ -1,7 +1,10 @@ import { Database } from '../../components/database/index.js' import { OceanNode } from '../../OceanNode.js' import { expect, assert } from 'chai' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { buildEnvOverrideConfig, getMockSupportedNetworks, @@ -62,7 +65,16 @@ describe('Config Database', () => { assert(initialVersionNull.value === null, 'Initial version should be null') }) - const oceanNode = await OceanNode.getInstance(await getConfiguration(true), database, null, null, null, null, null, true) + const oceanNode = await OceanNode.getInstance( + await getConfiguration(true), + database, + null, + null, + null, + null, + null, + true + ) oceanIndexer = new OceanIndexer( database, getMockSupportedNetworks(), diff --git a/src/test/integration/credentials.test.ts b/src/test/integration/credentials.test.ts index fa9884a04..ff60cc0f9 100644 --- a/src/test/integration/credentials.test.ts +++ b/src/test/integration/credentials.test.ts @@ -16,7 +16,10 @@ import { expect, assert } from 'chai' import { JsonRpcProvider, Signer, ethers, Contract, EventLog } from 'ethers' import { Database } from '../../components/database/index.js' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { OceanNode } from '../../OceanNode.js' import { RPCS, SupportedNetwork } from '../../@types/blockchain.js' import { streamToObject } from '../../utils/util.js' @@ -139,7 +142,16 @@ describe('[Credentials Flow] - Should run a complete node flow.', () => { config = await getConfiguration(true) // Force reload the configuration const database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) + oceanNode = OceanNode.getInstance( + config, + database, + null, + null, + null, + null, + null, + true + ) const indexer = new OceanIndexer( database, config.indexingNetworks, diff --git a/src/test/integration/download.test.ts b/src/test/integration/download.test.ts index a49e11e73..6ba09043a 100644 --- a/src/test/integration/download.test.ts +++ b/src/test/integration/download.test.ts @@ -1,7 +1,10 @@ import { expect, assert } from 'chai' import { JsonRpcProvider, Signer, ethers } from 'ethers' import { Database } from '../../components/database/index.js' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { OceanNode } from '../../OceanNode.js' import { RPCS } from '../../@types/blockchain.js' import { streamToString, streamToObject } from '../../utils/util.js' @@ -89,7 +92,16 @@ describe('[Download Flow] - Should run a complete node flow.', () => { config = await getConfiguration(true) // Force reload the configuration database = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, database, null, null, null, null, null, true) + oceanNode = await OceanNode.getInstance( + config, + database, + null, + null, + null, + null, + null, + true + ) indexer = new OceanIndexer( database, config.indexingNetworks, diff --git a/src/test/integration/encryptDecryptDDO.test.ts b/src/test/integration/encryptDecryptDDO.test.ts index 847035339..f05b8a5ce 100644 --- a/src/test/integration/encryptDecryptDDO.test.ts +++ b/src/test/integration/encryptDecryptDDO.test.ts @@ -38,7 +38,10 @@ import { import { DecryptDDOCommand } from '../../@types/commands.js' import { EncryptMethod } from '../../@types/fileObject.js' import { homedir } from 'os' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' describe('Should encrypt and decrypt DDO', () => { let database: Database @@ -104,7 +107,16 @@ describe('Should encrypt and decrypt DDO', () => { ) const config = await getConfiguration() database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) + oceanNode = OceanNode.getInstance( + config, + database, + null, + null, + null, + null, + null, + true + ) // will be used later indexer = new OceanIndexer( database, diff --git a/src/test/integration/encryptFile.test.ts b/src/test/integration/encryptFile.test.ts index 45b354a05..8bc98bbca 100644 --- a/src/test/integration/encryptFile.test.ts +++ b/src/test/integration/encryptFile.test.ts @@ -34,7 +34,16 @@ describe('Encrypt File', () => { ) config = await getConfiguration(true) // Force reload the configuration const dbconn = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, dbconn, null, null, null, null, null, true) + oceanNode = await OceanNode.getInstance( + config, + dbconn, + null, + null, + null, + null, + null, + true + ) anotherConsumerWallet = new ethers.Wallet( '0xef4b441145c1d0f3b4bc6d61d29f5c6e502359481152f869247c7a4244d45209' ) diff --git a/src/test/integration/getJobs.test.ts b/src/test/integration/getJobs.test.ts index 9b4994af1..6b6cfc730 100644 --- a/src/test/integration/getJobs.test.ts +++ b/src/test/integration/getJobs.test.ts @@ -74,7 +74,16 @@ describe('GetJobsHandler integration', () => { previousConfiguration = await setupEnvironment(TEST_ENV_CONFIG_FILE) const config = await getConfiguration(true) db = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, db, null, null, null, null, null, true) + oceanNode = await OceanNode.getInstance( + config, + db, + null, + null, + null, + null, + null, + true + ) handler = new GetJobsHandler(oceanNode) diff --git a/src/test/integration/indexer.test.ts b/src/test/integration/indexer.test.ts index 04c4c86a7..932cc181c 100644 --- a/src/test/integration/indexer.test.ts +++ b/src/test/integration/indexer.test.ts @@ -16,7 +16,10 @@ import ERC721Template from '@oceanprotocol/contracts/artifacts/contracts/templat import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json' with { type: 'json' } import { Database } from '../../components/database/index.js' import { DatabaseFactory } from '../../components/database/DatabaseFactory.js' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { RPCS } from '../../@types/blockchain.js' import { getEventFromTx, streamToObject } from '../../utils/util.js' import { waitToIndex, expectedTimeoutFailure } from './testUtils.js' @@ -100,7 +103,16 @@ describe('Indexer stores a new metadata events and orders.', () => { const config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) + oceanNode = OceanNode.getInstance( + config, + database, + null, + null, + null, + null, + null, + true + ) indexer = new OceanIndexer( database, mockSupportedNetworks, diff --git a/src/test/integration/pricing.test.ts b/src/test/integration/pricing.test.ts index 376773c6a..69d2f0657 100644 --- a/src/test/integration/pricing.test.ts +++ b/src/test/integration/pricing.test.ts @@ -15,7 +15,10 @@ import ERC721Template from '@oceanprotocol/contracts/artifacts/contracts/templat import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json' with { type: 'json' } import Dispenser from '@oceanprotocol/contracts/artifacts/contracts/pools/dispenser/Dispenser.sol/Dispenser.json' with { type: 'json' } import { Database } from '../../components/database/index.js' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { RPCS } from '../../@types/blockchain.js' import { getEventFromTx } from '../../utils/util.js' import { waitToIndex, expectedTimeoutFailure } from './testUtils.js' diff --git a/src/test/integration/transactionValidation.test.ts b/src/test/integration/transactionValidation.test.ts index 8f8a9cdeb..a73a6bad6 100644 --- a/src/test/integration/transactionValidation.test.ts +++ b/src/test/integration/transactionValidation.test.ts @@ -11,7 +11,10 @@ import { } from '../../utils/address.js' import { publishAsset, orderAsset, reOrderAsset } from '../utils/assets.js' import { RPCS } from '../../@types/blockchain.js' -import { OceanIndexer, INDEXER_CRAWLING_EVENT_EMITTER } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { OceanNode } from '../../OceanNode.js' import { OceanNodeConfig } from '../../@types/OceanNode.js' import { ENVIRONMENT_VARIABLES, EVENTS, getConfiguration } from '../../utils/index.js' @@ -69,7 +72,16 @@ describe('validateOrderTransaction Function with Orders', () => { config = await getConfiguration(true) // Force reload the configuration const dbconn = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance(config, dbconn, null, null, null, null, null, true) + oceanNode = await OceanNode.getInstance( + config, + dbconn, + null, + null, + null, + null, + null, + true + ) indexer = new OceanIndexer( dbconn, config.indexingNetworks, From 4645391590c3e95675c923830e08ddbaca67ac4f Mon Sep 17 00:00:00 2001 From: ndrpp Date: Mon, 23 Feb 2026 14:40:27 +0200 Subject: [PATCH 6/8] fix: revert indexer test changes --- src/test/integration/indexer.test.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/test/integration/indexer.test.ts b/src/test/integration/indexer.test.ts index 932cc181c..ec7a31bb0 100644 --- a/src/test/integration/indexer.test.ts +++ b/src/test/integration/indexer.test.ts @@ -103,16 +103,7 @@ describe('Indexer stores a new metadata events and orders.', () => { const config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance( - config, - database, - null, - null, - null, - null, - null, - true - ) + oceanNode = OceanNode.getInstance(config, database) indexer = new OceanIndexer( database, mockSupportedNetworks, @@ -668,7 +659,6 @@ describe('Indexer stores a new metadata events and orders.', () => { after(async () => { await tearDownEnvironment(previousConfiguration) - INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() - await indexer.stopAllChainIndexers() + indexer.stopAllChainIndexers() }) }) From 7a5e122dd614ec9e5016cbd574b40ff781f051b6 Mon Sep 17 00:00:00 2001 From: ndrpp Date: Mon, 23 Feb 2026 14:42:45 +0200 Subject: [PATCH 7/8] fix: formatting --- src/test/integration/indexer.test.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/test/integration/indexer.test.ts b/src/test/integration/indexer.test.ts index ec7a31bb0..1c83d4b42 100644 --- a/src/test/integration/indexer.test.ts +++ b/src/test/integration/indexer.test.ts @@ -16,10 +16,7 @@ import ERC721Template from '@oceanprotocol/contracts/artifacts/contracts/templat import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json' with { type: 'json' } import { Database } from '../../components/database/index.js' import { DatabaseFactory } from '../../components/database/DatabaseFactory.js' -import { - OceanIndexer, - INDEXER_CRAWLING_EVENT_EMITTER -} from '../../components/Indexer/index.js' +import { OceanIndexer } from '../../components/Indexer/index.js' import { RPCS } from '../../@types/blockchain.js' import { getEventFromTx, streamToObject } from '../../utils/util.js' import { waitToIndex, expectedTimeoutFailure } from './testUtils.js' From ff200730841ce824c0e32090106dab5d89868c01 Mon Sep 17 00:00:00 2001 From: ndrpp Date: Tue, 24 Feb 2026 17:18:27 +0200 Subject: [PATCH 8/8] fix: create new instance in pricing tests --- src/test/integration/indexer.test.ts | 10 +++++++--- src/test/integration/pricing.test.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/test/integration/indexer.test.ts b/src/test/integration/indexer.test.ts index 1c83d4b42..0b4912d09 100644 --- a/src/test/integration/indexer.test.ts +++ b/src/test/integration/indexer.test.ts @@ -16,7 +16,10 @@ import ERC721Template from '@oceanprotocol/contracts/artifacts/contracts/templat import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json' with { type: 'json' } import { Database } from '../../components/database/index.js' import { DatabaseFactory } from '../../components/database/DatabaseFactory.js' -import { OceanIndexer } from '../../components/Indexer/index.js' +import { + OceanIndexer, + INDEXER_CRAWLING_EVENT_EMITTER +} from '../../components/Indexer/index.js' import { RPCS } from '../../@types/blockchain.js' import { getEventFromTx, streamToObject } from '../../utils/util.js' import { waitToIndex, expectedTimeoutFailure } from './testUtils.js' @@ -100,7 +103,7 @@ describe('Indexer stores a new metadata events and orders.', () => { const config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = OceanNode.getInstance(config, database) + oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) indexer = new OceanIndexer( database, mockSupportedNetworks, @@ -656,6 +659,7 @@ describe('Indexer stores a new metadata events and orders.', () => { after(async () => { await tearDownEnvironment(previousConfiguration) - indexer.stopAllChainIndexers() + INDEXER_CRAWLING_EVENT_EMITTER.removeAllListeners() + await indexer.stopAllChainIndexers() }) }) diff --git a/src/test/integration/pricing.test.ts b/src/test/integration/pricing.test.ts index 69d2f0657..1e66a2abb 100644 --- a/src/test/integration/pricing.test.ts +++ b/src/test/integration/pricing.test.ts @@ -87,7 +87,7 @@ describe('Publish pricing scehmas and assert ddo stats - FRE & Dispenser', () => const config = await getConfiguration(true) database = await Database.init(config.dbConfig) - oceanNode = await OceanNode.getInstance() + oceanNode = OceanNode.getInstance(config, database, null, null, null, null, null, true) indexer = new OceanIndexer( database, mockSupportedNetworks,