-
Notifications
You must be signed in to change notification settings - Fork 1
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: add agent tests #19
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: WoodenMaiden <[email protected]>
Signed-off-by: WoodenMaiden <[email protected]>
Signed-off-by: WoodenMaiden <[email protected]>
26de47b
to
8001149
Compare
Signed-off-by: WoodenMaiden <[email protected]>
Signed-off-by: WoodenMaiden <[email protected]>
Signed-off-by: WoodenMaiden <[email protected]>
Signed-off-by: WoodenMaiden <[email protected]>
Signed-off-by: WoodenMaiden <[email protected]>
|
||
pub async fn register(&mut self, port: u16) -> Result<String> { | ||
#[tonic::async_trait] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have used tokio async_trait here
|
||
assert_eq!(code_return.stdout, "This is stdout"); | ||
assert_eq!(code_return.stderr, "This is stderr"); | ||
assert_eq!(code_return.exit_code, 1); | ||
} | ||
|
||
/// Test the creation of a file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that really what it is testing?
|
||
string | ||
#[test] | ||
fn run_one_works_with_ouputs_and_code() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I tend to prefix all test function's names with 'test_' to easily differentiate it from other functions and to make sure that I specify in the name what it is supposed to test
|
||
assert_eq!(code_return.stdout, "This is stdout"); | ||
assert_eq!(code_return.stderr, "This is stderr"); | ||
assert_eq!(code_return.exit_code, 1); | ||
} | ||
|
||
/// Test the creation of a file | ||
#[test] | ||
fn workload_runs_correctly() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a workload supposed to be?
@@ -15,6 +15,10 @@ const fn default_local_port() -> u16 { | |||
0 | |||
} | |||
|
|||
fn default_workspace_path() -> String { | |||
std::env::temp_dir().to_str().unwrap().to_string() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.to_str().unwrap().to_string() seems a bit ugly :/
pub id: String, | ||
} | ||
|
||
impl LambdoAgentServer { | ||
pub async fn new(config: AgentConfig) -> Self { | ||
pub async fn new<C: ClientTrait + SelfCreatingClientTrait + 'static>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like the idea of a SelfCreatingClientTrait.
For me, we should do that a bit differently:
- LambdoAgentServer::new() should take a ClientTrait as a parameter
- ClientTrait should have a config() function that would be called in LambdoAgentServer::new()
That would probably reduce the complexity by a lot IMO
No description provided.