Skip to content

Commit d748a9e

Browse files
committed
Ci for rosetta block race test
1 parent b82289d commit d748a9e

File tree

3 files changed

+118
-2
lines changed

3 files changed

+118
-2
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
let Artifacts = ../Constants/Artifacts.dhall
2+
3+
let BuildFlags = ../Constants/BuildFlags.dhall
4+
5+
let Command = ./Base.dhall
6+
7+
let Size = ./Size.dhall
8+
9+
let RunWithPostgres = ./RunWithPostgres.dhall
10+
11+
let key = "rosetta-block-race-test"
12+
13+
in { step =
14+
\(dependsOn : List Command.TaggedKey.Type)
15+
-> Command.build
16+
Command.Config::{
17+
, commands =
18+
[ RunWithPostgres.runInDockerWithPostgresConn
19+
([] : List Text)
20+
( Some
21+
( RunWithPostgres.ScriptOrArchive.Script
22+
"./src/app/archive/create_schema.sql"
23+
)
24+
)
25+
( Artifacts.fullDockerTag
26+
Artifacts.Tag::{
27+
, artifact = Artifacts.Type.FunctionalTestSuite
28+
, buildFlags = BuildFlags.Type.Instrumented
29+
}
30+
)
31+
( "./scripts/rosetta-block-race-with-data.sh "
32+
++ "--mina-exe mina "
33+
++ "--archive-exe mina-archive "
34+
++ "--rosetta-exe mina-rosetta "
35+
++ "--postgres-port \\\${PG_PORT} "
36+
++ "--postgres-user \\\${POSTGRES_USER} "
37+
++ "--postgres-password \\\${POSTGRES_PASSWORD} "
38+
++ "--postgres-db \\\${POSTGRES_DB} "
39+
++ "--postgres-host localhost "
40+
++ "&& buildkite/scripts/upload-partial-coverage-data.sh ${key}"
41+
)
42+
]
43+
, label = "Rosetta: Rosetta Block Race test"
44+
, key = key
45+
, target = Size.Large
46+
, depends_on = dependsOn
47+
}
48+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
let S = ../../Lib/SelectFiles.dhall
2+
3+
let Pipeline = ../../Pipeline/Dsl.dhall
4+
5+
let PipelineTag = ../../Pipeline/Tag.dhall
6+
7+
let JobSpec = ../../Pipeline/JobSpec.dhall
8+
9+
let Artifacts = ../../Constants/Artifacts.dhall
10+
11+
let Dockers = ../../Constants/DockerVersions.dhall
12+
13+
let BuildFlags = ../../Constants/BuildFlags.dhall
14+
15+
let RosettaBlockRaceTest = ../../Command/RosettaBlockRaceTest.dhall
16+
17+
let dependsOn =
18+
Dockers.dependsOn
19+
Dockers.DepsSpec::{
20+
, artifact = Artifacts.Type.FunctionalTestSuite
21+
, buildFlags = BuildFlags.Type.Instrumented
22+
}
23+
24+
in Pipeline.build
25+
Pipeline.Config::{
26+
, spec = JobSpec::{
27+
, dirtyWhen =
28+
[ S.strictlyStart (S.contains "src")
29+
, S.exactly "scripts/rosetta/test-block-race-with-data" "sh"
30+
, S.exactly "scripts/rosetta/test-block-race" "sh"
31+
, S.exactly "buildkite/src/Jobs/Test/RosettaBlockRaceTest" "dhall"
32+
, S.exactly "buildkite/src/Command/RosettaBlockRaceTest" "dhall"
33+
]
34+
, path = "Test"
35+
, name = "RosettaBlockRaceTest"
36+
, tags =
37+
[ PipelineTag.Type.Long
38+
, PipelineTag.Type.Test
39+
, PipelineTag.Type.Stable
40+
]
41+
}
42+
, steps = [ RosettaBlockRaceTest.step dependsOn ]
43+
}

scripts/rosetta/test-block-race-with-data.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ LEDGER_ARCHIVE="ledger.tar"
3636
DB_DIR="db"
3737
LEDGER_DIR="ledger"
3838

39+
CURRENT_USER=$(whoami)
40+
POSTGRES_USER="$CURRENT_USER"
41+
POSTGRES_PASSWORD=""
42+
POSTGRES_DB="archive"
43+
POSTGRES_HOST="localhost"
44+
3945
# Function to display usage
4046
usage() {
4147
cat << EOF
@@ -48,6 +54,10 @@ Required parameters:
4854
4955
Optional parameters:
5056
--postgres-port PORT PostgreSQL server port (default: $POSTGRES_PORT)
57+
--postgres-user USER PostgreSQL user (default: $POSTGRES_USER)
58+
--postgres-password PASS PostgreSQL password (default: empty)
59+
--postgres-db DB PostgreSQL database name (default: $POSTGRES_DB)
60+
--postgres-host HOST PostgreSQL host (default: $POSTGRES_HOST)
5161
--port-base PORT Base port number for services (default: $PORT_BASE)
5262
--num-blocks N Number of blocks to generate (default: $NUM_BLOCKS)
5363
--num-zkapp-txs N Number of zkApp transactions (default: $NUM_ZKAPP_TXS)
@@ -71,6 +81,22 @@ while [[ $# -gt 0 ]]; do
7181
POSTGRES_PORT="$2"
7282
shift 2
7383
;;
84+
--postgres-user)
85+
POSTGRES_USER="$2"
86+
shift 2
87+
;;
88+
--postgres-password)
89+
POSTGRES_PASSWORD="$2"
90+
shift 2
91+
;;
92+
--postgres-db)
93+
POSTGRES_DB="$2"
94+
shift 2
95+
;;
96+
--postgres-host)
97+
POSTGRES_HOST="$2"
98+
shift 2
99+
;;
74100
--port-base)
75101
PORT_BASE="$2"
76102
shift 2
@@ -182,8 +208,7 @@ if [[ ! -x "$ROSETTA_EXE" ]]; then
182208
fi
183209

184210
# Get current username for postgres URI
185-
CURRENT_USER=$(whoami)
186-
POSTGRES_URI="postgres://$CURRENT_USER@localhost:$POSTGRES_PORT/archive"
211+
POSTGRES_URI="postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"
187212

188213
# PID for postgres cleanup
189214
POSTGRES_PID=""

0 commit comments

Comments
 (0)