mirror of
https://github.com/fluencelabs/marine.git
synced 2024-12-04 19:50:19 +00:00
fix tests after renaming (#174)
This commit is contained in:
parent
b4e76cb0cd
commit
cc1766b7f1
3
.gitignore
vendored
3
.gitignore
vendored
@ -12,6 +12,9 @@ target/
|
||||
# REPL history files
|
||||
*.repl_history
|
||||
|
||||
# local storage of the url-downloader service
|
||||
/examples/url-downloader/sites/*
|
||||
|
||||
# Allowed Wasm files for examples
|
||||
!/examples/call_parameters/artifacts/*.wasm
|
||||
!/examples/greeting/artifacts/*.wasm
|
||||
|
54
Cargo.lock
generated
54
Cargo.lock
generated
@ -1062,8 +1062,8 @@ dependencies = [
|
||||
"http",
|
||||
"indexmap",
|
||||
"slab",
|
||||
"tokio 1.18.2",
|
||||
"tokio-util 0.7.2",
|
||||
"tokio 1.19.2",
|
||||
"tokio-util 0.7.3",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -1099,9 +1099,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb"
|
||||
checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
|
||||
dependencies = [
|
||||
"bytes 1.1.0",
|
||||
"fnv",
|
||||
@ -1198,7 +1198,7 @@ dependencies = [
|
||||
"itoa 1.0.2",
|
||||
"pin-project-lite 0.2.9",
|
||||
"socket2 0.4.4",
|
||||
"tokio 1.18.2",
|
||||
"tokio 1.19.2",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"want",
|
||||
@ -1226,7 +1226,7 @@ dependencies = [
|
||||
"bytes 1.1.0",
|
||||
"hyper 0.14.19",
|
||||
"native-tls",
|
||||
"tokio 1.18.2",
|
||||
"tokio 1.19.2",
|
||||
"tokio-native-tls",
|
||||
]
|
||||
|
||||
@ -2028,7 +2028,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mrepl"
|
||||
version = "0.16.1"
|
||||
version = "0.16.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"check-latest",
|
||||
@ -2649,7 +2649,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"tokio 1.18.2",
|
||||
"tokio 1.19.2",
|
||||
"tokio-native-tls",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
@ -3001,9 +3001,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.95"
|
||||
version = "1.0.96"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942"
|
||||
checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3174,9 +3174,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.18.2"
|
||||
version = "1.19.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395"
|
||||
checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439"
|
||||
dependencies = [
|
||||
"bytes 1.1.0",
|
||||
"libc",
|
||||
@ -3207,7 +3207,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
|
||||
dependencies = [
|
||||
"native-tls",
|
||||
"tokio 1.18.2",
|
||||
"tokio 1.19.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3236,15 +3236,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.2"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c"
|
||||
checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45"
|
||||
dependencies = [
|
||||
"bytes 1.1.0",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"pin-project-lite 0.2.9",
|
||||
"tokio 1.18.2",
|
||||
"tokio 1.19.2",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@ -3265,35 +3265,23 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.34"
|
||||
version = "0.1.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09"
|
||||
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"log",
|
||||
"pin-project-lite 0.2.9",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.26"
|
||||
version = "0.1.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
|
||||
checksum = "7709595b8878a4965ce5e87ebf880a7d39c9afc6837721b21a5a816a8117d921"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -38,8 +38,8 @@ mod memory_statistic;
|
||||
pub use config::MModuleConfig;
|
||||
pub use config::HostExportedFunc;
|
||||
pub use config::HostImportDescriptor;
|
||||
pub use marine_core::MarineCore;
|
||||
pub use marine_core::MModuleInterface;
|
||||
pub use crate::marine_core::MarineCore;
|
||||
pub use crate::marine_core::MModuleInterface;
|
||||
pub use errors::MError;
|
||||
pub use host_imports::HostImportError;
|
||||
pub use module::IValue;
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use marine::Core;
|
||||
use marine::IValue;
|
||||
use marine_core::MarineCore;
|
||||
use marine_core::IValue;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
@ -26,12 +26,12 @@ static GREETING_WASM_BYTES: Lazy<Vec<u8>> = Lazy::new(|| {
|
||||
|
||||
#[test]
|
||||
pub fn greeting_basic() {
|
||||
let mut marine = Core::new();
|
||||
marine
|
||||
let mut marine_core = MarineCore::new();
|
||||
marine_core
|
||||
.load_module("greeting", &*GREETING_WASM_BYTES, <_>::default())
|
||||
.unwrap_or_else(|e| panic!("can't load a module into Marine: {:?}", e));
|
||||
|
||||
let result1 = marine
|
||||
let result1 = marine_core
|
||||
.call(
|
||||
"greeting",
|
||||
"greeting",
|
||||
@ -39,7 +39,7 @@ pub fn greeting_basic() {
|
||||
)
|
||||
.unwrap_or_else(|e| panic!("can't invoke greeting: {:?}", e));
|
||||
|
||||
let result2 = marine
|
||||
let result2 = marine_core
|
||||
.call("greeting", "greeting", &[IValue::String(String::from(""))])
|
||||
.unwrap_or_else(|e| panic!("can't invoke greeting: {:?}", e));
|
||||
|
||||
@ -50,17 +50,17 @@ pub fn greeting_basic() {
|
||||
#[test]
|
||||
// test loading module with the same name twice
|
||||
pub fn non_unique_module_name() {
|
||||
let mut marine = Core::new();
|
||||
let mut marine_core = MarineCore::new();
|
||||
let module_name = String::from("greeting");
|
||||
marine
|
||||
marine_core
|
||||
.load_module(&module_name, &*GREETING_WASM_BYTES, <_>::default())
|
||||
.unwrap_or_else(|e| panic!("can't load a module into Marine: {:?}", e));
|
||||
|
||||
let load_result = marine.load_module(&module_name, &*GREETING_WASM_BYTES, <_>::default());
|
||||
let load_result = marine_core.load_module(&module_name, &*GREETING_WASM_BYTES, <_>::default());
|
||||
assert!(load_result.is_err());
|
||||
assert!(std::matches!(
|
||||
load_result.err().unwrap(),
|
||||
marine::MError::NonUniqueModuleName(_)
|
||||
marine_core::MError::NonUniqueModuleName(_)
|
||||
));
|
||||
}
|
||||
|
||||
@ -68,8 +68,8 @@ pub fn non_unique_module_name() {
|
||||
#[allow(unused_variables)]
|
||||
// test calling Marine with non-exist module and function names
|
||||
pub fn non_exist_module_func() {
|
||||
let mut marine = Core::new();
|
||||
marine
|
||||
let mut marine_core = MarineCore::new();
|
||||
marine_core
|
||||
.load_module("greeting", &*GREETING_WASM_BYTES, <_>::default())
|
||||
.unwrap_or_else(|e| panic!("can't load a module into Marine: {:?}", e));
|
||||
|
||||
@ -77,19 +77,19 @@ pub fn non_exist_module_func() {
|
||||
let function_name = "greeting";
|
||||
let non_exist_name = String::from("_");
|
||||
|
||||
let call_result1 = marine.call(
|
||||
let call_result1 = marine_core.call(
|
||||
non_exist_name.as_str(),
|
||||
function_name,
|
||||
&[IValue::String(String::from("Fluence"))],
|
||||
);
|
||||
|
||||
let call_result2 = marine.call(
|
||||
let call_result2 = marine_core.call(
|
||||
module_name,
|
||||
non_exist_name.as_str(),
|
||||
&[IValue::String(String::from("Fluence"))],
|
||||
);
|
||||
|
||||
let call_result3 = marine.call(
|
||||
let call_result3 = marine_core.call(
|
||||
non_exist_name.as_str(),
|
||||
non_exist_name.as_str(),
|
||||
&[IValue::String(String::from("Fluence"))],
|
||||
@ -98,19 +98,19 @@ pub fn non_exist_module_func() {
|
||||
assert!(call_result1.is_err());
|
||||
assert!(matches!(
|
||||
call_result1.err().unwrap(),
|
||||
marine::MError::NoSuchModule(non_exist_name)
|
||||
marine_core::MError::NoSuchModule(non_exist_name)
|
||||
));
|
||||
|
||||
assert!(call_result2.is_err());
|
||||
assert!(matches!(
|
||||
call_result2.err().unwrap(),
|
||||
marine::MError::NoSuchFunction(module_name, non_exist_name)
|
||||
marine_core::MError::NoSuchFunction(module_name, non_exist_name)
|
||||
));
|
||||
|
||||
assert!(call_result3.is_err());
|
||||
// at first, the module name should be checked
|
||||
assert!(matches!(
|
||||
call_result3.err().unwrap(),
|
||||
marine::MError::NoSuchModule(non_exist_name)
|
||||
marine_core::MError::NoSuchModule(non_exist_name)
|
||||
));
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use marine::Core;
|
||||
use marine::IValue;
|
||||
use marine_core::MarineCore;
|
||||
use marine_core::IValue;
|
||||
|
||||
#[test]
|
||||
pub fn records() {
|
||||
@ -25,19 +25,19 @@ pub fn records() {
|
||||
let pure_wasm_bytes = std::fs::read("../examples/records/artifacts/records_pure.wasm")
|
||||
.expect("../examples/records/artifacts/records_pure.wasm should presence");
|
||||
|
||||
let mut marine = Core::new();
|
||||
let load_result = marine.load_module("pure", &pure_wasm_bytes, <_>::default());
|
||||
let mut marine_core = MarineCore::new();
|
||||
let load_result = marine_core.load_module("pure", &pure_wasm_bytes, <_>::default());
|
||||
assert!(load_result.is_err());
|
||||
|
||||
marine
|
||||
marine_core
|
||||
.load_module("records_effector", &effector_wasm_bytes, <_>::default())
|
||||
.unwrap_or_else(|e| panic!("can't load a module into Marine: {:?}", e));
|
||||
|
||||
marine
|
||||
marine_core
|
||||
.load_module("records_pure", &pure_wasm_bytes, <_>::default())
|
||||
.unwrap_or_else(|e| panic!("can't load a module into Marine: {:?}", e));
|
||||
|
||||
let result = marine
|
||||
let result = marine_core
|
||||
.call("records_pure", "invoke", &[])
|
||||
.unwrap_or_else(|e| panic!("can't invoke pure: {:?}", e));
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use marine::Core;
|
||||
use marine::IValue;
|
||||
use marine_core::MarineCore;
|
||||
use marine_core::IValue;
|
||||
|
||||
const REDIS_DOWNLOAD_URL: &str =
|
||||
"https://github.com/fluencelabs/redis/releases/download/v0.14.0_w/redis.wasm";
|
||||
@ -35,43 +35,43 @@ pub async fn download(url: &str) -> bytes::Bytes {
|
||||
async fn redis() {
|
||||
let wasm_bytes = download(REDIS_DOWNLOAD_URL).await;
|
||||
|
||||
let mut marine = Core::new();
|
||||
let mut marine_core = MarineCore::new();
|
||||
let module_name = "redis";
|
||||
let config = <_>::default();
|
||||
|
||||
marine
|
||||
marine_core
|
||||
.load_module(module_name, wasm_bytes.as_ref(), config)
|
||||
.unwrap_or_else(|e| panic!("can't load a module into Marine: {:?}", e));
|
||||
|
||||
let result1 = marine
|
||||
let result1 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"invoke",
|
||||
&[IValue::String(String::from("SET A 10"))],
|
||||
)
|
||||
.unwrap_or_else(|e| panic!("error while Marine invocation: {:?}", e));
|
||||
let result2 = marine
|
||||
let result2 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"invoke",
|
||||
&[IValue::String(String::from("SADD B 20"))],
|
||||
)
|
||||
.unwrap_or_else(|e| panic!("error while Marine invocation: {:?}", e));
|
||||
let result3 = marine
|
||||
let result3 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"invoke",
|
||||
&[IValue::String(String::from("GET A"))],
|
||||
)
|
||||
.unwrap_or_else(|e| panic!("error while Marine invocation: {:?}", e));
|
||||
let result4 = marine
|
||||
let result4 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"invoke",
|
||||
&[IValue::String(String::from("SMEMBERS B"))],
|
||||
)
|
||||
.unwrap_or_else(|e| panic!("error while Marine invocation: {:?}", e));
|
||||
let result5 = marine
|
||||
let result5 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"invoke",
|
||||
@ -95,15 +95,15 @@ async fn redis() {
|
||||
async fn sqlite() {
|
||||
let wasm_bytes = download(SQLITE_DOWNLOAD_URL).await;
|
||||
|
||||
let mut marine = Core::new();
|
||||
let mut marine_core = MarineCore::new();
|
||||
let module_name = "sqlite";
|
||||
let config = <_>::default();
|
||||
|
||||
marine
|
||||
marine_core
|
||||
.load_module(module_name, wasm_bytes.as_ref(), config)
|
||||
.unwrap_or_else(|e| panic!("can't load a module into Marine: {:?}", e));
|
||||
|
||||
let mut result1 = marine
|
||||
let mut result1 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"sqlite3_open_v2",
|
||||
@ -125,7 +125,7 @@ async fn sqlite() {
|
||||
_ => panic!("db handle should have u32 type"),
|
||||
};
|
||||
|
||||
let mut result1 = marine
|
||||
let mut result1 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"sqlite3_exec",
|
||||
@ -138,7 +138,7 @@ async fn sqlite() {
|
||||
)
|
||||
.unwrap_or_else(|e| panic!("error while Marine invocation: {:?}", e));
|
||||
|
||||
let mut result2 = marine
|
||||
let mut result2 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"sqlite3_exec",
|
||||
@ -153,7 +153,7 @@ async fn sqlite() {
|
||||
)
|
||||
.unwrap_or_else(|e| panic!("error while Marine invocation: {:?}", e));
|
||||
|
||||
let mut result3 = marine
|
||||
let mut result3 = marine_core
|
||||
.call(
|
||||
module_name,
|
||||
"sqlite3_exec",
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -33,7 +33,7 @@ mod module_loading;
|
||||
|
||||
pub(crate) type MarineResult<T> = std::result::Result<T, MarineError>;
|
||||
|
||||
pub use marine::Marine;
|
||||
pub use crate::marine::Marine;
|
||||
pub use marine_interface::MarineInterface;
|
||||
|
||||
pub use config::MarineConfig;
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
mod utils;
|
||||
|
||||
use fluence_faas::FluenceFaaS;
|
||||
use fluence_faas::IType;
|
||||
use marine::Marine;
|
||||
use marine::IType;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
use once_cell::sync::Lazy;
|
||||
@ -25,9 +25,9 @@ use serde_json::json;
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
static ARG_CONFIG: Lazy<fluence_faas::TomlFaaSConfig> = Lazy::new(|| {
|
||||
static ARG_CONFIG: Lazy<marine::TomlMarineConfig> = Lazy::new(|| {
|
||||
let mut arguments_passing_config =
|
||||
fluence_faas::TomlFaaSConfig::load("./tests/wasm_tests/arguments_passing/Config.toml")
|
||||
marine::TomlMarineConfig::load("./tests/wasm_tests/arguments_passing/Config.toml")
|
||||
.expect("toml faas config should be created");
|
||||
|
||||
arguments_passing_config.modules_dir = Some(String::from(
|
||||
@ -43,163 +43,163 @@ const MODULE_NAME: &str = "arguments_passing_pure";
|
||||
pub fn get_interfaces() {
|
||||
use std::collections::HashSet;
|
||||
|
||||
let faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let interface = faas.get_interface();
|
||||
|
||||
let string_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let string_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::String,
|
||||
}];
|
||||
let string_type_outputs = vec![IType::String];
|
||||
|
||||
let string_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let string_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("string_type")),
|
||||
arguments: Rc::new(string_type_arguments.clone()),
|
||||
outputs: Rc::new(string_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let string_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let string_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("string_ref_type")),
|
||||
arguments: Rc::new(string_type_arguments),
|
||||
outputs: Rc::new(string_type_outputs),
|
||||
};
|
||||
|
||||
let str_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let str_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::String,
|
||||
}];
|
||||
let str_type_outputs = vec![IType::String];
|
||||
|
||||
let str_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let str_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("str_type")),
|
||||
arguments: Rc::new(str_type_arguments),
|
||||
outputs: Rc::new(str_type_outputs),
|
||||
};
|
||||
|
||||
let bytearray_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let bytearray_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::ByteArray,
|
||||
}];
|
||||
let bytearray_type_outputs = vec![IType::ByteArray];
|
||||
|
||||
let bytearray_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let bytearray_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("bytearray_type")),
|
||||
arguments: Rc::new(bytearray_type_arguments.clone()),
|
||||
outputs: Rc::new(bytearray_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let bytearray_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let bytearray_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("bytearray_ref_type")),
|
||||
arguments: Rc::new(bytearray_type_arguments),
|
||||
outputs: Rc::new(bytearray_type_outputs),
|
||||
};
|
||||
|
||||
let i32_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let i32_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::S32,
|
||||
}];
|
||||
let i32_type_outputs = vec![IType::S32];
|
||||
|
||||
let i32_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let i32_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("i32_type")),
|
||||
arguments: Rc::new(i32_type_arguments.clone()),
|
||||
outputs: Rc::new(i32_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let i32_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let i32_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("i32_ref_type")),
|
||||
arguments: Rc::new(i32_type_arguments),
|
||||
outputs: Rc::new(i32_type_outputs),
|
||||
};
|
||||
|
||||
let i64_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let i64_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::S64,
|
||||
}];
|
||||
|
||||
let i64_type_outputs = vec![IType::S64];
|
||||
|
||||
let i64_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let i64_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("i64_type")),
|
||||
arguments: Rc::new(i64_type_arguments.clone()),
|
||||
outputs: Rc::new(i64_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let i64_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let i64_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("i64_ref_type")),
|
||||
arguments: Rc::new(i64_type_arguments),
|
||||
outputs: Rc::new(i64_type_outputs),
|
||||
};
|
||||
|
||||
let u32_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let u32_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::U32,
|
||||
}];
|
||||
let u32_type_outputs = vec![IType::U32];
|
||||
|
||||
let u32_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let u32_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("u32_type")),
|
||||
arguments: Rc::new(u32_type_arguments.clone()),
|
||||
outputs: Rc::new(u32_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let u32_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let u32_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("u32_ref_type")),
|
||||
arguments: Rc::new(u32_type_arguments),
|
||||
outputs: Rc::new(u32_type_outputs),
|
||||
};
|
||||
|
||||
let u64_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let u64_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::U64,
|
||||
}];
|
||||
let u64_type_outputs = vec![IType::U64];
|
||||
|
||||
let u64_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let u64_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("u64_type")),
|
||||
arguments: Rc::new(u64_type_arguments.clone()),
|
||||
outputs: Rc::new(u64_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let u64_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let u64_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("u64_ref_type")),
|
||||
arguments: Rc::new(u64_type_arguments),
|
||||
outputs: Rc::new(u64_type_outputs),
|
||||
};
|
||||
|
||||
let f32_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let f32_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::F32,
|
||||
}];
|
||||
let f32_type_outputs = vec![IType::F32];
|
||||
|
||||
let f32_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let f32_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("f32_type")),
|
||||
arguments: Rc::new(f32_type_arguments.clone()),
|
||||
outputs: Rc::new(f32_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let f32_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let f32_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("f32_ref_type")),
|
||||
arguments: Rc::new(f32_type_arguments),
|
||||
outputs: Rc::new(f32_type_outputs),
|
||||
};
|
||||
|
||||
let f64_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let f64_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::F64,
|
||||
}];
|
||||
let f64_type_outputs = vec![IType::F64];
|
||||
|
||||
let f64_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let f64_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("f64_type")),
|
||||
arguments: Rc::new(f64_type_arguments.clone()),
|
||||
outputs: Rc::new(f64_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let f64_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let f64_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("f64_ref_type")),
|
||||
arguments: Rc::new(f64_type_arguments),
|
||||
outputs: Rc::new(f64_type_outputs),
|
||||
@ -208,89 +208,89 @@ pub fn get_interfaces() {
|
||||
let empty_type_arguments = vec![];
|
||||
let empty_type_outputs = vec![IType::String];
|
||||
|
||||
let empty_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let empty_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("empty_type")),
|
||||
arguments: Rc::new(empty_type_arguments),
|
||||
outputs: Rc::new(empty_type_outputs),
|
||||
};
|
||||
|
||||
let bool_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let bool_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Boolean,
|
||||
}];
|
||||
let bool_type_outputs = vec![IType::Boolean];
|
||||
|
||||
let bool_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let bool_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("bool_type")),
|
||||
arguments: Rc::new(bool_type_arguments.clone()),
|
||||
outputs: Rc::new(bool_type_outputs.clone()),
|
||||
};
|
||||
|
||||
let bool_ref_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let bool_ref_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("bool_ref_type")),
|
||||
arguments: Rc::new(bool_type_arguments),
|
||||
outputs: Rc::new(bool_type_outputs),
|
||||
};
|
||||
|
||||
let all_types_arguments = vec![
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_0"),
|
||||
ty: IType::S8,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_1"),
|
||||
ty: IType::S16,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_2"),
|
||||
ty: IType::S32,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_3"),
|
||||
ty: IType::S64,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_4"),
|
||||
ty: IType::U8,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_5"),
|
||||
ty: IType::U16,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_6"),
|
||||
ty: IType::U32,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_7"),
|
||||
ty: IType::U64,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_8"),
|
||||
ty: IType::F32,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_9"),
|
||||
ty: IType::F64,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_10"),
|
||||
ty: IType::String,
|
||||
},
|
||||
fluence_faas::IFunctionArg {
|
||||
marine::IFunctionArg {
|
||||
name: String::from("arg_11"),
|
||||
ty: IType::ByteArray,
|
||||
},
|
||||
];
|
||||
let all_types_outputs = vec![IType::ByteArray];
|
||||
|
||||
let all_types_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let all_types_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("all_types")),
|
||||
arguments: Rc::new(all_types_arguments.clone()),
|
||||
outputs: Rc::new(all_types_outputs.clone()),
|
||||
};
|
||||
|
||||
let all_ref_types_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let all_ref_types_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("all_ref_types")),
|
||||
arguments: Rc::new(all_types_arguments),
|
||||
outputs: Rc::new(all_types_outputs),
|
||||
@ -351,7 +351,7 @@ pub fn get_interfaces() {
|
||||
|
||||
#[test]
|
||||
pub fn all_types() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -411,7 +411,7 @@ pub fn all_types() {
|
||||
#[test]
|
||||
pub fn i32_type() {
|
||||
let test = |func_name: &str| {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json(MODULE_NAME, func_name, json!({}), <_>::default());
|
||||
@ -445,7 +445,7 @@ pub fn i32_type() {
|
||||
|
||||
#[test]
|
||||
pub fn i64_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -480,7 +480,7 @@ pub fn i64_type() {
|
||||
|
||||
#[test]
|
||||
pub fn u32_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -504,7 +504,7 @@ pub fn u32_type() {
|
||||
|
||||
#[test]
|
||||
pub fn u64_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -528,7 +528,7 @@ pub fn u64_type() {
|
||||
|
||||
#[test]
|
||||
pub fn f32_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -560,7 +560,7 @@ pub fn f32_type() {
|
||||
|
||||
#[test]
|
||||
pub fn f64_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -592,7 +592,7 @@ pub fn f64_type() {
|
||||
|
||||
#[test]
|
||||
pub fn string_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -618,7 +618,7 @@ pub fn string_type() {
|
||||
pub fn str_type() {
|
||||
const FUNC_NAME: &'static str = "str_type";
|
||||
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json(MODULE_NAME, FUNC_NAME, json!({}), <_>::default());
|
||||
@ -637,7 +637,7 @@ pub fn str_type() {
|
||||
|
||||
#[test]
|
||||
pub fn bytearray_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -664,7 +664,7 @@ pub fn bytearray_type() {
|
||||
|
||||
#[test]
|
||||
pub fn bool_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
@ -690,7 +690,7 @@ pub fn bool_type() {
|
||||
pub fn empty_type() {
|
||||
const FUNC_NAME: &'static str = "empty_type";
|
||||
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let expected_result = json!("success");
|
||||
|
@ -16,18 +16,18 @@
|
||||
|
||||
mod utils;
|
||||
|
||||
use fluence_faas::FluenceFaaS;
|
||||
use fluence_faas::IType;
|
||||
use marine::Marine;
|
||||
use marine::IType;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use serde_json::json;
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
static ARG_CONFIG: Lazy<fluence_faas::TomlFaaSConfig> = Lazy::new(|| {
|
||||
static ARG_CONFIG: Lazy<marine::TomlMarineConfig> = Lazy::new(|| {
|
||||
let mut arrays_passing_config =
|
||||
fluence_faas::TomlFaaSConfig::load("./tests/wasm_tests/arrays_passing/Config.toml")
|
||||
.expect("toml faas config should be created");
|
||||
marine::TomlMarineConfig::load("./tests/wasm_tests/arrays_passing/Config.toml")
|
||||
.expect("toml marine config should be created");
|
||||
|
||||
arrays_passing_config.modules_dir =
|
||||
Some(String::from("./tests/wasm_tests/arrays_passing/artifacts"));
|
||||
@ -39,24 +39,24 @@ static ARG_CONFIG: Lazy<fluence_faas::TomlFaaSConfig> = Lazy::new(|| {
|
||||
pub fn get_interfaces() {
|
||||
use std::collections::HashSet;
|
||||
|
||||
let faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let interface = faas.get_interface();
|
||||
|
||||
let byte_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let byte_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::ByteArray,
|
||||
}];
|
||||
let byte_type_outputs = vec![IType::ByteArray];
|
||||
|
||||
let byte_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let byte_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("byte_type")),
|
||||
arguments: Rc::new(byte_type_arguments),
|
||||
outputs: Rc::new(byte_type_outputs),
|
||||
};
|
||||
|
||||
let inner_arrays_1_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let inner_arrays_1_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::Array(Box::new(IType::Array(Box::new(
|
||||
IType::ByteArray,
|
||||
@ -66,7 +66,7 @@ pub fn get_interfaces() {
|
||||
IType::Array(Box::new(IType::ByteArray)),
|
||||
))))];
|
||||
|
||||
let inner_arrays_1_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let inner_arrays_1_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("inner_arrays_1")),
|
||||
arguments: Rc::new(inner_arrays_1_arguments),
|
||||
outputs: Rc::new(inner_arrays_1_outputs),
|
||||
@ -74,7 +74,7 @@ pub fn get_interfaces() {
|
||||
|
||||
// save it until record will be refactored in the future
|
||||
/*
|
||||
let inner_arrays_2_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let inner_arrays_2_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::Array(Box::new(IType::Array(Box::new(
|
||||
IType::Array(Box::new(IType::Record(6))),
|
||||
@ -84,93 +84,93 @@ pub fn get_interfaces() {
|
||||
IType::Array(Box::new(IType::Array(Box::new(IType::Record(6))))),
|
||||
))))];
|
||||
|
||||
let inner_arrays_2_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let inner_arrays_2_sign = marine::MarineFunctionSignature {
|
||||
name: "inner_arrays_1",
|
||||
arguments: &inner_arrays_2_arguments,
|
||||
outputs: &inner_arrays_2_outputs,
|
||||
};
|
||||
*/
|
||||
|
||||
let string_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let string_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::String)),
|
||||
}];
|
||||
let string_type_outputs = vec![IType::Array(Box::new(IType::String))];
|
||||
|
||||
let string_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let string_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("string_type")),
|
||||
arguments: Rc::new(string_type_arguments),
|
||||
outputs: Rc::new(string_type_outputs),
|
||||
};
|
||||
|
||||
let i32_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let i32_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::S32)),
|
||||
}];
|
||||
let i32_type_outputs = vec![IType::Array(Box::new(IType::S32))];
|
||||
|
||||
let i32_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let i32_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("i32_type")),
|
||||
arguments: Rc::new(i32_type_arguments),
|
||||
outputs: Rc::new(i32_type_outputs),
|
||||
};
|
||||
|
||||
let i64_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let i64_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::S64)),
|
||||
}];
|
||||
|
||||
let i64_type_outputs = vec![IType::Array(Box::new(IType::S64))];
|
||||
|
||||
let i64_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let i64_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("i64_type")),
|
||||
arguments: Rc::new(i64_type_arguments),
|
||||
outputs: Rc::new(i64_type_outputs),
|
||||
};
|
||||
|
||||
let u32_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let u32_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::U32)),
|
||||
}];
|
||||
let u32_type_outputs = vec![IType::Array(Box::new(IType::U32))];
|
||||
|
||||
let u32_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let u32_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("u32_type")),
|
||||
arguments: Rc::new(u32_type_arguments),
|
||||
outputs: Rc::new(u32_type_outputs),
|
||||
};
|
||||
|
||||
let u64_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let u64_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::U64)),
|
||||
}];
|
||||
let u64_type_outputs = vec![IType::Array(Box::new(IType::U64))];
|
||||
|
||||
let u64_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let u64_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("u64_type")),
|
||||
arguments: Rc::new(u64_type_arguments),
|
||||
outputs: Rc::new(u64_type_outputs),
|
||||
};
|
||||
|
||||
let f32_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let f32_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::F32)),
|
||||
}];
|
||||
let f32_type_outputs = vec![IType::Array(Box::new(IType::F32))];
|
||||
|
||||
let f32_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let f32_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("f32_type")),
|
||||
arguments: Rc::new(f32_type_arguments),
|
||||
outputs: Rc::new(f32_type_outputs),
|
||||
};
|
||||
|
||||
let f64_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let f64_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::F64)),
|
||||
}];
|
||||
let f64_type_outputs = vec![IType::Array(Box::new(IType::F64))];
|
||||
|
||||
let f64_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let f64_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("f64_type")),
|
||||
arguments: Rc::new(f64_type_arguments),
|
||||
outputs: Rc::new(f64_type_outputs),
|
||||
@ -179,19 +179,19 @@ pub fn get_interfaces() {
|
||||
let empty_type_arguments = vec![];
|
||||
let empty_type_outputs = vec![IType::Array(Box::new(IType::String))];
|
||||
|
||||
let empty_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let empty_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("empty_type")),
|
||||
arguments: Rc::new(empty_type_arguments),
|
||||
outputs: Rc::new(empty_type_outputs),
|
||||
};
|
||||
|
||||
let bool_type_arguments = vec![fluence_faas::IFunctionArg {
|
||||
let bool_type_arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("arg"),
|
||||
ty: IType::Array(Box::new(IType::Boolean)),
|
||||
}];
|
||||
let bool_type_outputs = vec![IType::Array(Box::new(IType::Boolean))];
|
||||
|
||||
let bool_type_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let bool_type_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("bool_type")),
|
||||
arguments: Rc::new(bool_type_arguments),
|
||||
outputs: Rc::new(bool_type_outputs),
|
||||
@ -245,8 +245,8 @@ pub fn get_interfaces() {
|
||||
|
||||
#[test]
|
||||
pub fn i32_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let expected_result = json!([0, 1, 2, 3, 4, 0, 2]);
|
||||
|
||||
@ -284,8 +284,8 @@ pub fn i32_type() {
|
||||
|
||||
#[test]
|
||||
pub fn i64_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json("arrays_passing_pure", "i64_type", json!({}), <_>::default());
|
||||
assert!(result1.is_err());
|
||||
@ -318,8 +318,8 @@ pub fn i64_type() {
|
||||
|
||||
#[test]
|
||||
pub fn u32_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json("arrays_passing_pure", "u32_type", json!({}), <_>::default());
|
||||
assert!(result1.is_err());
|
||||
@ -343,8 +343,8 @@ pub fn u32_type() {
|
||||
|
||||
#[test]
|
||||
pub fn u64_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json("arrays_passing_pure", "u64_type", json!({}), <_>::default());
|
||||
assert!(result1.is_err());
|
||||
@ -368,8 +368,8 @@ pub fn u64_type() {
|
||||
|
||||
#[test]
|
||||
pub fn f64_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json("arrays_passing_pure", "f32_type", json!({}), <_>::default());
|
||||
assert!(result1.is_err());
|
||||
@ -393,8 +393,8 @@ pub fn f64_type() {
|
||||
|
||||
#[test]
|
||||
pub fn string_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json(
|
||||
"arrays_passing_pure",
|
||||
@ -433,8 +433,8 @@ pub fn string_type() {
|
||||
|
||||
#[test]
|
||||
pub fn byte_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json(
|
||||
"arrays_passing_pure",
|
||||
@ -472,8 +472,8 @@ pub fn byte_type() {
|
||||
|
||||
#[test]
|
||||
pub fn inner_arrays_1_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json(
|
||||
"arrays_passing_pure",
|
||||
@ -519,8 +519,8 @@ pub fn inner_arrays_1_type() {
|
||||
|
||||
#[test]
|
||||
pub fn inner_arrays_2_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json(
|
||||
"arrays_passing_pure",
|
||||
@ -591,8 +591,8 @@ pub fn inner_arrays_2_type() {
|
||||
|
||||
#[test]
|
||||
pub fn bool_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let result1 = faas.call_with_json(
|
||||
"arrays_passing_pure",
|
||||
@ -626,8 +626,8 @@ pub fn bool_type() {
|
||||
|
||||
#[test]
|
||||
pub fn empty_type() {
|
||||
let mut faas = FluenceFaaS::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(ARG_CONFIG.clone())
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence Marine instance: {}", e));
|
||||
|
||||
let expected_result = json!(["from effector"]);
|
||||
let result1 = call_faas!(faas, "arrays_passing_pure", "empty_type", json!({}));
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use fluence_faas::FluenceFaaS;
|
||||
use fluence_faas::IValue;
|
||||
use marine::Marine;
|
||||
use marine::IValue;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
@ -26,13 +26,13 @@ pub fn call_parameters() {
|
||||
let call_parameters_config_raw = std::fs::read(call_parameters_config_path)
|
||||
.expect("../examples/call_parameters/Config.toml should presence");
|
||||
|
||||
let mut call_parameters_config: fluence_faas::TomlFaaSConfig =
|
||||
let mut call_parameters_config: marine::TomlMarineConfig =
|
||||
toml::from_slice(&call_parameters_config_raw)
|
||||
.expect("call_parameters config should be well-formed");
|
||||
call_parameters_config.modules_dir =
|
||||
Some(String::from("../examples/call_parameters/artifacts"));
|
||||
|
||||
let mut faas = FluenceFaaS::with_raw_config(call_parameters_config)
|
||||
let mut faas = Marine::with_raw_config(call_parameters_config)
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let init_peer_id = "init_peer_id";
|
||||
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use fluence_faas::FluenceFaaS;
|
||||
use fluence_faas::FaaSModuleInterface;
|
||||
use fluence_faas::IValue;
|
||||
use marine::Marine;
|
||||
use marine::MarineModuleInterface;
|
||||
use marine::IValue;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
@ -29,12 +29,12 @@ pub fn greeting() {
|
||||
let greeting_config_raw = std::fs::read(greeting_config_path)
|
||||
.expect("../examples/greeting/Config.toml should presence");
|
||||
|
||||
let mut greeting_config: fluence_faas::TomlFaaSConfig =
|
||||
let mut greeting_config: marine::TomlMarineConfig =
|
||||
toml::from_slice(&greeting_config_raw).expect("greeting config should be well-formed");
|
||||
greeting_config.modules_dir = Some(String::from("../examples/greeting/artifacts"));
|
||||
|
||||
let mut faas = FluenceFaaS::with_raw_config(greeting_config)
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let mut faas = Marine::with_raw_config(greeting_config)
|
||||
.unwrap_or_else(|e| panic!("can't create Marine instance: {}", e));
|
||||
|
||||
let result1 = faas
|
||||
.call_with_ivalues(
|
||||
@ -65,29 +65,29 @@ pub fn get_interfaces() {
|
||||
let greeting_config_raw = std::fs::read(greeting_config_path)
|
||||
.expect("../examples/greeting/Config.toml should presence");
|
||||
|
||||
let mut greeting_config: fluence_faas::TomlFaaSConfig =
|
||||
let mut greeting_config: marine::TomlMarineConfig =
|
||||
toml::from_slice(&greeting_config_raw).expect("greeting config should be well-formed");
|
||||
greeting_config.modules_dir = Some(String::from("../examples/greeting/artifacts"));
|
||||
|
||||
let faas = FluenceFaaS::with_raw_config(greeting_config)
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
let faas = Marine::with_raw_config(greeting_config)
|
||||
.unwrap_or_else(|e| panic!("can't create Marine instance: {}", e));
|
||||
|
||||
let interface = faas.get_interface();
|
||||
|
||||
let arguments = vec![fluence_faas::IFunctionArg {
|
||||
let arguments = vec![marine::IFunctionArg {
|
||||
name: String::from("name"),
|
||||
ty: fluence_faas::IType::String,
|
||||
ty: marine::IType::String,
|
||||
}];
|
||||
let output_types = vec![fluence_faas::IType::String];
|
||||
let output_types = vec![marine::IType::String];
|
||||
|
||||
let greeting_sign = fluence_faas::FaaSFunctionSignature {
|
||||
let greeting_sign = marine::MarineFunctionSignature {
|
||||
name: Rc::new(String::from("greeting")),
|
||||
arguments: Rc::new(arguments),
|
||||
outputs: Rc::new(output_types),
|
||||
};
|
||||
|
||||
let record_types = std::collections::HashMap::new();
|
||||
let module_interface = FaaSModuleInterface {
|
||||
let module_interface = MarineModuleInterface {
|
||||
record_types: &record_types,
|
||||
function_signatures: vec![greeting_sign],
|
||||
};
|
||||
@ -95,5 +95,5 @@ pub fn get_interfaces() {
|
||||
let mut modules = std::collections::HashMap::new();
|
||||
modules.insert("greeting", module_interface);
|
||||
|
||||
assert_eq!(interface, fluence_faas::FaaSInterface { modules });
|
||||
assert_eq!(interface, marine::MarineInterface { modules });
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use fluence_faas::FluenceFaaS;
|
||||
use fluence_faas::IValue;
|
||||
use marine::Marine;
|
||||
use marine::IValue;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
@ -27,11 +27,11 @@ pub fn records() {
|
||||
let records_config_raw = std::fs::read(records_config_path)
|
||||
.expect("../examples/records/Config.toml should presence");
|
||||
|
||||
let mut records_config: fluence_faas::TomlFaaSConfig =
|
||||
let mut records_config: marine::TomlMarineConfig =
|
||||
toml::from_slice(&records_config_raw).expect("records config should be well-formed");
|
||||
records_config.modules_dir = Some(String::from("../examples/records/artifacts/"));
|
||||
|
||||
let mut faas = FluenceFaaS::with_raw_config(records_config)
|
||||
let mut faas = Marine::with_raw_config(records_config)
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let result1 = faas
|
||||
@ -161,14 +161,14 @@ fn records_passing() {
|
||||
let inner_records_config_raw = std::fs::read("./tests/wasm_tests/records_passing/Config.toml")
|
||||
.expect("./tests/wasm_tests/records_passing/Config.toml should presence");
|
||||
|
||||
let mut records_passing_config: fluence_faas::TomlFaaSConfig =
|
||||
let mut records_passing_config: marine::TomlMarineConfig =
|
||||
toml::from_slice(&inner_records_config_raw)
|
||||
.expect("argument passing test config should be well-formed");
|
||||
|
||||
records_passing_config.modules_dir =
|
||||
Some(String::from("./tests/wasm_tests/records_passing/artifacts"));
|
||||
|
||||
let mut faas = FluenceFaaS::with_raw_config(records_passing_config)
|
||||
let mut faas = Marine::with_raw_config(records_passing_config)
|
||||
.unwrap_or_else(|e| panic!("can't create Fluence FaaS instance: {}", e));
|
||||
|
||||
let mut test = |func_name: &str| {
|
||||
|
@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "mrepl"
|
||||
description = "Fluence Marine REPL intended for testing purposes"
|
||||
version = "0.16.1"
|
||||
version = "0.16.2"
|
||||
authors = ["Fluence Labs"]
|
||||
repository = "https://github.com/fluencelabs/marine/tools/repl"
|
||||
license = "Apache-2.0"
|
||||
|
Loading…
Reference in New Issue
Block a user