Skip to content

Commit

Permalink
Update native & pytests
Browse files Browse the repository at this point in the history
  • Loading branch information
icppWorld committed Feb 1, 2025
1 parent 7ff8fa6 commit 9c0fc1f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
6 changes: 3 additions & 3 deletions native/test_qwen2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ void test_qwen2(MockIC &mockIC) {
// -----------------------------------------------------------------------------
// Remove the log-file file if it exists
// '(record { args = vec {"--log-file"; "main.log"} })' ->
// '(variant { Ok = record { status_code = 200 : nat16; output = "Cache file .canister_cache/expmt-gtxsw-inftj-ttabj-qhp5s-nozup-n3bbo-k7zvn-dg4he-knac3-lae/sessions/main.log deleted successfully"; input = ""; error=""; prompt_remaining=""; generated_eog=false : bool } })'
// '(variant { Ok = record { status_code = 200 : nat16; output = "Successfully removed log file: main.log"; input = ""; error=""; prompt_remaining=""; generated_eog=false : bool } })'
mockIC.run_test(
std::string(__func__) + ": " + "remove_log_file " + model,
remove_prompt_cache,
remove_log_file,
"4449444c026c01dd9ad28304016d710100020a2d2d6c6f672d66696c65086d61696e2e6c6f67",
"4449444c026b01bc8a01016c06819e846471c897a79907718a88f7f00b719aa1b2f90c7adb92a2c90d71cdd9e6b30e7e010000810143616368652066696c65202e63616e69737465725f63616368652f6578706d742d67747873772d696e66746a2d747461626a2d71687035732d6e6f7a75702d6e3362626f2d6b377a766e2d64673468652d6b6e6163332d6c61652f73657373696f6e732f6d61696e2e6c6f672064656c65746564207375636365737366756c6c790000c8000000",
"4449444c026c06819e846471838fe5800671c897a79907719aa1b2f90c7adb92a2c90d71cdd9e6b30e7e6b01bc8a0100010100275375636365737366756c6c792072656d6f766564206c6f672066696c653a206d61696e2e6c6f670000c8000000",
silent_on_trap, my_principal);
}
15 changes: 4 additions & 11 deletions native/test_tiny_stories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,14 @@ void test_tiny_stories(MockIC &mockIC) {

// -----------------------------------------------------------------------------
// Remove the log-file file if it exists
// '(record { args = vec {"--log-file"; "main.log"} })' -> response
std::string response;
if (i == 1) {
// '(variant { Ok = record { status_code = 200 : nat16; output = "Successfully removed log file: main.log"; input = ""; error=""; prompt_remaining=""; generated_eog=false : bool } })'
response =
"4449444c026c06819e846471838fe5800671c897a79907719aa1b2f90c7adb92a2c90d71cdd9e6b30e7e6b01bc8a0100010100275375636365737366756c6c792072656d6f766564206c6f672066696c653a206d61696e2e6c6f670000c8000000";
} else {
response =
"4449444c026c06819e846471838fe5800671c897a79907719aa1b2f90c7adb92a2c90d71cdd9e6b30e7e6b01bc8a0100010100275375636365737366756c6c792072656d6f766564206c6f672066696c653a206d61696e2e6c6f670000c8000000";
}
// '(record { args = vec {"--log-file"; "main.log"} })' ->
// '(variant { Ok = record { status_code = 200 : nat16; output = "Successfully removed log file: main.log"; input = ""; error=""; prompt_remaining=""; generated_eog=false : bool } })'
mockIC.run_test(
std::string(__func__) + ": " + "remove_log_file " + model,
remove_log_file,
"4449444c026c01dd9ad28304016d710100020a2d2d6c6f672d66696c65086d61696e2e6c6f67",
response, silent_on_trap, my_principal);
"4449444c026c06819e846471838fe5800671c897a79907719aa1b2f90c7adb92a2c90d71cdd9e6b30e7e6b01bc8a0100010100275375636365737366756c6c792072656d6f766564206c6f672066696c653a206d61696e2e6c6f670000c8000000",
silent_on_trap, my_principal);
}
}
}
10 changes: 10 additions & 0 deletions test/test_qwen2.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,14 @@ def test__remove_prompt_cache(network: str) -> None:
canister_argument='(record { args = vec {"--prompt-cache"; "prompt.cache"} })',
network=network,
)
assert "(variant { Ok" in response

def test__remove_log_file(network: str) -> None:
response = call_canister_api(
dfx_json_path=DFX_JSON_PATH,
canister_name=CANISTER_NAME,
canister_method="remove_log_file",
canister_argument='(record { args = vec {"--log-file"; "main.log"} })',
network=network,
)
assert "(variant { Ok" in response
10 changes: 10 additions & 0 deletions test/test_tiny_stories.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,14 @@ def test__remove_prompt_cache(network: str) -> None:
canister_argument='(record { args = vec {"--prompt-cache"; "prompt.cache"} })',
network=network,
)
assert "(variant { Ok" in response

def test__remove_log_file(network: str) -> None:
response = call_canister_api(
dfx_json_path=DFX_JSON_PATH,
canister_name=CANISTER_NAME,
canister_method="remove_log_file",
canister_argument='(record { args = vec {"--log-file"; "main.log"} })',
network=network,
)
assert "(variant { Ok" in response

0 comments on commit 9c0fc1f

Please sign in to comment.