This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Add --url option to the truffle exec command #5843
Closed
sukanyaparashar wants to merge 4 commits into
Closed
Conversation
dongmingh
reviewed
Jan 18, 2023
dongmingh
left a comment
Contributor
There was a problem hiding this comment.
Follow the test instructions, everything works as expected. In addition, I test the following scenarios:
- incorrect url
$ truffle exec test-script.js --url http://127.0.0.1:8544
> Something went wrong while attempting to connect to the network at http://127.0.0.1:8544. Check your network configuration.
CONNECTION ERROR: Couldn't connect to node http://127.0.0.1:8544.
Truffle (unbundled) (core: 5.7.0)
Node v16.18.1
- the script does not exit
$ truffle exec test.js --url http://127.0.0.1:8545 1 ↵
Using network '127.0.0.1:8545'.
Error: ENOENT: no such file or directory, open '/Users/dongminghwang/work/trufflesuite/test/reprod/2023/01/18/add-url-to-exec/truffle-test-project/test.js'
at Object.openSync (node:fs:590:3)
at readFileSync (node:fs:458:35)
at compile (/Users/dongminghwang/work/trufflesuite/truffle/packages/require/lib/typescript.ts:37:30)
at file (/Users/dongminghwang/work/trufflesuite/truffle/packages/require/lib/index.ts:98:25)
at exec (/Users/dongminghwang/work/trufflesuite/truffle/packages/require/lib/index.ts:133:16)
at node:internal/util:364:7
at new Promise (<anonymous>)
at exec (node:internal/util:350:12)
at Object.module.exports [as run] (/Users/dongminghwang/work/trufflesuite/truffle/packages/core/lib/commands/exec/run.js:56:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runCommand (/Users/dongminghwang/work/trufflesuite/truffle/packages/core/lib/command-utils.js:201:10)
Truffle (unbundled) (core: 5.7.0)
Node v16.18.1
- the script does not call process.exit(),
Truffle hangs
$ truffle exec test-script.js --url http://127.0.0.1:8545 1 ↵
Using network '127.0.0.1:8545'.
The returned value is: 600
and ganache continue to display
eth_getBlockByNumber
eth_getBlockByNumber
eth_getBlockByNumber
eth_getBlockByNumber
eth_getBlockByNumber
eth_getBlockByNumber
eth_getBlockByNumber
Shall we consider to end the program?
Contributor
Author
|
This PR can be closed and the branch can also be deleted as I have opened a new one #5852 for this. |
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR description
This PR adds
--urloption to thetruffle execcommand that connects to a specified url. See #5701.Testing instructions
To test this option, you can clone this Test Project with a simple storage contract and a test script.
truffle compileinside a truffle project in a separate terminal.truffle exec test-script.js --url http://127.0.0.1:8545. It should execute the script and deploys a new instance of the contract and returns the value of the state variable that is set with a constructor.Documentation
doc-change-requiredlabel to this PR if documentation updates are required.