Closed zeeshanakram3 closed 1 year ago
To test this I played around with the integrations tests tests/network-tests/src/flow/clis/initStorageBucket.ts
with steps like below:
const { stderr: output1 } = await cli.run('leader:update-bags', [
'--add',
bucketId,
'--bagIds',
'static:council',
'static:council',
'static:council',
'--bagIds',
'static:wg:app',
'-s',
'atomic',
])
debug(output1)
const { stderr: output2 } = await cli.run('leader:update-bags', [
'--remove',
bucketId,
'--bagIds',
'static:council',
'static:wg:storage',
'static:wg:storage',
'--updateStrategy',
'force',
])
debug(output2)
await cli.run('leader:update-bags', [
'--remove',
bucketId,
'--bagIds',
'static:wg:app',
'--updateStrategy',
'force'
])
I found it very useful to run a single flow repeatedly after starting the local dev playground. So I added a simple "scenario" for running a single flow, (with a small change to run-test-scenario.sh
to pass along additional argument) that looks like this:
import { scenario } from '../Scenario'
import path from 'path'
// eslint-disable-next-line @typescript-eslint/no-floating-promises
scenario('Single Flow', async ({ job }) => {
const pathToFlow = path.join('../flows', process.argv[2])
// eslint-disable-next-line @typescript-eslint/no-var-requires
const flows = require(pathToFlow)
const flow = flows.default || flows
job('single-flow', flow)
})
REUSE_KEYS=true DEBUG=* ./run-test-scenario.sh flow clis/initStorageBucket
yarn workspace v1.22.19
yarn run v1.22.19
$ node -r ts-node/register --unhandled-rejections=strict src/scenarios/flow.ts clis/initStorageBucket
integration-tests:api-factory Connecting to chain, attempt 1.. +0ms
Runtime Version: 12.2001.0
integration-tests:scenario Single Flow +0ms
integration-tests:job:single-flow Running +0ms
integration-tests:flow:initStorageBucketViaCLI Started +0ms
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:13:1913 info: Initializing runtime connection to: ws://localhost:9944
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:13:1913 info: Waiting for chain to be synced before proceeding.
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:13:1913 info: Updating the bag...
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:13:1913 debug: Sending utility.batchAll extrinsic...
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:14:1914 debug: Extrinsic successful!
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:14:1914 info: All extrinsic calls in the batch Tx succeeded!
integration-tests:flow:initStorageBucketViaCLI +14s
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:15:1915 info: Initializing runtime connection to: ws://localhost:9944
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:15:1915 info: Waiting for chain to be synced before proceeding.
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:15:1915 info: Updating the bag...
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:15:1915 debug: Sending utility.forceBatch extrinsic...
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:16:1916 debug: Extrinsic successful!
integration-tests:flow:initStorageBucketViaCLI 2023-07-28 00:19:16:1916 error: Following extrinsic calls in the batch Tx failed:
integration-tests:flow:initStorageBucketViaCLI [
integration-tests:flow:initStorageBucketViaCLI {
integration-tests:flow:initStorageBucketViaCLI "args": "{\"static\":{\"workingGroup\":\"Storage\"}},[],[19]",
integration-tests:flow:initStorageBucketViaCLI "error": "StorageBucketIsNotBoundToBag (The requested storage bucket is not bound to a bag.)"
integration-tests:flow:initStorageBucketViaCLI }
integration-tests:flow:initStorageBucketViaCLI ]}
integration-tests:flow:initStorageBucketViaCLI +2s
integration-tests:flow:initStorageBucketViaCLI Done +9s
integration-tests:job:single-flow [Succeeded] +25s
Job Results:
single-flow: Succeeded
Writing generated account to output.json
✨ Done in 35.33s.
✨ Done in 35.52s.
Maybe I'll open a PR with this simple addition.
addresses #4591
based on #4796