@@ -239,7 +239,7 @@ ipfs-start test_dir: _check-docker
239239 docker logs -f ipfs-node > {{ test_dir }} / ipfs-node.log 2 >&1 &
240240 docker exec ipfs-node ipfs log level bitswap debug
241241 docker exec ipfs-node ipfs log level bitswap/ client debug
242-
242+
243243 # Store container name in PID directory for cleanup
244244 echo " ipfs-node" > {{ test_dir }} / ipfs-docker.container
245245
@@ -316,12 +316,15 @@ ipfs-reconnect-start test_dir runtime:
316316 sleep 2
317317
318318# Generate PAPI descriptors
319- papi-generate :
319+ # Generate PAPI descriptors from a running node
320+ # Parameters:
321+ # ws_url - WebSocket URL of the node (default: ws://localhost:10000)
322+ papi-generate ws_url ="ws : //localhost :10000":
320323 #!/usr/bin/env bash
321324 set -e
322325
323- echo " 🔧 Generating PAPI descriptors..."
324- npm run papi:generate
326+ echo " 🔧 Generating PAPI descriptors from {{ ws_url }} ..."
327+ npx papi add -w " {{ ws_url }} " bulletin
325328
326329# Setup all services using Docker for IPFS
327330# Parameters:
@@ -365,10 +368,82 @@ teardown-services test_dir:
365368 just ipfs-shutdown " {{ test_dir }} "
366369 echo " ✅ Docker services stopped"
367370
371+ # Start all services for a runtime (use with run-test-* recipes)
372+ # Usage: just start-services /tmp/my-test-dir bulletin-polkadot-runtime
373+ start-services test_dir runtime : npm-install
374+ #!/usr/bin/env bash
375+ set -e
376+ mkdir -p " {{ test_dir }} "
377+ just setup-services " {{ test_dir }} " " {{ runtime }} "
378+
379+ # Stop all services
380+ # Usage: just stop-services /tmp/my-test-dir
381+ stop-services test_dir :
382+ #!/usr/bin/env bash
383+ echo " 📁 Stopping services - test directory: {{ test_dir }} "
384+ just teardown-services " {{ test_dir }} "
385+ echo " ✅ Services stopped"
386+
387+ # Run authorize-and-store test only (services must already be running via start-services)
388+ # Parameters:
389+ # test_dir - Test directory where services are running
390+ # runtime - Runtime name for smoldot chainspec path resolution
391+ # mode - Connection mode: "ws" (WebSocket RPC node) or "smoldot" (light client)
392+ run-test-authorize-and-store test_dir runtime mode = " ws":
393+ #!/usr/bin/env bash
394+ set -e
395+
396+ if [ " {{ mode }} " = " smoldot" ]; then
397+ echo " 🧪 Running authorize and store test (mode: smoldot, runtime: {{ runtime }} )..."
398+ SCRIPT_NAME=" authorize_and_store_papi_smoldot.js"
399+ elif [ " {{ mode }} " = " ws" ]; then
400+ echo " 🧪 Running authorize and store test (mode: ws, runtime: {{ runtime }} )..."
401+ SCRIPT_NAME=" authorize_and_store_papi.js"
402+ else
403+ echo " ❌ Error: Invalid mode '{{ mode }} '. Must be 'ws' or 'smoldot'"
404+ exit 1
405+ fi
406+
407+ # Run the script with chainspec_path parameter only for smoldot mode
408+ if [ " {{ mode }} " = " smoldot" ]; then
409+ if [ " {{ runtime }} " = " bulletin-westend-runtime" ]; then
410+ RELAY_CHAINSPEC_PATH=" {{ test_dir }} /bob/cfg/westend-local.json"
411+ PARACHAIN_CHAINSPEC_PATH=" {{ test_dir }} /bulletin-westend-collator-2/cfg/westend-local-1006.json"
412+ node $SCRIPT_NAME " $RELAY_CHAINSPEC_PATH" " $PARACHAIN_CHAINSPEC_PATH"
413+ else
414+ CHAINSPEC_PATH=" {{ test_dir }} /bob/cfg/bulletin-polkadot-local.json"
415+ node $SCRIPT_NAME " $CHAINSPEC_PATH"
416+ fi
417+ else
418+ node $SCRIPT_NAME
419+ fi
420+
421+ # Run store-chunked-data test only (services must already be running via start-services)
422+ # Parameters:
423+ # test_dir - Test directory where services are running
424+ run-test-store-chunked-data test_dir :
425+ #!/usr/bin/env bash
426+ set -e
427+ echo " 🧪 Running store chunked data test (test_dir: {{ test_dir }} )..."
428+ node store_chunked_data.js
429+
430+ # Run store-big-data test only (services must already be running via start-services)
431+ # Parameters:
432+ # test_dir - Test directory where services are running
433+ run-test-store-big-data test_dir :
434+ #!/usr/bin/env bash
435+ set -e
436+ echo " 🧪 Running store big data test (test_dir: {{ test_dir }} )..."
437+ node store_big_data.js
438+
439+ # ============================================================================
440+ # Standalone recipes (with full setup/teardown) - kept for local dev convenience
441+ # ============================================================================
442+
368443# Run authorize and store example with Docker IPFS
369444# Parameters:
370445# mode - Connection mode: "ws" (WebSocket RPC node) or "smoldot" (light client)
371- # runtime - Runtime name (e.g., "bulletin-polkadot-runtime", "bulletin-westend-runtime", "polkadot-bulletin-chain-runtime" )
446+ # runtime - Runtime name (e.g., "bulletin-polkadot-runtime", "bulletin-westend-runtime")
372447run-authorize-and-store runtime mode = " ws": npm-install
373448 #!/usr/bin/env bash
374449 set -e
@@ -467,3 +542,30 @@ run-store-big-data runtime: npm-install
467542
468543 just teardown-services " $TEST_DIR"
469544 exit $EXAMPLE_EXIT
545+
546+ # ============================================================================
547+ # Run tests against external environments
548+ # ============================================================================
549+
550+ # Run authorize-and-store test against an external endpoint
551+ # Parameters:
552+ # ws_url - WebSocket URL of the Bulletin chain node
553+ # seed - Account seed phrase or dev seed (e.g., "//Alice" or "word1 word2 ...")
554+ run-tests-against ws_url seed : npm-install
555+ #!/usr/bin/env bash
556+ set -e
557+ echo " 🧪 Running authorize-and-store test against external endpoint..."
558+ echo " URL: {{ ws_url }} "
559+ just papi-generate " {{ ws_url }} "
560+
561+ # TODO: connect to the local IPFS:8080
562+ # TODO: find out the WS/IP/ live node address
563+
564+ # node authorize_and_store_papi.js "{{ ws_url }}" "{{ seed }}"
565+ node store_big_data.js " {{ ws_url }} " " {{ seed }} "
566+
567+ # Run authorize-and-store test against Westend
568+ # Parameters:
569+ # seed - Account seed phrase or dev seed (e.g., "//Alice" or "word1 word2 ...")
570+ run-tests-against-westend seed :
571+ just run-tests-against " wss://westend-bulletin-rpc.polkadot.io" " {{ seed }} "
0 commit comments