Skip to content

Commit

Permalink
Use mithril to setup windows E2E
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed Jan 21, 2025
1 parent 581dc72 commit a416c30
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ steps:
agents:
system: ${linux}


- label: Build Testing Bundle (windows)
key: windows-testing-bundle
depends_on:
Expand Down Expand Up @@ -602,6 +603,9 @@ steps:
system: ${windows}
env:
TESTS_E2E_FIXTURES: "$FIXTURE_DECRYPTION_KEY"
NODE_DB_DIR: "test\\e2e\\state\\node_db\\preprod"
AGGREGATOR_ENDPOINT: "${PREPROD_AGGREGATOR_ENDPOINT}"
GENESIS_VERIFICATION_KEY: "${PREPROD_GENESIS_VERIFICATION_KEY}"
concurrency: 1
concurrency_group: 'windows-e2e-tests'

Expand Down
46 changes: 35 additions & 11 deletions scripts/buildkite/main/windows-e2e.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
set PATH=%PATH%;C:\Users\hal\AppData\Local\Microsoft\WinGet\Links

REM ------------- mithril -------------

SET mithril-tar=mithril-2450.0-windows-x64.tar
echo %mithril-tar%
SET mithril-package=%mithril-tar%.gz
echo %mithril-package%
wget https://github.com/input-output-hk/mithril/releases/download/2450.0/%mithril-package%
7z x .\%mithril-package%
tar xf .\%mithril-tar%
.\mithril-client.exe --version
for /f "delims=" %%i in ('.\mithril-client.exe cdb snapshot list --json ^| jq -r .[0].digest') do set digest=%%i
echo %digest%
.\mithril-client.exe cdb download --download-dir %NODE_DB_DIR% %digest%
move %NODE_DB_DIR%\db\* %NODE_DB_DIR%
ls %NODE_DB_DIR%

REM ------------- ruby tests -------------

cd test\e2e
rmdir state\configs\preprod
md state\node_db\preprod
aws s3 cp s3://hal-team/preprod-20250102.zstd ./preprod-20250102.tar.zst
tar xzf ./preprod-20250102.tar.zst
mv db\* state\node_db\preprod\
bundle exec rake setup[preprod,%BUILDKITE_BRANCH%]
bundle exec rake display_versions
bundle exec rake start_node_and_wallet[preprod]
bundle exec rake wait_until_node_synced
bundle exec rake spec SPEC_OPTS="-e 'Stake Pools'"
bundle exec rake stop_node_and_wallet[preprod]

echo "Running Ruby tests"
echo "Setting up preprod environment"
rm -rf state\configs\preprod
REM copy the preprod config from the root config folder instead of deleting the link

call bundle exec rake setup[preprod,%BUILDKITE_BRANCH%]
echo "Displaying versions"
call bundle exec rake display_versions
echo "Starting node and wallet"
call bundle exec rake start_node_and_wallet[preprod]
echo "Waiting for node to sync"
call bundle exec rake wait_until_node_synced
echo "Running tests"
call bundle exec rake spec SPEC_OPTS="-e 'Stake Pools'"
echo "Stopping node and wallet"
call bundle exec rake stop_node_and_wallet[preprod]
7 changes: 6 additions & 1 deletion test/e2e/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ task :start_node_and_wallet, [:env] do |_task, args|
log '>> Setting up cardano-node and cardano-wallet'

bin_dir = BINS == '' ? BINS : "#{BINS}/"
log ">> Using binaries from '#{bin_dir}'"
config_dir = File.join(CONFIGS, args[:env])
log ">> Using config directory '#{config_dir}'"
log_dir = File.join(LOGS, args[:env])
Expand All @@ -165,6 +166,7 @@ task :start_node_and_wallet, [:env] do |_task, args|
if win?
# create cardano-node.bat file
node_cmd = "#{bin_dir}cardano-node.exe run --config #{config_dir}/config.json --topology #{config_dir}/topology.json --database-path #{node_db_dir} --socket-path \\\\.\\pipe\\cardano-node-testnet"
log ">> Starting cardano-node with command: #{node_cmd}"
File.write('cardano-node.bat', node_cmd)

# create cardano-wallet.bat file
Expand Down Expand Up @@ -193,6 +195,7 @@ task :start_node_and_wallet, [:env] do |_task, args|
cmd log_stderr_wallet
cmd start_node
cmd start_wallet

else
start_node = <<~CMD
#{bin_dir}cardano-node run \
Expand Down Expand Up @@ -337,14 +340,15 @@ task :get_latest_configs, [:env] do |_task, args|
mk_dir(STATE)
mk_dir(CONFIGS)
mk_dir(out)
log ">> Getting latest configs from #{base_url}"
config_file = File.join(out, 'config.json')
wget("#{base_url}config.json", config_file)
wget("#{base_url}byron-genesis.json", "#{out}/byron-genesis.json")
wget("#{base_url}shelley-genesis.json", "#{out}/shelley-genesis.json")
wget("#{base_url}alonzo-genesis.json", "#{out}/alonzo-genesis.json")
wget("#{base_url}conway-genesis.json", "#{out}/conway-genesis.json")
wget("#{base_url}topology.json", "#{out}/topology.json")

log ">> Configs are ready in #{out}"
config_dir = File.join(CONFIGS, args[:env])
# Temporary/ad-hoc config changes for cardano-node:
config_json = JSON.parse(File.read("#{config_dir}/config.json"))
Expand All @@ -361,6 +365,7 @@ task :get_latest_configs, [:env] do |_task, args|
]
})
File.write("#{config_dir}/topology.json", topology)
log ">> Configs are ready in #{out}"
end
end

Expand Down

0 comments on commit a416c30

Please sign in to comment.