Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check the app fields in graph #154

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/src/ten_manager/src/cmd/cmd_check/cmd_check_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use anyhow::{Context, Result};
use clap::{Arg, ArgMatches, Command};
use console::Emoji;
use ten_rust::pkg_info::{
default_app_loc, get_all_existed_pkgs_info_of_app, graph::Graph,
get_all_existed_pkgs_info_of_app, graph::Graph, localhost,
property::parse_property_in_folder, PkgInfo,
};

Expand Down Expand Up @@ -109,7 +109,7 @@ fn get_existed_pkgs_of_all_apps(
let app_existed_pkgs = get_all_existed_pkgs_info_of_app(app_path)?;

let app_uri = app_property.get_app_uri();
if !single_app && app_uri.as_str() == default_app_loc() {
if !single_app && app_uri.as_str() == localhost() {
return Err(anyhow::anyhow!(
"The app uri should be some string other than 'localhost' when
using in multi-apps graph."
Expand Down Expand Up @@ -143,7 +143,7 @@ fn get_graphs_to_be_checked(command: &CheckGraphCommand) -> Result<Vec<Graph>> {
.and_then(|p| p.predefined_graphs)
.ok_or_else(|| {
anyhow::anyhow!(
"No predefined graph is found in the primary app."
"No predefined graph is found in the first app."
)
})?;

Expand Down
16 changes: 8 additions & 8 deletions core/src/ten_manager/src/dev_server/graphs/connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ mod tests {
use crate::{
config::TmanConfig, dev_server::mock::tests::inject_all_pkgs_for_mock,
};
use ten_rust::pkg_info::default_app_loc;
use ten_rust::pkg_info::localhost;

#[actix_web::test]
async fn test_get_connections_success() {
Expand Down Expand Up @@ -236,13 +236,13 @@ mod tests {
serde_json::from_str(body_str).unwrap();

let expected_connections = vec![DevServerConnection {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_1".to_string(),
cmd: Some(vec![DevServerMessageFlow {
name: "hello_world".to_string(),
dest: vec![DevServerDestination {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
}],
Expand Down Expand Up @@ -316,37 +316,37 @@ mod tests {
serde_json::from_str(body_str).unwrap();

let expected_connections = vec![DevServerConnection {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_1".to_string(),
cmd: Some(vec![DevServerMessageFlow {
name: "hello_world".to_string(),
dest: vec![DevServerDestination {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
}],
}]),
data: Some(vec![DevServerMessageFlow {
name: "data".to_string(),
dest: vec![DevServerDestination {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
}],
}]),
audio_frame: Some(vec![DevServerMessageFlow {
name: "pcm".to_string(),
dest: vec![DevServerDestination {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
}],
}]),
video_frame: Some(vec![DevServerMessageFlow {
name: "image".to_string(),
dest: vec![DevServerDestination {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
}],
Expand Down
8 changes: 4 additions & 4 deletions core/src/ten_manager/src/dev_server/graphs/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ mod tests {
use crate::{
config::TmanConfig, dev_server::mock::tests::inject_all_pkgs_for_mock,
};
use ten_rust::pkg_info::default_app_loc;
use ten_rust::pkg_info::localhost;

#[actix_web::test]
async fn test_get_extensions_success() {
Expand Down Expand Up @@ -424,7 +424,7 @@ mod tests {
addon: "extension_addon_1".to_string(),
name: "extension_1".to_string(),
extension_group: "extension_group_1".to_string(),
app: default_app_loc(),
app: localhost(),
api: Some(DevServerApi {
property: None,
cmd_in: None,
Expand Down Expand Up @@ -476,7 +476,7 @@ mod tests {
addon: "extension_addon_2".to_string(),
name: "extension_2".to_string(),
extension_group: "extension_group_1".to_string(),
app: default_app_loc(),
app: localhost(),
api: Some(DevServerApi {
property: None,
cmd_in: Some(vec![
Expand Down Expand Up @@ -550,7 +550,7 @@ mod tests {
addon: "extension_addon_3".to_string(),
name: "extension_3".to_string(),
extension_group: "extension_group_1".to_string(),
app: default_app_loc(),
app: localhost(),
api: Some(DevServerApi {
property: None,
cmd_in: Some(vec![DevServerApiCmdLike {
Expand Down
16 changes: 8 additions & 8 deletions core/src/ten_manager/src/dev_server/messages/compatible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ mod tests {
use crate::{
config::TmanConfig, dev_server::mock::tests::inject_all_pkgs_for_mock,
};
use ten_rust::pkg_info::default_app_loc;
use ten_rust::pkg_info::localhost;

#[actix_web::test]
async fn test_get_compatible_messages_success() {
Expand Down Expand Up @@ -382,7 +382,7 @@ mod tests {
serde_json::from_str(body_str).unwrap();

let expected_compatibles = vec![DevServerCompatibleMsg {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
msg_type: MsgType::Cmd,
Expand Down Expand Up @@ -524,7 +524,7 @@ mod tests {
serde_json::from_str(body_str).unwrap();

let expected_compatibles = vec![DevServerCompatibleMsg {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
msg_type: MsgType::Cmd,
Expand Down Expand Up @@ -605,7 +605,7 @@ mod tests {
serde_json::from_str(body_str).unwrap();

let expected_compatibles = vec![DevServerCompatibleMsg {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
msg_type: MsgType::Cmd,
Expand Down Expand Up @@ -686,15 +686,15 @@ mod tests {

let expected_compatibles = vec![
DevServerCompatibleMsg {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_1".to_string(),
msg_type: MsgType::Cmd,
msg_direction: MsgDirection::In,
msg_name: "cmd1".to_string(),
},
DevServerCompatibleMsg {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
msg_type: MsgType::Cmd,
Expand Down Expand Up @@ -777,7 +777,7 @@ mod tests {
serde_json::from_str(body_str).unwrap();

let expected_compatibles = vec![DevServerCompatibleMsg {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_2".to_string(),
msg_type: MsgType::Cmd,
Expand Down Expand Up @@ -1165,7 +1165,7 @@ mod tests {
serde_json::from_str(body_str).unwrap();

let expected_compatibles = vec![DevServerCompatibleMsg {
app: default_app_loc(),
app: localhost(),
extension_group: "extension_group_1".to_string(),
extension: "extension_1".to_string(),
msg_type: MsgType::VideoFrame,
Expand Down
3 changes: 1 addition & 2 deletions core/src/ten_rust/src/json_schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,7 @@ mod tests {
{
"_ten": {
"log_level": 2,
"log_file": "api.log",
"uri": "localhost"
"log_file": "api.log"
},
"a": 1,
"b": "2",
Expand Down
Loading
Loading