Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTG-1028 Add integration tests for freeze authorities & delegate auth… #389

Merged
Merged
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
4 changes: 2 additions & 2 deletions integration_tests/run_postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ IMAGE_NAME="postgres:14"
DB_USER="solana"
DB_PASSWORD="solana"
DB_NAME="solana"
DB_PATH="./db-data"
ROCKS_DUMP_PATH="./rocks_dump"
DB_PATH="$(pwd)/db-data"
ROCKS_DUMP_PATH="$(pwd)/rocks_dump"
HOST_PORT="5432"
CONTAINER_PORT="5432"

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const API_MAX_PAGE_LIMIT: usize = 100;

const DUMP_SYNCHRONIZER_BATCH_SIZE: usize = 1000;
const SYNCHRONIZER_PARALLEL_TASKS: usize = 1;
const SYNCHRONIZER_DUMP_PATH: &str = "rocks_dump";
const SYNCHRONIZER_DUMP_PATH: &str = "./rocks_dump";

const POSTGRE_MIGRATIONS_PATH: &str = "../migrations";
const POSTGRE_BASE_DUMP_PATH: &str = "/aura/integration_tests/";
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ÓêŒõ¬¬¨Í u\CÎõJ]ÙžÞ ¡kU%78ó—Ü
1 change: 1 addition & 0 deletions integration_tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ mod general_scenario_tests;
mod mpl_core_tests;
mod regular_nft_tests;
mod synchronizer_tests;
mod token_tests;
11 changes: 9 additions & 2 deletions integration_tests/src/regular_nft_tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
use std::sync::Arc;

use entities::api_req_params::{GetAsset, GetAssetBatch, GetAssetsByGroup, SearchAssets};
use entities::{
api_req_params::{GetAsset, GetAssetBatch, GetAssetsByGroup, SearchAssets},
enums::AssetType,
};
use function_name::named;
use itertools::Itertools;
use nft_ingester::api::dapi::response::AssetList;
use rocks_db::storage_traits::AssetIndexReader;
use serial_test::serial;
use tokio::{sync::Mutex, task::JoinSet};
use tokio::{
sync::{broadcast, Mutex},
task::JoinSet,
};

use super::common::*;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
source: integration_tests/src/token_tests.rs
assertion_line: 38
expression: response
snapshot_kind: text
---
{
"interface": "Custom",
"id": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"content": {
"$schema": "https://schema.metaplex.com/nft1.0.json",
"json_uri": "",
"files": [],
"metadata": {
"name": "USD Coin",
"symbol": "USDC"
},
"links": {}
},
"authorities": [
{
"address": "2wmVCSfPxGPjrnMMn7rchp4uaeoTqN39mXFC2zhPdri9",
"scopes": [
"full"
]
}
],
"compression": {
"eligible": false,
"compressed": false,
"data_hash": "",
"creator_hash": "",
"asset_hash": "",
"tree": "",
"seq": 0,
"leaf_id": 0
},
"grouping": [],
"royalty": {
"royalty_model": "creators",
"target": null,
"percent": 0.0,
"basis_points": 0,
"primary_sale_happened": false,
"locked": false
},
"creators": [],
"ownership": {
"frozen": false,
"delegated": false,
"delegate": null,
"ownership_model": "token",
"owner": ""
},
"supply": {
"print_max_supply": 0,
"print_current_supply": 0,
"edition_nonce": 252
},
"mutable": true,
"burnt": false,
"lamports": 5616720,
"executable": false,
"metadata_owner": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
"rent_epoch": 18446744073709551615,
"token_info": {
"supply": 9342137502207180,
"decimals": 6,
"token_program": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"mint_authority": "BJE5MMbqXjVwjAF7oxwPYXnTXDyspzZyt4vwenNw5ruG",
"freeze_authority": "7dGbd2QZcCKcTndnHcTL8q7SMVXAkp688NTQYwrRCrar"
}
}
56 changes: 56 additions & 0 deletions integration_tests/src/token_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
use std::sync::Arc;

use entities::{api_req_params::GetAsset, enums::AssetType};
use function_name::named;
use itertools::Itertools;
use nft_ingester::api::dapi::response::{AssetList, TokenAccountsList};
use serial_test::serial;
use tokio::{
sync::{broadcast, Mutex},
task::JoinSet,
};

use crate::common::{
index_seed_events, seed_token_mints, trim_test_name, Network, SeedEvent, TestSetup,
TestSetupOptions,
};

#[tokio::test]
#[serial]
#[named]
async fn test_fungible_token_mint_freeze_authority() {
let name = trim_test_name(function_name!());
let setup = TestSetup::new_with_options(
name.clone(),
TestSetupOptions { network: Some(Network::Mainnet), clear_db: true },
)
.await;

// USDC token
let seeds: Vec<SeedEvent> = seed_token_mints(&["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"]);

index_seed_events(&setup, seeds.iter().collect_vec()).await;

let request = r#"
{
"id": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
}
"#;

let mutexed_tasks = Arc::new(Mutex::new(JoinSet::new()));

let request: GetAsset = serde_json::from_str(request).unwrap();
let response_value = setup.das_api.get_asset(request, mutexed_tasks.clone()).await.unwrap();
let res: AssetList = serde_json::from_value(response_value.clone()).unwrap();

insta::assert_json_snapshot!(name, response_value.clone());

// assert_eq!(
// res.items[0].clone().token_info.unwrap().mint_authority.unwrap(),
// "BJE5MMbqXjVwjAF7oxwPYXnTXDyspzZyt4vwenNw5ruG".to_string()
// );
// assert_eq!(
// res.items[0].clone().token_info.unwrap().freeze_authority.unwrap(),
// "7dGbd2QZcCKcTndnHcTL8q7SMVXAkp688NTQYwrRCrar".to_string()
// );
}
Loading
Loading