Skip to content

Commit

Permalink
feat: add integration test prerequisites to CI, fix rpc tests
Browse files Browse the repository at this point in the history
chore: update postgres service, fmt

chore(ci): use secrets for mainnet & devnet RPC urls

chore(ci): set RUST_LOG to `trace`

feat(integration_tests): init env logger in `test_asset_decompress`

chore(integration_tests): make compressed `test_asset_decompress` traced

chore(ci): add postgres port mapping
  • Loading branch information
armyhaylenko committed Jan 10, 2025
1 parent a5ba664 commit 1408fd9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:14-alpine
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out
uses: actions/checkout@v3
Expand Down Expand Up @@ -115,4 +128,8 @@ jobs:
key: ${{ steps.cache-cargo.outputs.cache-primary-key }}

- name: Run tests
run: cargo test --features integration_tests -- --nocapture --quiet
env:
DATABASE_TEST_URL: "postgres://postgres:[email protected]:5432/postgres"
DEVNET_RPC_URL: ${{ secrets.SOLANA_DEVNET_RPC_URL }}
MAINNET_RPC_URL: ${{ secrets.SOLANA_MAINNET_RPC_URL }}
run: cargo test --features integration_tests -- --nocapture
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions backfill_rpc/src/slots_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ async fn test_rpc_get_slots() {

let client = BackfillRPC::connect("https://api.mainnet-beta.solana.com".to_string());
let slots = client
.get_slots(
.get_slots_sorted_desc(
&Pubkey::from_str("Vote111111111111111111111111111111111111111").unwrap(),
253484000,
2,
)
.await
.unwrap();

assert_eq!(slots.is_empty(), false)
assert!(!slots.is_empty())
}
2 changes: 2 additions & 0 deletions integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ tokio = { workspace = true }
tokio-stream = { workspace = true }
rocksdb = { workspace = true }
tempfile = {workspace = true}
env_logger = { workspace = true }
tracing-test = { workspace = true }

nft_ingester = { path = "../nft_ingester" }
postgre-client = { path = "../postgre-client", features = ["integration_tests"] }
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/src/cnft_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ pub async fn run_get_asset_scenario_test(
}

#[tokio::test]
#[tracing_test::traced_test]
#[serial]
#[named]
async fn test_asset_decompress() {
env_logger::init();

let name = trim_test_name(function_name!());
let setup = TestSetup::new_with_options(
name.clone(),
Expand Down
3 changes: 3 additions & 0 deletions nft_ingester/src/message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,12 @@ fn test_token_account_uninitialized() {
#[cfg(feature = "rpc_tests")]
#[tokio::test]
async fn test_edition_pda() {
use std::str::FromStr;

use blockbuster::program_handler::ProgramParser;
use blockbuster::programs::token_metadata::{TokenMetadataAccountData, TokenMetadataParser};
use blockbuster::programs::ProgramParseResult;
use flatbuffers::FlatBufferBuilder;
use mpl_token_metadata::accounts::MasterEdition;
use plerkle_serialization::deserializer::PlerkleOptionalU8Vector;
use plerkle_serialization::solana_geyser_plugin_interface_shims::ReplicaAccountInfoV2;
Expand Down

0 comments on commit 1408fd9

Please sign in to comment.