brain/tests/db_tx_new_app_test.rs

38 lines
1.3 KiB
Rust

// SPDX-License-Identifier: Unlicense
use common::prepare_test_env::prepare_test_db;
use detee_shared::app_proto::{AppResource, NewAppReq};
use surreal_brain::db::prelude as db;
mod common;
#[tokio::test]
async fn test_new_app_db_tx() {
let db = prepare_test_db().await.unwrap();
let req = NewAppReq {
package_url: "https://registry.detee.ltd/sgx/packages/actix-app-info_package_2025-04-16_21-59-38.tar.gz".to_string(),
node_pubkey: "AH3SpV6ZjXMGSSe6xGH2ekUZxyUhnesAFz4LjX7PnvVn".to_string(),
resource: Some(
AppResource {
memory_mib: 1500,
disk_size_mib: 2000,
vcpus: 1,
ports: vec![ 8080 ],
},
),
app_id: "".to_string(),
admin_pubkey: "H21Shi4iE7vgfjWEQNvzmpmBMJSaiZ17PYUcdNoAoKNc".to_string(),
price_per_unit: 200000,
locked_nano: 152400000,
hratls_pubkey: "7E0F887AA6BB9104EEC1066F454D4C2D9063D676715F55F919D3FBCEDC63240B".to_string(),
public_package_mr_enclave: Some(
vec![ 128, 0, 97, 103, 165, 103, 68, 203, 240, 145, 153, 254, 34, 129, 75, 140, 8, 186, 63, 226, 144, 129, 201, 187, 175, 66, 80, 1, 151, 114, 183, 159, ],
),
app_name: "lively-ferret".to_string(),
};
let db_req: db::NewAppReq = req.into();
db_req.submit(&db).await.unwrap();
}