Joystream / Joystream/joystream

Importing from query-not into tests/network-test bug

Open
#3,469 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug network-integration-test nice-to-have qn-hydra-board query-node SP:1 to-triage
Dominant language
Rust
Stars
1.4k
Forks
116
PR merge metrics
No merged PRs in 30d

Description

Defining some constant/data such as export const PERBILL_ONE_PERCENT = 10_000_000 in query-node/mappings/src/common.ts or query-node/mappings/src/content/utils.ts, and then importing it in tests/network-tests results in following error while running tests using ./query-node/run-tests.sh

$ ./run-test-scenario.sh content-directory
$ node -r ts-node/register --unhandled-rejections=strict src/scenarios/content-directory.ts
Error: Config: WARTHOG_APP_HOST is required: undefined

However, there is no such error if we define our const in some new file query-node/mappings/src/temporaryConstants.ts with only the definition. Hence, this temporary solution is used in #3452 to import PERBILL_ONE_PERCENT in tests/network-tests/src/Api.ts

A possible reason for the error as suggested by @ondratra is likely that something inside of common.ts(it's also imported
by utils.ts) is imported with an unexpected side effect that creates the error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with query-node/mappings/src/common.ts and query-node/mappings/src/content/utils.ts, then reproduce the failure through tests/network-tests using ./query-node/run-tests.sh and the content-directory scenario. Trace the imports involved in loading those files and compare them with query-node/mappings/src/temporaryConstants.ts; done means the constant can be imported without the WARTHOG_APP_HOST error and the network test scenario runs successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.