Skip to content

Commit

Permalink
more debug, clear logs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ocean committed Jul 25, 2024
1 parent e85e001 commit 7ea9bb3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/test/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ HTTP_API_PORT=8001
P2P_ipV4BindTcpPort=8000
PRIVATE_KEY=0xc594c6e5def4bab63ac29eed19a134c130388f74f019bc74b8f4389df2837a58
RPCS='{ "8996": {"rpc": "http://127.0.0.1:8545", "chainId": 8996, "network": "development", "chunkSize": 100}}'
DB_URL=http://localhost:8108?apiKey=xyz
DB_URL=http://localhost:8108/?apiKey=xyz
IPFS_GATEWAY=https://ipfs.io/
ARWEAVE_GATEWAY=https://arweave.net/
NODE1_PRIVATE_KEY=0xcb345bd2b11264d523ddaf383094e2675c420a17511c3102a53817f13474a7ff
Expand Down
10 changes: 7 additions & 3 deletions src/test/unit/logging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ describe('Logger instances and transports tests', async () => {
[
ENVIRONMENT_VARIABLES.NODE_ENV,
ENVIRONMENT_VARIABLES.LOG_DB,
ENVIRONMENT_VARIABLES.LOG_LEVEL
ENVIRONMENT_VARIABLES.LOG_LEVEL,
ENVIRONMENT_VARIABLES.DB_URL
],
['development', 'false', 'info']
['development', 'false', 'info', 'http://localhost:8108/?apiKey=xyz']
)
)
// because of this
Expand All @@ -52,7 +53,10 @@ describe('Logger instances and transports tests', async () => {
expect(OCEAN_NODE_LOGGER.hasDBTransport()).to.be.equal(false)
const envAfter = await setupEnvironment(
null,
buildEnvOverrideConfig([ENVIRONMENT_VARIABLES.LOG_DB], ['true'])
buildEnvOverrideConfig(
[ENVIRONMENT_VARIABLES.LOG_DB, ENVIRONMENT_VARIABLES.DB_URL],
['true', 'http://localhost:8108/?apiKey=xyz']
)
)
expect(USE_DB_TRANSPORT()).to.be.equal(true)
// will build the DB transport layer
Expand Down
6 changes: 5 additions & 1 deletion src/test/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ export async function setupEnvironment(
element.override ||
(element.required && process.env[element.name] === undefined) // if override OR not set but required to run
) {
CONFIG_LOGGER.debug('Overriding environment variable: ' + element.name)
CONFIG_LOGGER.debug(
`Overriding environment variable: ${element.name}\ncurrent:\n ${
process.env[element.name]
}\nnew:\n ${element.newValue}`
)
element.originalValue = process.env[element.name] // save original value
process.env[element.name] = element.newValue
ENVIRONMENT_VARIABLES[element.name].value = element.newValue
Expand Down

0 comments on commit 7ea9bb3

Please sign in to comment.