diff --git a/test/st/cpp/src/base/actor_test.cpp b/test/st/cpp/src/base/actor_test.cpp index 0ff7f7ebb4f045f611cdf9a6939e343e3c1717f4..8b4939099391dc98db65212e00fb909f6523f38b 100644 --- a/test/st/cpp/src/base/actor_test.cpp +++ b/test/st/cpp/src/base/actor_test.cpp @@ -347,7 +347,8 @@ TEST_F(ActorTest, InvalidResource) } catch (YR::Exception &e) { printf("Exception:%s,\n", e.what()); std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required CPU resource size 299 millicores is invalid. Valid value range is [300,16000] millicores"; + std::string errorMsg = + "Required CPU resource size 299 millicores is invalid. Valid value range is [0,16000] millicores"; std::string excepMsg = e.what(); ErrorMsgCheck(errorCode, errorMsg, excepMsg); } @@ -361,7 +362,8 @@ TEST_F(ActorTest, InvalidResource) } catch (YR::Exception &e) { printf("Exception:%s,\n", e.what()); std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required CPU resource size 16001 millicores is invalid. Valid value range is [300,16000] millicores"; + std::string errorMsg = + "Required CPU resource size 16001 millicores is invalid. Valid value range is [0,16000] millicores"; std::string excepMsg = e.what(); ErrorMsgCheck(errorCode, errorMsg, excepMsg); } diff --git a/test/st/cpp/src/base/task_test.cpp b/test/st/cpp/src/base/task_test.cpp index 7f53332f647964ba184f7aaa7f7ba429a318d646..37b00135de2f2a3a559325082300dfa3182e714b 100644 --- a/test/st/cpp/src/base/task_test.cpp +++ b/test/st/cpp/src/base/task_test.cpp @@ -83,38 +83,30 @@ TEST_F(TaskTest, InvokeSuccessfullyWithDifferentResource) /*case * @title: 非法的资源请求进行task调用 * @precondition: - * @step: 1. 以非法资源请求cpu=1,进行task函数调用 - * @step: 2. 以非法资源请求memory=1,进行task函数调用 - * @expect: 1.预期异常抛出,且错误码为1001,错误信息匹配 - * @expect: 2.预期异常抛出,且错误码为1001,错误信息匹配 + * @step: 1. 请求资源cpu=1,进行task函数调用 + * @step: 2. 请求资源memory=1,进行task函数调用 + * @expect: 1.预期成功 + * @expect: 2.预期成功 */ -TEST_F(TaskTest, InvalidResource) +TEST_F(TaskTest, TestResource) { - // invalid cpu + // cpu YR::InvokeOptions option; option.cpu = 1.0; try { auto r1 = YR::Function(&AddOne).Options(std::move(option)).Invoke(2); auto res = *YR::Get(r1); } catch (YR::Exception &e) { - std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required CPU resource size 1 millicores is invalid. Valid value range is [300,16000] millicores"; - std::string excepMsg = e.what(); - std::cout << "exception: " << excepMsg << std::endl; - ErrorMsgCheck(errorCode, errorMsg, excepMsg); + ASSERT_EQ(0, 1); } - // invalid memory + // memory YR::InvokeOptions optionMem; optionMem.memory = 1.0; try { auto r1 = YR::Function(&AddOne).Options(std::move(optionMem)).Invoke(2); auto res = *YR::Get(r1); } catch (YR::Exception &e) { - std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required memory resource size 1 MB is invalid. Valid value range is [128,1073741824] MB"; - std::string excepMsg = e.what(); - std::cout << "exception: " << excepMsg << std::endl; - ErrorMsgCheck(errorCode, errorMsg, excepMsg); + ASSERT_EQ(0, 1); } } diff --git a/test/st/test.sh b/test/st/test.sh index 52af16a0cfd495d3214ba7b06fd33f1001d0ed24..ef2e859e9af9c814b3a33a181f227b33785319e5 100644 --- a/test/st/test.sh +++ b/test/st/test.sh @@ -86,8 +86,9 @@ function generate_test_dir() { function install_python_pkg() { pip3.9 install pytest pip3.9 install requests + pip3.9 install numpy pip3.9 uninstall -y yr - pip3.9 install $YUANRONG_DIR/runtime/sdk/python/yr_sdk-*cp39-cp39-linux_x86_64.whl + pip3.9 install $YUANRONG_DIR/runtime/sdk/python/yr_sdk-*cp39-cp39-linux*.whl } function common_check_st_result() {