Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ build-test-utils: ocaml_checks reformat-diff ## Build test utilities
src/test/command_line_tests/command_line_tests.exe \
src/test/archive/patch_archive_test/patch_archive_test.exe \
src/test/archive/archive_node_tests/archive_node_tests.exe \
src/app/archive_hardfork_toolbox/tests/test_convert_canonical.exe \
--profile=$(DUNE_PROFILE) \
&& echo "✅ Build complete"

Expand Down
6 changes: 4 additions & 2 deletions buildkite/src/Command/ArchiveNodeTest.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ in { step =
[ "ARCHIVE_TEST_APP=mina-archive-node-test"
, "MINA_TEST_NETWORK_DATA=/etc/mina/test/archive/sample_db"
]
( RunWithPostgres.ScriptOrArchive.Script
"src/test/archive/sample_db/archive_db.sql"
( Some
( RunWithPostgres.ScriptOrArchive.Script
"src/test/archive/sample_db/archive_db.sql"
)
)
( Artifacts.fullDockerTag
Artifacts.Tag::{
Expand Down
6 changes: 4 additions & 2 deletions buildkite/src/Command/PatchArchiveTest.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ in { step =
[ "PATCH_ARCHIVE_TEST_APP=mina-patch-archive-test"
, "NETWORK_DATA_FOLDER=/etc/mina/test/archive/sample_db"
]
( RunWithPostgres.ScriptOrArchive.Script
"./src/test/archive/sample_db/archive_db.sql"
( Some
( RunWithPostgres.ScriptOrArchive.Script
"./src/test/archive/sample_db/archive_db.sql"
)
)
( Artifacts.fullDockerTag
Artifacts.Tag::{
Expand Down
6 changes: 4 additions & 2 deletions buildkite/src/Command/ReplayerTest.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ in { step =
, commands =
[ RunWithPostgres.runInDockerWithPostgresConn
([] : List Text)
( RunWithPostgres.ScriptOrArchive.Script
"./src/test/archive/sample_db/archive_db.sql"
( Some
( RunWithPostgres.ScriptOrArchive.Script
"./src/test/archive/sample_db/archive_db.sql"
)
)
( Artifacts.fullDockerTag
Artifacts.Tag::{
Expand Down
33 changes: 20 additions & 13 deletions buildkite/src/Command/RunWithPostgres.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ for database-dependent operations.

**Parameters:**
- `environment : List Text` - Additional environment variables to pass to the container
- `initScript : Text` - Path to SQL initialization script to run against the database
- `initScript : Optional ScriptOrArchive` - Optional database initialization. Either a script path or an archive + script selector.
- `docker : Text` - Docker image name to run the main command in
- `innerScript : Text` - Script or command to execute inside the Docker container

Expand Down Expand Up @@ -46,7 +46,6 @@ for database-dependent operations.
- `PG_CONN` - Full database connection string
-}


let Prelude = ../External/Prelude.dhall

let P = Prelude
Expand All @@ -62,9 +61,9 @@ let ScriptOrArchive
= < Script : Text | Archive : { Script : Text, Archive : Text } >

let runInDockerWithPostgresConn
: List Text -> ScriptOrArchive -> Text -> Text -> Cmd.Type
: List Text -> Optional ScriptOrArchive -> Text -> Text -> Cmd.Type
= \(environment : List Text)
-> \(initScript : ScriptOrArchive)
-> \(initScript : Optional ScriptOrArchive)
-> \(docker : Text)
-> \(innerScript : Text)
-> let port = "5432"
Expand Down Expand Up @@ -103,15 +102,23 @@ let runInDockerWithPostgresConn

let runInitScript =
merge
{ Script =
\(script : Text)
-> [ "docker exec ${postgresDockerName} psql ${pg_conn} -f /workdir/${script}"
]
, Archive =
\(archive : { Script : Text, Archive : Text })
-> [ "tar -xzf ${archive.Archive}"
, "docker exec ${postgresDockerName} find /workdir -name \"${archive.Script}\" -exec psql ${pg_conn} -f {} \\;"
]
{ Some =
\(script : ScriptOrArchive)
-> merge
{ Script =
\(s : Text)
-> [ "docker exec ${postgresDockerName} psql ${pg_conn} -f /workdir/${s}"
]
, Archive =
\ ( archive
: { Script : Text, Archive : Text }
)
-> [ "tar -xzf ${archive.Archive}"
, "docker exec ${postgresDockerName} find /workdir -name \"${archive.Script}\" -exec psql ${pg_conn} -f {} \\;"
]
}
script
, None = [] : List Text
}
initScript

Expand Down
24 changes: 14 additions & 10 deletions buildkite/src/Jobs/Test/ArchiveHardforkToolboxTest.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ in Pipeline.build
, commands =
[ RunWithPostgres.runInDockerWithPostgresConn
([] : List Text)
( RunWithPostgres.ScriptOrArchive.Archive
{ Script = "post_upgrade_archive.sql"
, Archive =
"scripts/tests/archive-hardfork-toolbox/post_upgrade_archive.tar.gz"
}
( Some
( RunWithPostgres.ScriptOrArchive.Archive
{ Script = "post_upgrade_archive.sql"
, Archive =
"scripts/tests/archive-hardfork-toolbox/post_upgrade_archive.tar.gz"
}
)
)
( Artifacts.fullDockerTag
Artifacts.Tag::{
Expand All @@ -72,11 +74,13 @@ in Pipeline.build
)
, RunWithPostgres.runInDockerWithPostgresConn
([] : List Text)
( RunWithPostgres.ScriptOrArchive.Archive
{ Script = "hf_archive.sql"
, Archive =
"scripts/tests/archive-hardfork-toolbox/hf_archive.tar.gz"
}
( Some
( RunWithPostgres.ScriptOrArchive.Archive
{ Script = "hf_archive.sql"
, Archive =
"scripts/tests/archive-hardfork-toolbox/hf_archive.tar.gz"
}
)
)
( Artifacts.fullDockerTag
Artifacts.Tag::{
Expand Down
37 changes: 30 additions & 7 deletions buildkite/src/Jobs/Test/EmergencyHfTest.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,28 @@ let Command = ../../Command/Base.dhall

let Size = ../../Command/Size.dhall

let Cmd = ../../Lib/Cmds.dhall
let Artifacts = ../../Constants/Artifacts.dhall

let BuildFlags = ../../Constants/BuildFlags.dhall

let RunWithPostgres = ../../Command/RunWithPostgres.dhall

let Dockers = ../../Constants/DockerVersions.dhall

let key = "emergency-hf-test"

let dependsOn =
Dockers.dependsOn
Dockers.DepsSpec::{
, buildFlags = BuildFlags.Type.Instrumented
, artifact = Artifacts.Type.FunctionalTestSuite
}

in Pipeline.build
Pipeline.Config::{
, spec = JobSpec::{
, dirtyWhen =
[ S.strictlyStart (S.contains "scripts/archive/emergency_hf")
, S.strictlyStart (S.contains "src/app/archive")
]
[ S.strictlyStart (S.contains "src/app/archive_hardfork_toolbox") ]
, path = "Test"
, name = "EmergencyHfTest"
, tags =
Expand All @@ -31,12 +44,22 @@ in Pipeline.build
[ Command.build
Command.Config::{
, commands =
[ Cmd.run
"PSQL=\"docker exec replayer-postgres psql\" ./scripts/archive/emergency_hf/test/runner.sh "
[ RunWithPostgres.runInDockerWithPostgresConn
[ "CONVERT_CANONICAL_BLOCKS_TEST_APP=mina-test-convert-canonical"
]
(None RunWithPostgres.ScriptOrArchive)
( Artifacts.fullDockerTag
Artifacts.Tag::{
, artifact = Artifacts.Type.FunctionalTestSuite
, buildFlags = BuildFlags.Type.Instrumented
}
)
"./scripts/tests/archive-hardfork-toolbox/test-convert-canonical-blocks.sh && buildkite/scripts/upload-partial-coverage-data.sh ${key} "
]
, label = "Emergency HF test"
, key = "emergency-hf-test"
, key = key
, target = Size.Large
, depends_on = dependsOn
}
]
}
6 changes: 4 additions & 2 deletions buildkite/src/Jobs/Test/RosettaIntegrationTests.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ in Pipeline.build
"export MINA_DEB_CODENAME=bullseye && source ./buildkite/scripts/export-git-env-vars.sh && echo \\\${MINA_DOCKER_TAG}"
, RunWithPostgres.runInDockerWithPostgresConn
([] : List Text)
( RunWithPostgres.ScriptOrArchive.Script
"./src/test/archive/sample_db/archive_db.sql"
( Some
( RunWithPostgres.ScriptOrArchive.Script
"./src/test/archive/sample_db/archive_db.sql"
)
)
rosettaDocker
"./buildkite/scripts/rosetta-indexer-test.sh"
Expand Down
81 changes: 0 additions & 81 deletions scripts/archive/emergency_hf/convert_chain_to_canonical.sh

This file was deleted.

Loading