Skip to content

Commit fb6c456

Browse files
committed
Add remote net tests for ScyllaDB and RocksDB
1 parent 68ecbed commit fb6c456

File tree

3 files changed

+75
-6
lines changed

3 files changed

+75
-6
lines changed

.github/workflows/rust.yml

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ permissions:
4040
contents: read
4141

4242
jobs:
43-
remote-net-test:
43+
remote-net-test-service:
4444
runs-on: ubuntu-latest-8-cores
4545
timeout-minutes: 40
4646

@@ -61,7 +61,59 @@ jobs:
6161
cargo run --features storage-service --bin linera -- net up --storage service:tcp:localhost:1235:table --policy-config testnet --path /tmp/local-linera-net --validators 4 --shards 4 &
6262
- name: Create two epochs and run the faucet
6363
run: |
64-
cargo build --bin linera
64+
cargo run --bin linera -- resource-control-policy --block 0.0000001
65+
cargo run --bin linera -- resource-control-policy --block 0.000000
66+
cargo run --bin linera -- faucet --amount 1000 --port 8079 a3edc33d8e951a1139333be8a4b56646b5598a8f51216e86592d881808972b07 &
67+
- name: Run the remote-net tests
68+
run: |
69+
cargo test -p linera-service remote_net_grpc --features remote-net
70+
71+
remote-net-test-scylladb:
72+
runs-on: ubuntu-latest-8-cores
73+
timeout-minutes: 40
74+
75+
steps:
76+
- uses: actions/checkout@v3
77+
- uses: actions-rust-lang/setup-rust-toolchain@v1
78+
- name: Install Protoc
79+
uses: arduino/setup-protoc@v1
80+
with:
81+
repo-token: ${{ secrets.GITHUB_TOKEN }}
82+
- name: Setup local ScyllaDB instance
83+
run: |
84+
docker run --name my_scylla_container -d -p 9042:9042 scylladb/scylla:6.1
85+
- name: Run the validators
86+
run: |
87+
cargo build --features scylladb
88+
mkdir /tmp/local-linera-net
89+
cargo run --features scylladb --bin linera -- net up --storage scylladb:tcp:localhost:9042 --policy-config testnet --path /tmp/local-linera-net --validators 4 --shards 4 &
90+
- name: Create two epochs and run the faucet
91+
run: |
92+
cargo run --bin linera -- resource-control-policy --block 0.0000001
93+
cargo run --bin linera -- resource-control-policy --block 0.000000
94+
cargo run --bin linera -- faucet --amount 1000 --port 8079 a3edc33d8e951a1139333be8a4b56646b5598a8f51216e86592d881808972b07 &
95+
- name: Run the remote-net tests
96+
run: |
97+
cargo test -p linera-service remote_net_grpc --features remote-net
98+
99+
remote-net-test-rocksdb:
100+
runs-on: ubuntu-latest-8-cores
101+
timeout-minutes: 40
102+
103+
steps:
104+
- uses: actions/checkout@v3
105+
- uses: actions-rust-lang/setup-rust-toolchain@v1
106+
- name: Install Protoc
107+
uses: arduino/setup-protoc@v1
108+
with:
109+
repo-token: ${{ secrets.GITHUB_TOKEN }}
110+
- name: Run the validators
111+
run: |
112+
cargo build --features rocksdb
113+
mkdir /tmp/local-linera-net
114+
cargo run --features rocksdb --bin linera -- net up --storage rocksdb:/tmp/local-linera-net/linera.db --policy-config testnet --path /tmp/local-linera-net --validators 4 --shards 4 &
115+
- name: Create two epochs and run the faucet
116+
run: |
65117
cargo run --bin linera -- resource-control-policy --block 0.0000001
66118
cargo run --bin linera -- resource-control-policy --block 0.000000
67119
cargo run --bin linera -- faucet --amount 1000 --port 8079 a3edc33d8e951a1139333be8a4b56646b5598a8f51216e86592d881808972b07 &

linera-service/src/cli_wrappers/local_net.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ use linera_client::{
2626
use linera_core::node::ValidatorNodeProvider;
2727
#[cfg(all(feature = "storage-service", with_testing))]
2828
use linera_storage_service::common::storage_service_test_endpoint;
29-
#[cfg(all(feature = "rocksdb", feature = "scylladb", with_testing))]
30-
use linera_views::rocks_db::{RocksDbSpawnMode, RocksDbStore};
3129
#[cfg(all(feature = "scylladb", with_testing))]
32-
use linera_views::{scylla_db::ScyllaDbStore, store::TestKeyValueStore as _};
30+
use linera_views::scylla_db::ScyllaDbStore;
31+
#[cfg(all(feature = "rocksdb", with_testing))]
32+
use linera_views::{
33+
rocks_db::{RocksDbSpawnMode, RocksDbStore},
34+
store::TestKeyValueStore as _,
35+
};
3336
use tempfile::{tempdir, TempDir};
3437
use tokio::process::{Child, Command};
3538
use tonic::transport::{channel::ClientTlsConfig, Endpoint};
@@ -97,6 +100,19 @@ async fn make_testing_config(database: Database) -> Result<StorageConfig> {
97100
#[cfg(not(feature = "scylladb"))]
98101
panic!("Database::ScyllaDb is selected without the feature scylladb");
99102
}
103+
Database::RocksDb => {
104+
#[cfg(feature = "rocksdb")]
105+
{
106+
let config = RocksDbStore::new_test_config().await?;
107+
let spawn_mode = RocksDbSpawnMode::get_spawn_mode_from_runtime();
108+
Ok(StorageConfig::RocksDb {
109+
path: config.inner_config.path_with_guard.path_buf,
110+
spawn_mode,
111+
})
112+
}
113+
#[cfg(not(feature = "rocksdb"))]
114+
panic!("Database::RocksDb is selected without the feature rocksdb");
115+
}
100116
Database::DualRocksDbScyllaDb => {
101117
#[cfg(all(feature = "rocksdb", feature = "scylladb"))]
102118
{
@@ -210,6 +226,7 @@ pub enum Database {
210226
Service,
211227
DynamoDb,
212228
ScyllaDb,
229+
RocksDb,
213230
DualRocksDbScyllaDb,
214231
}
215232

linera-service/src/linera/net_up_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl StorageConfigProvider {
9090
match self.storage.storage_config {
9191
StorageConfig::Memory => anyhow::bail!("Not possible to work with memory"),
9292
#[cfg(feature = "rocksdb")]
93-
StorageConfig::RocksDb { .. } => anyhow::bail!("Not possible to work with RocksDB"),
93+
StorageConfig::RocksDb { .. } => Ok(Database::RocksDb),
9494
#[cfg(feature = "storage-service")]
9595
StorageConfig::Service { .. } => Ok(Database::Service),
9696
#[cfg(feature = "dynamodb")]

0 commit comments

Comments
 (0)