chore: remove marine-rs-sdk-test from examples, move it to test-sdk repo (#363)

chore: remove marine-rs-sdk-test usages
This commit is contained in:
Valery Antopol 2023-08-16 20:57:11 +03:00 committed by GitHub
parent bcb10af7f9
commit 62802fa3d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 232 additions and 1570 deletions

1444
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -30,10 +30,6 @@ members = [
"examples/url-downloader/curl_adapter", "examples/url-downloader/curl_adapter",
"examples/url-downloader/facade", "examples/url-downloader/facade",
"examples/url-downloader/local_storage", "examples/url-downloader/local_storage",
"examples/multiservice_marine_test",
"examples/multiservice_marine_test/consumer",
"examples/multiservice_marine_test/producer",
"examples/build_rs",
"marine", "marine",
"marine/tests/wasm_tests/arguments_passing", "marine/tests/wasm_tests/arguments_passing",
"marine/tests/wasm_tests/arrays_passing", "marine/tests/wasm_tests/arrays_passing",

View File

@ -3,7 +3,6 @@
# This script builds all tests # This script builds all tests
( (
cd lilo_after_2gb || exit; cd lilo_after_2gb || exit;
cargo update --aggressive;
marine build --release; marine build --release;
rm artifacts/* || true; rm artifacts/* || true;
mkdir artifacts mkdir artifacts

View File

@ -1,21 +0,0 @@
[package]
name = "wasm-build-rs"
version = "0.1.0"
authors = ["Fluence Labs"]
description = "The greeting module for the Fluence network"
repository = "https://github.com/fluencelabs/marine/tree/master/examples/build_rs"
edition = "2021"
publish = false
[[bin]]
name = "build_rs_test"
path = "src/main.rs"
[dependencies]
marine-rs-sdk = "0.8.1"
[dev-dependencies]
marine-rs-sdk-test = "0.8.1"
[build-dependencies]
marine-rs-sdk-test = "0.8.1"

View File

@ -1,6 +0,0 @@
modules_dir = "artifacts/"
[[module]]
name = "build_rs_test"
max_heap_size = "10 KiB"
logger_enabled = false

View File

@ -1,18 +0,0 @@
use marine_rs_sdk_test::generate_marine_test_env;
use marine_rs_sdk_test::ServiceDescription;
fn main() {
let services = vec![(
"greeting".to_string(),
ServiceDescription {
config_path: "Config.toml".to_string(),
modules_dir: Some("artifacts".to_string()),
},
)];
let target = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if target != "wasm32" {
generate_marine_test_env(services, "marine_test_env.rs", file!());
}
println!("cargo:rerun-if-changed=src/main.rs");
}

View File

@ -1,10 +0,0 @@
#!/bin/sh
# This script builds all subprojects and puts all created Wasm modules in one dir
cargo update --aggressive
marine build --release
rm artifacts/* || true
mkdir -p artifacts
cp ../../target/wasm32-wasi/release/build_rs_test.wasm artifacts/

View File

@ -1,38 +0,0 @@
/*
* Copyright 2021 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use marine_rs_sdk::marine;
use marine_rs_sdk::module_manifest;
module_manifest!();
pub fn main() {}
#[marine]
pub fn greeting(name: String) -> String {
format!("Hi, {}", name)
}
#[cfg(test)]
mod built_tests {
marine_rs_sdk_test::include_test_env!("/marine_test_env.rs");
#[test]
fn non_empty_string() {
let mut greeting = marine_test_env::greeting::ServiceInterface::new();
let actual = greeting.greeting("name".to_string());
assert_eq!(actual, "Hi, name");
}
}

View File

@ -11,6 +11,3 @@ path = "src/main.rs"
[dependencies] [dependencies]
marine-rs-sdk ="0.7.0" marine-rs-sdk ="0.7.0"
[dev-dependencies]
marine-rs-sdk-test = "0.8.1"

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
cargo update --aggressive;
marine build --release; marine build --release;
rm -f artifacts/* || true; rm -f artifacts/* || true;

View File

@ -38,42 +38,3 @@ pub fn call_parameters() -> String {
cp.tetraplets cp.tetraplets
) )
} }
#[cfg(test)]
mod tests {
use marine_rs_sdk_test::marine_test;
use marine_rs_sdk_test::CallParameters;
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")]
fn empty_string(call_parameters: marine_test_env::call_parameters::ModuleInterface) {
let init_peer_id = "init_peer_id";
let service_id = "service_id";
let service_creator_peer_id = "service_creator_peer_id";
let host_id = "host_id";
let particle_id = "particle_id";
let tetraplet = marine_rs_sdk::SecurityTetraplet {
function_name: "some_func_name".to_string(),
json_path: "some_json_path".to_string(),
..Default::default()
};
let tetraplets = vec![vec![tetraplet]];
let cp = CallParameters {
init_peer_id: init_peer_id.to_string(),
service_id: service_id.to_string(),
service_creator_peer_id: service_creator_peer_id.to_string(),
host_id: host_id.to_string(),
particle_id: particle_id.to_string(),
tetraplets: tetraplets.clone(),
};
let actual = call_parameters.call_parameters_cp(cp);
let expected = format!(
"{}\n{}\n{}\n{}\n{}\n{:?}",
init_peer_id, service_id, service_creator_peer_id, host_id, particle_id, tetraplets
);
assert_eq!(actual, expected);
}
}

View File

@ -13,6 +13,3 @@ path = "src/main.rs"
[dependencies] [dependencies]
marine-rs-sdk = "0.8.1" marine-rs-sdk = "0.8.1"
[dev-dependencies]
marine-rs-sdk-test = "0.8.1"

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# This script builds all subprojects and puts all created Wasm modules in one dir # This script builds all subprojects and puts all created Wasm modules in one dir
cargo update --aggressive
marine build --release marine build --release
rm artifacts/* || true rm artifacts/* || true

View File

@ -13,6 +13,3 @@ path = "src/main.rs"
[dependencies] [dependencies]
marine-rs-sdk = "0.8.1" marine-rs-sdk = "0.8.1"
[dev-dependencies]
marine-rs-sdk-test = "0.8.1"

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# This script builds all subprojects and puts all created Wasm modules in one dir # This script builds all subprojects and puts all created Wasm modules in one dir
cargo update --aggressive
marine build --release marine build --release
rm artifacts/* || true rm artifacts/* || true

View File

@ -25,20 +25,3 @@ pub fn main() {}
pub fn greeting(name: String) -> String { pub fn greeting(name: String) -> String {
format!("Hi, {}", name) format!("Hi, {}", name)
} }
#[cfg(test)]
mod tests {
use marine_rs_sdk_test::marine_test;
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")]
fn empty_string(greeting: marine_test_env::greeting::ModuleInterface) {
let actual = greeting.greeting(String::new());
assert_eq!(actual, "Hi, ");
}
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")]
fn non_empty_string(greeting: marine_test_env::greeting::ModuleInterface) {
let actual = greeting.greeting("name".to_string());
assert_eq!(actual, "Hi, name");
}
}

View File

@ -15,5 +15,3 @@ path = "src/main.rs"
marine-rs-sdk = {version = "0.7.0", features = ["logger"]} marine-rs-sdk = {version = "0.7.0", features = ["logger"]}
log = "0.4.8" log = "0.4.8"
[dev-dependencies]
marine-rs-sdk-test = "0.8.1"

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# This script builds all subprojects and puts all created Wasm modules in one dir # This script builds all subprojects and puts all created Wasm modules in one dir
cargo update --aggressive
marine build --release marine build --release
rm artifacts/* || true rm artifacts/* || true

View File

@ -65,15 +65,3 @@ pub fn log_trace() {
#[marine] #[marine]
pub fn void_fn() {} pub fn void_fn() {}
#[cfg(test)]
mod tests {
use marine_rs_sdk_test::marine_test;
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")]
fn smoke_test(greeting: marine_test_env::greeting_record::ModuleInterface) {
let actual = greeting.greeting_record();
assert_eq!(actual.str, "Hello, world!");
assert_eq!(actual.num, 42);
}
}

View File

@ -3,13 +3,11 @@
# This script builds all subprojects and puts all created Wasm modules in one dir # This script builds all subprojects and puts all created Wasm modules in one dir
( (
cd effector || exit; cd effector || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )
( (
cd pure || exit; cd pure || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )

View File

@ -3,13 +3,11 @@
# This script builds all subprojects and puts all created Wasm modules in one dir # This script builds all subprojects and puts all created Wasm modules in one dir
( (
cd shrek || exit; cd shrek || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )
( (
cd donkey || exit; cd donkey || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )

View File

@ -1,11 +0,0 @@
[package]
name = "multiservice-marine-test"
version = "0.1.0"
authors = ["Fluence Labs"]
edition = "2021"
publish = false
[dependencies]
[dev-dependencies]
marine-rs-sdk-test = "0.8.1"

View File

@ -1,13 +0,0 @@
[package]
name = "consumer"
version = "0.1.0"
authors = ["Fluence Labs"]
edition = "2021"
publish = false
[[bin]]
name = "consumer"
path = "src/main.rs"
[dependencies]
marine-rs-sdk = "0.8.1"

View File

@ -1,6 +0,0 @@
modules_dir = "artifacts/"
[[module]]
name = "consumer"
max_heap_size = "10 KiB"
logger_enabled = false

View File

@ -1,10 +0,0 @@
#!/bin/sh
# This script builds all subprojects and puts all created Wasm modules in one dir
cargo update --aggressive
marine build --release
rm artifacts/* || true
mkdir -p artifacts
cp target/wasm32-wasi/release/consumer.wasm artifacts/

View File

@ -1,16 +0,0 @@
use marine_rs_sdk::marine;
use marine_rs_sdk::module_manifest;
module_manifest!();
pub fn main() {}
#[marine]
pub struct Data {
pub name: String,
}
#[marine]
pub fn consume(data: Data) -> String {
data.name
}

View File

@ -1,13 +0,0 @@
[package]
name = "producer"
version = "0.1.0"
authors = ["Fluence Labs"]
edition = "2021"
publish = false
[[bin]]
name = "producer"
path = "src/main.rs"
[dependencies]
marine-rs-sdk = "0.8.1"

View File

@ -1,6 +0,0 @@
modules_dir = "artifacts/"
[[module]]
name = "producer"
max_heap_size = "10 KiB"
logger_enabled = false

View File

@ -1,10 +0,0 @@
#!/bin/sh
# This script builds all subprojects and puts all created Wasm modules in one dir
cargo update --aggressive
marine build --release
rm artifacts/* || true
mkdir -p artifacts
cp target/wasm32-wasi/release/producer.wasm artifacts/

View File

@ -1,24 +0,0 @@
use marine_rs_sdk::marine;
use marine_rs_sdk::module_manifest;
module_manifest!();
pub fn main() {}
#[marine]
pub struct Data {
pub name: String,
}
#[marine]
pub struct Input {
pub first_name: String,
pub last_name: String,
}
#[marine]
pub fn produce(data: Input) -> Data {
Data {
name: format!("{} {}", data.first_name, data.last_name),
}
}

View File

@ -1,53 +0,0 @@
fn main() {}
#[cfg(test)]
mod tests {
use marine_rs_sdk_test::marine_test;
#[marine_test(
producer(
config_path = "../producer/Config.toml",
modules_dir = "../producer/artifacts"
),
consumer(
config_path = "../consumer/Config.toml",
modules_dir = "../consumer/artifacts"
)
)]
fn test() {
let mut producer = marine_test_env::producer::ServiceInterface::new();
let mut consumer = marine_test_env::consumer::ServiceInterface::new();
let input = marine_test_env::producer::Input {
first_name: String::from("John"),
last_name: String::from("Doe"),
};
let data = producer.produce(input);
let result = consumer.consume(data);
assert_eq!(result, "John Doe")
}
}
#[cfg(test)]
#[marine_rs_sdk_test::marine_test(
producer(
config_path = "../producer/Config.toml",
modules_dir = "../producer/artifacts"
),
consumer(
config_path = "../consumer/Config.toml",
modules_dir = "../consumer/artifacts"
)
)]
mod tests_on_mod {
#[test]
fn test() {
let mut producer = marine_test_env::producer::ServiceInterface::new();
let mut consumer = marine_test_env::consumer::ServiceInterface::new();
let input = marine_test_env::producer::Input {
first_name: String::from("John"),
last_name: String::from("Doe"),
};
let data = producer.produce(input);
let result = consumer.consume(data);
assert_eq!(result, "John Doe")
}
}

View File

@ -3,13 +3,11 @@
# This script builds all subprojects and puts all created Wasm modules in one dir # This script builds all subprojects and puts all created Wasm modules in one dir
( (
cd effector || exit; cd effector || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )
( (
cd pure || exit; cd pure || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )

View File

@ -10,5 +10,5 @@ name = "sqlite_test"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
marine-rs-sdk = "0.8.1" marine-rs-sdk = "0.7.1"
marine-sqlite-connector = "0.6.0" marine-sqlite-connector = "0.8.2"

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# This script builds all subprojects and puts all created Wasm modules in one dir # This script builds all subprojects and puts all created Wasm modules in one dir
cargo update --aggressive
marine build --release marine build --release
rm artifacts/* || true rm artifacts/* || true

View File

@ -3,19 +3,16 @@
# This script builds all subprojects and puts all created Wasm modules in one dir # This script builds all subprojects and puts all created Wasm modules in one dir
( (
cd local_storage || exit; cd local_storage || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )
( (
cd curl_adapter || exit; cd curl_adapter || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )
( (
cd facade || exit; cd facade || exit;
cargo update --aggressive;
marine build --release; marine build --release;
) )

View File

@ -5,7 +5,6 @@ for test in *; do
if [[ -d $test ]]; then if [[ -d $test ]]; then
echo "Building $test" echo "Building $test"
cd $test cd $test
cargo update --aggressive
marine build --release marine build --release
mkdir artifacts -p mkdir artifacts -p
cp ../../../../target/wasm32-wasi/release/$test_*.wasm artifacts/ cp ../../../../target/wasm32-wasi/release/$test_*.wasm artifacts/