Skip to content

Commit 0fda445

Browse files
committed
refactor(client-cli, e2e): rename cardano-db download directory
1 parent 913db1a commit 0fda445

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

.github/workflows/test-client.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ jobs:
160160
- name: Cardano Database Snapshot / download & restore latest
161161
shell: bash
162162
working-directory: ./bin
163-
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download $CDB_SNAPSHOT_DIGEST --backend v1 ${{ matrix.extra_args }} 2>&1 | tee cdb-download-output.txt
163+
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download $CDB_SNAPSHOT_DIGEST --backend v1 --download-dir v1 ${{ matrix.extra_args }} 2>&1 | tee cdb-download-output.txt
164164

165165
- name: Cardano Database Snapshot / verify Cardano node starts successfully
166166
if: runner.os == 'Linux'
@@ -173,19 +173,19 @@ jobs:
173173
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174174
shell: bash
175175
working-directory: ./bin
176-
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --unstable tools utxo-hd snapshot-converter --db-directory db --cardano-node-version latest --utxo-hd-flavor LMDB --commit
176+
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --unstable tools utxo-hd snapshot-converter --db-directory v1/db --cardano-node-version latest --utxo-hd-flavor LMDB --commit
177177

178178
- name: Remove downloaded artifacts to free up disk space (Linux, Windows)
179179
if: runner.os != 'macOS'
180180
shell: bash
181181
working-directory: ./bin
182-
run: rm --force db/immutable/*.{chunk,primary,secondary}
182+
run: rm --force v1/db/immutable/*.{chunk,primary,secondary}
183183

184184
- name: Remove downloaded artifacts to free up disk space (macOs)
185185
if: runner.os == 'macOS'
186186
shell: bash
187187
working-directory: ./bin
188-
run: sudo rm -rf db/
188+
run: sudo rm -rf v1/db/
189189

190190
- name: Mithril Stake Distribution / list and get last hash
191191
shell: bash
@@ -259,13 +259,13 @@ jobs:
259259
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
260260
shell: bash
261261
working-directory: ./bin
262-
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH ${{ matrix.extra_args }} 2>&1 | tee cdb-v2-download-output.txt
262+
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download --backend v2 --download-dir v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH ${{ matrix.extra_args }} 2>&1 | tee cdb-v2-download-output.txt
263263

264264
- name: Cardano Database V2 Snapshot / verify immutables
265265
if: steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true' || steps.aggregator_capability_windows.outputs.cardano_database_v2_enabled == 'true'
266266
shell: bash
267267
working-directory: ./bin
268-
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --backend v2 --db-dir db_v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH | tee cdb-v2-verify-output.txt
268+
run: ./mithril-client ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --backend v2 --db-dir v2/db $CARDANO_DATABASE_V2_SNAPSHOT_HASH | tee cdb-v2-verify-output.txt
269269

270270
- name: Cardano Database V2 Snapshot / verify Cardano node starts successfully
271271
if: runner.os == 'Linux' && steps.aggregator_capability_unix.outputs.cardano_database_v2_enabled == 'true'
@@ -329,16 +329,16 @@ jobs:
329329
330330
- name: Cardano Database Snapshot / download & restore latest
331331
shell: bash
332-
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download $CDB_SNAPSHOT_DIGEST --backend v1 --download-dir /app/data ${{ matrix.extra_args }}
332+
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download $CDB_SNAPSHOT_DIGEST --backend v1 --download-dir /app/data/v1 ${{ matrix.extra_args }}
333333

334334
- name: Ledger state snapshot conversion from InMemory to LMDB
335335
if: matrix.extra_args == '--include-ancillary'
336336
shell: bash
337-
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --unstable tools utxo-hd snapshot-converter --db-directory /app/data/db --cardano-node-version latest --utxo-hd-flavor LMDB --commit
337+
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --unstable tools utxo-hd snapshot-converter --db-directory /app/data/v1/db --cardano-node-version latest --utxo-hd-flavor LMDB --commit
338338

339339
- name: Remove downloaded artifacts to free up disk space
340340
shell: bash
341-
run: sudo rm -rf $PWD/data/db/
341+
run: sudo rm -rf $PWD/data/v1/db/
342342

343343
- name: Mithril Stake Distribution / list and get last hash
344344
shell: bash
@@ -401,12 +401,12 @@ jobs:
401401
- name: Cardano Database V2 Snapshot / download & restore latest (Full restoration)
402402
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
403403
shell: bash
404-
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH --download-dir /app/data ${{ matrix.extra_args }}
404+
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db download --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH --download-dir /app/data/v2 ${{ matrix.extra_args }}
405405

406406
- name: Cardano Database V2 Snapshot / verify immutables
407407
if: steps.aggregator_capability.outputs.cardano_database_v2_enabled == 'true'
408408
shell: bash
409-
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH --db-dir /app/data/db_v2
409+
run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} --origin-tag CI cardano-db verify --backend v2 $CARDANO_DATABASE_V2_SNAPSHOT_HASH --db-dir /app/data/v2/db
410410

411411
test-mithril-client-wasm:
412412
strategy:

mithril-client-cli/src/commands/cardano_db/download/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use crate::{
1616
};
1717
use mithril_client::{common::ImmutableFileNumber, MithrilResult};
1818

19+
const DB_DIRECTORY_NAME: &str = "db";
20+
1921
/// Clap command to download a Cardano db and verify its associated certificate.
2022
#[derive(Parser, Debug, Clone)]
2123
pub struct CardanoDbDownloadCommand {

mithril-client-cli/src/commands/cardano_db/download/v1.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ use mithril_client::{
88
};
99

1010
use crate::{
11-
commands::{cardano_db::shared_steps, client_builder, SharedArgs},
11+
commands::{
12+
cardano_db::{download::DB_DIRECTORY_NAME, shared_steps},
13+
client_builder, SharedArgs,
14+
},
1215
configuration::ConfigParameters,
1316
utils::{
1417
CardanoDbDownloadChecker, CardanoDbUtils, ExpanderUtils, IndicatifFeedbackReceiver,
@@ -32,7 +35,7 @@ impl PreparedCardanoDbV1Download {
3235

3336
/// Command execution
3437
pub async fn execute(&self, logger: &Logger, params: ConfigParameters) -> MithrilResult<()> {
35-
let db_dir = Path::new(&self.download_dir).join("db");
38+
let db_dir = Path::new(&self.download_dir).join(DB_DIRECTORY_NAME);
3639

3740
let progress_output_type = if self.is_json_output_enabled() {
3841
ProgressOutputType::JsonReporter

mithril-client-cli/src/commands/cardano_db/download/v2.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ use mithril_client::{
1313
};
1414

1515
use crate::{
16-
commands::{cardano_db::shared_steps, client_builder, SharedArgs},
16+
commands::{
17+
cardano_db::{download::DB_DIRECTORY_NAME, shared_steps},
18+
client_builder, SharedArgs,
19+
},
1720
configuration::ConfigParameters,
1821
utils::{
1922
CardanoDbDownloadChecker, CardanoDbUtils, ExpanderUtils, IndicatifFeedbackReceiver,
@@ -45,7 +48,7 @@ pub(super) struct PreparedCardanoDbV2Download {
4548
impl PreparedCardanoDbV2Download {
4649
pub async fn execute(&self, logger: &Logger, params: ConfigParameters) -> MithrilResult<()> {
4750
let restoration_options = RestorationOptions {
48-
db_dir: Path::new(&self.download_dir).join("db_v2"),
51+
db_dir: Path::new(&self.download_dir).join(DB_DIRECTORY_NAME),
4952
immutable_file_range: shared_steps::immutable_file_range(self.start, self.end),
5053
download_unpack_options: DownloadUnpackOptions {
5154
allow_override: self.allow_override,

mithril-test-lab/mithril-end-to-end/src/mithril/client.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ impl CardanoDbCommand {
3838
vec![
3939
"download".to_string(),
4040
"--include-ancillary".to_string(),
41+
"--download-dir".to_string(),
42+
"v1".to_string(),
4143
digest.clone(),
4244
]
4345
}
@@ -73,6 +75,8 @@ impl CardanoDbV2Command {
7375
vec![
7476
"download".to_string(),
7577
"--include-ancillary".to_string(),
78+
"--download-dir".to_string(),
79+
"v2".to_string(),
7680
hash.clone(),
7781
]
7882
}

0 commit comments

Comments
 (0)