Skip to content

Commit

Permalink
Merge pull request #258 from kinode-dao/hf/code-no-cab
Browse files Browse the repository at this point in the history
code: no cab
  • Loading branch information
nick1udwig authored Nov 14, 2024
2 parents df5d865 + e9aaf61 commit 8c77430
Show file tree
Hide file tree
Showing 237 changed files with 24,009 additions and 17,372 deletions.
File renamed without changes.

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

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"
members = [
"chat_with_file_transfer",
"chat-with-file-transfer",
"download",
"send",
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "chat_with_file_transfer"
name = "chat-with-file-transfer"
version = "0.1.0"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn handle_chat_request(
let _ = Request::new()
.target(Address {
node: target.clone(),
process: "chat_with_file_transfer:chat_with_file_transfer:template.os"
process: "chat-with-file-transfer:chat-with-file-transfer:template.os"
.parse()?,
})
.body(request)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "chat_with_file_transfer",
"name": "chat-with-file-transfer",
"description": "",
"image": "",
"properties": {
"package_name": "chat_with_file_transfer",
"package_name": "chat-with-file-transfer",
"current_version": "0.1.0",
"publisher": "template.os",
"mirrors": [],
Expand All @@ -12,7 +12,7 @@
},
"wit_version": 0,
"dependencies": [
"file_transfer:template.os"
"file-transfer:template.os"
]
},
"external_url": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"process_name": "chat_with_file_transfer",
"process_wasm_path": "/chat_with_file_transfer.wasm",
"process_name": "chat-with-file-transfer",
"process_wasm_path": "/chat-with-file-transfer.wasm",
"on_exit": "Restart",
"request_networking": true,
"request_capabilities": [
Expand Down

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

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"
members = [
"chat_with_file_transfer_test",
"chat-with-file-transfer-test",
]

[profile.release]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "chat_with_file_transfer_test"
name = "chat-with-file-transfer-test"
version = "0.1.0"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ wit_bindgen::generate!({

const FILE_NAME: &str = "my_file.txt";
const FILE_CONTENTS: &str = "hi";
const DRIVE_PATH: &str = "chat_with_file_transfer:template.os";
const DRIVE_PATH: &str = "chat-with-file-transfer:template.os";

impl From<Address> for WitAddress {
fn from(address: Address) -> Self {
Expand Down Expand Up @@ -54,8 +54,8 @@ fn make_chat_address(node: &str) -> Address {
Address {
node: node.to_string(),
process: ProcessId::new(
Some("chat_with_file_transfer"),
"chat_with_file_transfer",
Some("chat-with-file-transfer"),
"chat-with-file-transfer",
"template.os",
),
}
Expand All @@ -75,7 +75,7 @@ fn setup(our: &Address, their: &str) -> anyhow::Result<()> {
.send()?;

// caps on our
println!("chat_with_file_transfer_test: started caps handshake...");
println!("chat-with-file-transfer-test: started caps handshake...");

let response = Request::new()
.target(our_chat_address.clone())
Expand All @@ -84,7 +84,7 @@ fn setup(our: &Address, their: &str) -> anyhow::Result<()> {

save_capabilities(response.capabilities());
println!(
"chat_with_file_transfer_test: got caps {:#?}",
"chat-with-file-transfer-test: got caps {:#?}",
our_capabilities()
);

Expand All @@ -108,20 +108,20 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {
input_node_names: node_names,
..
}) = message.body().try_into()?;
println!("chat_with_file_transfer_test: a");
println!("chat-with-file-transfer-test: a");
assert!(node_names.len() >= 2);
// we are master node
assert!(our.node == node_names[0]);

if setup(&our, &node_names[1]).is_err() {
fail!("chat_with_file_transfer_test");
fail!("chat-with-file-transfer-test");
}

let our_chat_address = make_chat_address(&our.node);
let their_chat_address = make_chat_address(&node_names[1]);

// Send
println!("chat_with_file_transfer_test: b");
println!("chat-with-file-transfer-test: b");
let message: String = "hello".into();
let _ = Request::new()
.target(our_chat_address.clone())
Expand All @@ -133,17 +133,17 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {
.unwrap();

// Get history from receiver & test
println!("chat_with_file_transfer_test: c");
println!("chat-with-file-transfer-test: c");
let response = Request::new()
.target(their_chat_address.clone())
.body(ChatRequest::History(our.node.clone()))
.send_and_await_response(15)?
.unwrap();
if response.is_request() {
fail!("chat_with_file_transfer_test");
fail!("chat-with-file-transfer-test");
};
let ChatResponse::History(messages) = response.body().try_into()? else {
fail!("chat_with_file_transfer_test");
fail!("chat-with-file-transfer-test");
};
let expected_messages = vec![ChatMessage {
author: our.node.clone(),
Expand All @@ -152,10 +152,11 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {

if messages != expected_messages {
println!("{messages:?} != {expected_messages:?}");
fail!("chat_with_file_transfer_test");
fail!("chat-with-file-transfer-test");
}

// Test file_transfer_worker
println!("chat-with-file-transfer-test: d");
let response = Request::new()
.target(our_chat_address.clone())
.body(WorkerRequest::Download(DownloadRequest {
Expand All @@ -166,7 +167,7 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {
.send_and_await_response(15)?
.unwrap();
if response.is_request() {
fail!("chat_with_file_transfer_test");
fail!("chat-with-file-transfer-test");
};
std::thread::sleep(std::time::Duration::from_secs(3));

Expand All @@ -176,7 +177,7 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {
};
let file_contents = file.read()?;
if file_contents != FILE_CONTENTS.as_bytes() {
fail!("chat_with_file_transfer_test");
fail!("chat-with-file-transfer-test");
}

Response::new()
Expand All @@ -195,9 +196,9 @@ fn init(our: Address) {
match handle_message(&our) {
Ok(()) => {}
Err(e) => {
println!("chat_with_file_transfer_test: error: {e:?}");
println!("chat-with-file-transfer-test: error: {e:?}");

fail!("chat_with_file_transfer_test");
fail!("chat-with-file-transfer-test");
}
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "chat_with_file_transfer Test",
"description": "A test for chat_with_file_transfer.",
"name": "chat-with-file-transfer Test",
"description": "A test for chat-with-file-transfer.",
"image": "",
"properties": {
"package_name": "chat_with_file_transfer_test",
"package_name": "chat-with-file-transfer-test",
"current_version": "0.1.0",
"publisher": "template.os",
"mirrors": [],
Expand All @@ -12,8 +12,8 @@
},
"wit_version": 0,
"dependencies": [
"chat_with_file_transfer:template.os",
"file_transfer:template.os",
"chat-with-file-transfer:template.os",
"file-transfer:template.os",
"tester:sys"
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"process_name": "chat-with-file-transfer-test",
"process_wasm_path": "/chat-with-file-transfer-test.wasm",
"on_exit": "Restart",
"request_networking": false,
"request_capabilities": [
"chat-with-file-transfer:chat-with-file-transfer:template.os"
],
"grant_capabilities": [
"chat-with-file-transfer:chat-with-file-transfer:template.os"
],
"public": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ runtime_build_release = false


[[tests]]
dependency_package_paths = ["..", "../../file_transfer"]
dependency_package_paths = ["..", "../../file-transfer"]
setup_packages = [
{ path = "..", run = true }
]
setup_scripts = []
test_package_paths = ["chat_with_file_transfer_test"]
test_package_paths = ["chat-with-file-transfer-test"]
test_scripts = []
timeout_secs = 5
fakechain_router = 8545
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
target
*/target/
pkg/*.wasm
pkg/*.zip
pkg/ui
*.swp
*.swo
Expand All @@ -9,4 +10,4 @@ pkg/ui
*/process_env
ui/dist
ui/node_modules
node_modules
node_modules
Loading

0 comments on commit 8c77430

Please sign in to comment.