Skip to content

Commit

Permalink
Fix CI tests and general cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranay Tulugu committed Sep 13, 2023
1 parent 152e8e2 commit 98907d3
Show file tree
Hide file tree
Showing 28 changed files with 144 additions and 254 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,13 @@ jobs:
- name: Install Wireguard
run: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard
- name: Run integration test
run: bash scripts/integration_tests/all-up-test.sh MULTI_EXIT
run: bash scripts/integration_tests/all-up-test.sh MULTI_EXIT
integration-test-validate-contract:
needs: integration-test-five-nodes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Wireguard
run: sudo apt-get update && sudo apt install -y wireguard linux-source linux-headers-$(uname -r) build-essential && sudo modprobe wireguard
- name: Run integration test
run: bash scripts/integration_tests/all-up-test.sh CONTRACT_TEST
18 changes: 0 additions & 18 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ members = [
"althea_kernel_interface",
"settings",
"clu",
"exit_db",
"antenna_forwarding_client",
"antenna_forwarding_protocol",
"auto_bridge",
Expand Down
13 changes: 0 additions & 13 deletions exit_db/Cargo.toml

This file was deleted.

5 changes: 0 additions & 5 deletions exit_db/diesel.toml

This file was deleted.

This file was deleted.

36 changes: 0 additions & 36 deletions exit_db/migrations/00000000000000_diesel_initial_setup/up.sql

This file was deleted.

2 changes: 0 additions & 2 deletions exit_db/migrations/2019-02-22-214628_rita-setup/down.sql

This file was deleted.

18 changes: 0 additions & 18 deletions exit_db/migrations/2019-02-22-214628_rita-setup/up.sql

This file was deleted.

5 changes: 0 additions & 5 deletions exit_db/migrations/2022-05-18-184145_ipv6_migration/down.sql

This file was deleted.

10 changes: 0 additions & 10 deletions exit_db/migrations/2022-05-18-184145_ipv6_migration/up.sql

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions exit_db/src/lib.rs

This file was deleted.

38 changes: 0 additions & 38 deletions exit_db/src/models.rs

This file was deleted.

28 changes: 0 additions & 28 deletions exit_db/src/schema.rs

This file was deleted.

8 changes: 6 additions & 2 deletions integration_tests/src/contract_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{thread, time::Duration};

use althea_types::Identity;
use log::info;
use rita_client_registration::client_db::{
add_client_to_registered_list, get_all_regsitered_clients, get_registered_client_using_ethkey,
get_registered_client_using_meship, get_registered_client_using_wgkey,
Expand All @@ -9,10 +10,13 @@ use web30::client::Web3;

use crate::{
payments_eth::{ETH_MINER_KEY, WEB3_TIMEOUT},
utils::{get_altheadb_contract_addr, get_eth_node},
utils::{deploy_contracts, get_altheadb_contract_addr, get_eth_node},
};

pub async fn run_altheadb_contract_test() {
info!("Waiting to deploy contracts");
deploy_contracts().await;

// Try adding a dummy entry and validating that we can retrive them
validate_contract_functionality().await;

Expand Down Expand Up @@ -151,7 +155,7 @@ pub async fn validate_contract_functionality() {
)
.await;

println!("All users are : {:?}", res);
info!("All users are : {:?}", res);

thread::sleep(Duration::from_secs(5));

Expand Down
35 changes: 28 additions & 7 deletions integration_tests/src/debts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ use std::thread;
use std::time::Duration;

use crate::five_nodes::five_node_config;
use crate::setup_utils::database::start_postgres;
use crate::payments_eth::{ONE_ETH, WEB3_TIMEOUT};
use crate::registration_server::start_registration_server;
use crate::setup_utils::namespaces::*;
use crate::setup_utils::rita::thread_spawner;
use crate::utils::{
generate_traffic, get_default_settings, get_ip_from_namespace, query_debts,
register_all_namespaces_to_exit, test_all_internet_connectivity, test_reach_all, test_routes,
DEBT_ACCURACY_THRES, TEST_EXIT_DETAILS,
deploy_contracts, generate_traffic, get_default_settings, get_ip_from_namespace, query_debts,
register_all_namespaces_to_exit, send_eth_bulk, test_all_internet_connectivity, test_reach_all,
test_routes, DEBT_ACCURACY_THRES, TEST_EXIT_DETAILS,
};
use log::info;
use num256::Int256;
use num_traits::Signed;
use rita_common::debt_keeper::GetDebtsResult;
use web30::client::Web3;

type DebtsConfig<T> = (Vec<(T, T)>, HashMap<(T, T), Vec<T>>);

Expand Down Expand Up @@ -44,19 +46,24 @@ pub async fn run_debts_test() {
let namespaces = node_config.0;
let expected_routes = node_config.1;

info!("Waiting to deploy contracts");
deploy_contracts().await;

info!("Starting registration server");
start_registration_server();

let (client_settings, exit_settings) =
get_default_settings("test".to_string(), namespaces.clone());

// The exit price is set to ns.cost during thread_spawner
let exit_price = namespaces.get_namespace(4).unwrap().cost;

namespaces.validate();
start_postgres();

let res = setup_ns(namespaces.clone());
info!("Namespaces setup: {res:?}");

let _rita_identities = thread_spawner(namespaces.clone(), client_settings, exit_settings)
let rita_identities = thread_spawner(namespaces.clone(), client_settings, exit_settings)
.expect("Could not spawn Rita threads");
info!("Thread Spawner: {res:?}");

Expand All @@ -65,11 +72,25 @@ pub async fn run_debts_test() {

test_routes(namespaces.clone(), expected_routes);

// Exits need to have funds to request a registered client list, which is needed for proper setup
info!("Topup exits with funds");
let web3 = Web3::new("http://localhost:8545", WEB3_TIMEOUT);
let mut to_top_up = Vec::new();
for c in rita_identities.client_identities {
to_top_up.push(c.eth_address);
}
for e in rita_identities.exit_identities {
to_top_up.push(e.eth_address)
}

info!("Sending 50 eth to all routers");
send_eth_bulk((ONE_ETH * 50).into(), &to_top_up, &web3).await;

info!("Registering routers to the exit");
register_all_namespaces_to_exit(namespaces.clone()).await;

// Let network stabalize
thread::sleep(Duration::from_secs(20));
thread::sleep(Duration::from_secs(10));

test_all_internet_connectivity(namespaces.clone());

Expand Down
Loading

0 comments on commit 98907d3

Please sign in to comment.