Skip to content

Commit f2f2f74

Browse files
authored
Merge branch 'master' into ci/update_grpc2
2 parents fe9c4f5 + c398249 commit f2f2f74

24 files changed

+872
-269
lines changed

.github/workflows/rpc-performance-tests.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ jobs:
9797

9898
# Save test results to a directory with timestamp and commit hash
9999
cp -r ${{runner.workspace}}/rpc-tests/perf/reports/mainnet $RPC_PAST_TEST_DIR/mainnet_$(date +%Y%m%d_%H%M%S)_perf_$(git -C ${{runner.workspace}}/silkworm rev-parse --short HEAD)
100+
101+
# Detect the pre-built db version
102+
db_version=$(python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/prod_info.py $ERIGON_DIR/production.ini production erigon_repo_commit)
103+
100104
# Check test runner script exit status
101105
if [ $perf_exit_status -eq 0 ]; then
102106

@@ -107,13 +111,29 @@ jobs:
107111
cp -r ${{runner.workspace}}/rpc-tests/perf/reports/bin ${{runner.workspace}}/last_execution_test/
108112

109113
echo "Save test result on DB"
110-
cd ${{runner.workspace}}/silkworm
111-
python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo silkworm --branch ${{ github.ref_name }} --commit $(git rev-parse HEAD) --test_name rpc-performance-test-${servers[i-1]}-$method --chain mainnet --outcome success --result_file ${{runner.workspace}}/rpc-tests/perf/reports/mainnet/result.json
114+
cd ${{runner.workspace}}/silkworm
115+
python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py \
116+
--repo silkworm \
117+
--branch ${{ github.ref_name }} \
118+
--commit $(git rev-parse HEAD) \
119+
--test_name rpc-performance-test-${servers[i-1]}-$method \
120+
--chain mainnet \
121+
--runner ${{ runner.name }} \
122+
--db_version $db_version \
123+
--outcome success \
124+
--result_file ${{runner.workspace}}/rpc-tests/perf/reports/mainnet/result.json
112125
else
113126
failed_test=1
114127
cd ${{runner.workspace}}/silkworm
115-
python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py --repo silkworm --branch ${{ github.ref_name }} --commit $(git rev-parse HEAD) --test_name rpc-performance-test-${servers[i-1]}-$method --chain mainnet --outcome failure
116-
128+
python3 $ERIGON_QA_PATH/test_system/qa-tests/uploads/upload_test_results.py \
129+
--repo silkworm \
130+
--branch ${{ github.ref_name }} \
131+
--commit $(git rev-parse HEAD) \
132+
--test_name rpc-performance-test-${servers[i-1]}-$method \
133+
--chain mainnet \
134+
--runner ${{ runner.name }} \
135+
--db_version $db_version \
136+
--outcome failure
117137
fi
118138
done
119139

silkworm/capi/silkworm_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace snapshot_test = snapshots::test_util;
4141
struct CApiTest : public db::test_util::TestDatabaseContext {
4242
TemporaryDirectory tmp_dir;
4343
SilkwormSettings settings{.log_verbosity = SilkwormLogLevel::SILKWORM_LOG_NONE};
44+
mdbx::env_managed& db{get_mdbx_env()};
4445
};
4546

4647
//! Utility to copy `src` C-string to `dst` fixed-size char array

silkworm/db/test_util/test_database_context.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ namespace {
188188

189189
} // namespace
190190

191-
TestDatabaseContext::TestDatabaseContext() : db{initialize_test_database()} {}
191+
TestDatabaseContext::TestDatabaseContext() : db_{initialize_test_database()} {}
192+
193+
silkworm::ChainConfig TestDatabaseContext::get_chain_config() {
194+
db::ROTxnManaged txn{db_};
195+
auto chain_config = db::read_chain_config(txn);
196+
return chain_config ? *chain_config : silkworm::ChainConfig{};
197+
}
192198

193199
} // namespace silkworm::db::test_util

silkworm/db/test_util/test_database_context.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ class TestDatabaseContext {
3434
TestDatabaseContext();
3535

3636
~TestDatabaseContext() {
37-
auto db_path = db.get_path();
38-
db.close();
37+
auto db_path = db_.get_path();
38+
db_.close();
3939
std::filesystem::remove_all(db_path);
4040
}
4141

42-
mdbx::env_managed db;
42+
mdbx::env_managed& get_mdbx_env() { return db_; }
43+
db::EnvConfig get_env_config() { return env_config_; }
44+
silkworm::ChainConfig get_chain_config();
45+
46+
private:
47+
mdbx::env_managed db_;
48+
db::EnvConfig env_config_;
4349
};
4450

4551
} // namespace silkworm::db::test_util

0 commit comments

Comments
 (0)