3477 lines
200 KiB
Diff
3477 lines
200 KiB
Diff
|
|
From c91b4d223fa590e2d5164b42e12a9bca319831e5 Mon Sep 17 00:00:00 2001
|
||
|
|
From: haozi007 <liuhao27@huawei.com>
|
||
|
|
Date: Thu, 23 Nov 2023 12:31:47 +0000
|
||
|
|
Subject: [PATCH 28/64] !2230 format code * format code tools/static_check.sh
|
||
|
|
|
||
|
|
---
|
||
|
|
src/daemon/common/cri/v1/v1_cri_helpers.cc | 8 +-
|
||
|
|
src/daemon/common/cri/v1/v1_cri_helpers.h | 6 +-
|
||
|
|
.../common/cri/v1/v1_cri_security_context.cc | 6 +-
|
||
|
|
.../entry/connect/grpc/cri/cri_service.cc | 2 +-
|
||
|
|
.../cri/v1/cri_v1_runtime_image_service.cc | 20 +-
|
||
|
|
.../cri/v1/cri_v1_runtime_runtime_service.cc | 91 +--
|
||
|
|
.../v1alpha/cri_runtime_runtime_service.cc | 3 +-
|
||
|
|
src/daemon/entry/connect/grpc/grpc_service.cc | 2 +-
|
||
|
|
src/daemon/entry/cri/network_plugin.cc | 4 +-
|
||
|
|
.../v1/v1_cri_container_manager_service.cc | 10 +-
|
||
|
|
.../v1/v1_cri_image_manager_service_impl.cc | 6 +-
|
||
|
|
.../v1/v1_cri_image_manager_service_impl.h | 2 +-
|
||
|
|
.../v1/v1_cri_pod_sandbox_manager_service.cc | 15 +-
|
||
|
|
.../v1alpha/cri_container_manager_service.cc | 3 +-
|
||
|
|
.../cri_pod_sandbox_manager_service.cc | 2 +-
|
||
|
|
.../entry/cri/v1alpha/cri_security_context.cc | 6 +-
|
||
|
|
.../entry/cri/v1alpha/v1alpha_cri_helpers.cc | 2 +-
|
||
|
|
.../executor/container_cb/execution_create.c | 8 +-
|
||
|
|
.../container_cb/execution_information.c | 5 +-
|
||
|
|
src/daemon/modules/api/container_api.h | 3 +-
|
||
|
|
.../modules/container/restore/restore.c | 3 +-
|
||
|
|
.../cni_operator/libcni/invoke/libcni_exec.c | 2 +-
|
||
|
|
.../network/cni_operator/libcni/libcni_api.c | 9 +-
|
||
|
|
.../network/cni_operator/libcni/libcni_api.h | 2 +-
|
||
|
|
.../cni_operator/libcni/libcni_cached.c | 2 +-
|
||
|
|
.../cni_operator/libcni/libcni_result_type.c | 2 +-
|
||
|
|
.../modules/runtime/isula/isula_rt_ops.c | 2 +-
|
||
|
|
.../modules/runtime/shim/shim_rt_monitor.cc | 2 +-
|
||
|
|
src/daemon/modules/runtime/shim/shim_rt_ops.c | 2 +-
|
||
|
|
.../modules/service/service_container.c | 3 +-
|
||
|
|
.../modules/service/vsock_io_handler.cc | 7 +-
|
||
|
|
src/daemon/modules/service/vsock_io_handler.h | 6 +-
|
||
|
|
.../sandboxer/client/grpc_async_wait_call.cc | 11 +-
|
||
|
|
.../sandboxer/client/grpc_async_wait_call.h | 18 +-
|
||
|
|
.../sandboxer/client/grpc_sandboxer_client.cc | 56 +-
|
||
|
|
.../sandboxer/client/grpc_sandboxer_client.h | 6 +-
|
||
|
|
.../client/grpc_sandboxer_monitor.cc | 10 +-
|
||
|
|
.../sandboxer/client/grpc_sandboxer_monitor.h | 2 +-
|
||
|
|
.../controller/shim/shim_controller.cc | 7 +-
|
||
|
|
src/daemon/sandbox/sandbox.cc | 3 +-
|
||
|
|
src/daemon/sandbox/sandbox_manager.cc | 3 +-
|
||
|
|
src/daemon/sandbox/sandbox_manager.h | 3 +-
|
||
|
|
src/daemon/sandbox/sandbox_ops.cc | 2 +-
|
||
|
|
src/daemon/sandbox/sandbox_ops.h | 3 +-
|
||
|
|
src/utils/cpputils/url.cc | 5 +-
|
||
|
|
src/utils/cutils/error.h | 2 +-
|
||
|
|
src/utils/cutils/map/map.h | 8 -
|
||
|
|
src/utils/tar/isulad_tar.c | 9 +-
|
||
|
|
src/utils/tar/isulad_tar.h | 3 +-
|
||
|
|
test/cutils/utils_file/utils_file_ut.cc | 2 +-
|
||
|
|
test/mocks/callback_mock.cc | 8 +-
|
||
|
|
test/mocks/controller_stub_mock.cc | 516 +++++++++++-------
|
||
|
|
test/mocks/controller_stub_mock.h | 259 +++++++--
|
||
|
|
test/mocks/grpc_async_wait_call_mock.cc | 3 +-
|
||
|
|
test/mocks/grpc_async_wait_call_mock.h | 2 +-
|
||
|
|
test/mocks/grpc_sandboxer_client_mock.cc | 15 +-
|
||
|
|
test/mocks/grpc_sandboxer_client_mock.h | 12 +-
|
||
|
|
test/mocks/grpc_sandboxer_monitor_mock.cc | 2 +-
|
||
|
|
test/mocks/isulad_config_mock.h | 2 +-
|
||
|
|
test/mocks/sandbox_mock.cc | 2 +-
|
||
|
|
test/mocks/sandbox_mock.h | 2 +-
|
||
|
|
test/mocks/service_container_api_mock.h | 2 +-
|
||
|
|
test/mocks/shim_controller_mock.cc | 6 +-
|
||
|
|
test/mocks/shim_controller_mock.h | 8 +-
|
||
|
|
test/network/cni_operate/cni_operate_ut.cc | 40 +-
|
||
|
|
test/network/network_mock.cc | 2 +-
|
||
|
|
test/sandbox/controller/controller_common.cc | 16 +-
|
||
|
|
test/sandbox/controller/controller_common.h | 3 +-
|
||
|
|
.../manager/controller_manager_ut.cc | 27 +-
|
||
|
|
.../async_wait_call/async_wait_call_ut.cc | 9 +-
|
||
|
|
.../async_wait_call/dummy_monitor_utils.h | 44 +-
|
||
|
|
.../sandboxer_client/sandboxer_client_ut.cc | 135 +++--
|
||
|
|
.../sandboxer_controller_ut.cc | 18 +-
|
||
|
|
.../controller/shim/shim_controller_ut.cc | 6 +-
|
||
|
|
74 files changed, 963 insertions(+), 575 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/daemon/common/cri/v1/v1_cri_helpers.cc b/src/daemon/common/cri/v1/v1_cri_helpers.cc
|
||
|
|
index 4f2660e8..be06eb0a 100644
|
||
|
|
--- a/src/daemon/common/cri/v1/v1_cri_helpers.cc
|
||
|
|
+++ b/src/daemon/common/cri/v1/v1_cri_helpers.cc
|
||
|
|
@@ -391,7 +391,7 @@ auto GetSecurityOpts(const commonSecurityContext &context, const char &separator
|
||
|
|
}
|
||
|
|
|
||
|
|
std::vector<std::string> selinuxOpts = CRIHelpersV1::GetSELinuxLabelOpts(context.hasSELinuxOption,
|
||
|
|
- context.selinuxOption, separator, error);
|
||
|
|
+ context.selinuxOption, separator, error);
|
||
|
|
if (error.NotEmpty()) {
|
||
|
|
error.Errorf("Failed to generate SELinuxLabel options for container %s", error.GetMessage().c_str());
|
||
|
|
return securityOpts;
|
||
|
|
@@ -459,7 +459,8 @@ void AddSecurityOptsToHostConfig(std::vector<std::string> &securityOpts, host_co
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
-void GetContainerSandboxID(const std::string &containerID, std::string &realContainerID, std::string &sandboxID, Errors &error)
|
||
|
|
+void GetContainerSandboxID(const std::string &containerID, std::string &realContainerID, std::string &sandboxID,
|
||
|
|
+ Errors &error)
|
||
|
|
{
|
||
|
|
std::string PodID;
|
||
|
|
container_inspect *info = CRIHelpers::InspectContainer(containerID, error, false);
|
||
|
|
@@ -526,7 +527,8 @@ out:
|
||
|
|
return sandboxer;
|
||
|
|
}
|
||
|
|
|
||
|
|
-void ApplySandboxSecurityContextToHostConfig(const runtime::v1::LinuxSandboxSecurityContext &context, host_config *hc, Errors &error)
|
||
|
|
+void ApplySandboxSecurityContextToHostConfig(const runtime::v1::LinuxSandboxSecurityContext &context, host_config *hc,
|
||
|
|
+ Errors &error)
|
||
|
|
{
|
||
|
|
if (hc == nullptr) {
|
||
|
|
ERROR("Invalid input arguments: empty hostconfig");
|
||
|
|
diff --git a/src/daemon/common/cri/v1/v1_cri_helpers.h b/src/daemon/common/cri/v1/v1_cri_helpers.h
|
||
|
|
index 0fa1ae91..7085f8d2 100644
|
||
|
|
--- a/src/daemon/common/cri/v1/v1_cri_helpers.h
|
||
|
|
+++ b/src/daemon/common/cri/v1/v1_cri_helpers.h
|
||
|
|
@@ -73,11 +73,13 @@ auto GetPodSELinuxLabelOpts(const std::string &selinuxLabel, Errors &error)
|
||
|
|
|
||
|
|
void AddSecurityOptsToHostConfig(std::vector<std::string> &securityOpts, host_config *hostconfig, Errors &error);
|
||
|
|
|
||
|
|
-void GetContainerSandboxID(const std::string &containerID, std::string &realContainerID, std::string &sandboxID, Errors &error);
|
||
|
|
+void GetContainerSandboxID(const std::string &containerID, std::string &realContainerID, std::string &sandboxID,
|
||
|
|
+ Errors &error);
|
||
|
|
|
||
|
|
std::string CRISandboxerConvert(const std::string &runtime);
|
||
|
|
|
||
|
|
-void ApplySandboxSecurityContextToHostConfig(const runtime::v1::LinuxSandboxSecurityContext &context, host_config *hc, Errors &error);
|
||
|
|
+void ApplySandboxSecurityContextToHostConfig(const runtime::v1::LinuxSandboxSecurityContext &context, host_config *hc,
|
||
|
|
+ Errors &error);
|
||
|
|
|
||
|
|
}; // namespace CRIHelpers
|
||
|
|
|
||
|
|
diff --git a/src/daemon/common/cri/v1/v1_cri_security_context.cc b/src/daemon/common/cri/v1/v1_cri_security_context.cc
|
||
|
|
index 930710e0..7cdbf5fc 100644
|
||
|
|
--- a/src/daemon/common/cri/v1/v1_cri_security_context.cc
|
||
|
|
+++ b/src/daemon/common/cri/v1/v1_cri_security_context.cc
|
||
|
|
@@ -19,7 +19,8 @@
|
||
|
|
#include <memory>
|
||
|
|
|
||
|
|
namespace CRISecurityV1 {
|
||
|
|
-static void ModifyContainerConfig(const runtime::v1::LinuxContainerSecurityContext &sc, container_config *config, Errors &error)
|
||
|
|
+static void ModifyContainerConfig(const runtime::v1::LinuxContainerSecurityContext &sc, container_config *config,
|
||
|
|
+ Errors &error)
|
||
|
|
{
|
||
|
|
// none -> ""; username -> username; username, uid -> username; username, uid, gid -> username:gid;
|
||
|
|
// username, gid -> username:gid; uid -> uid; uid, gid -> uid:gid; gid -> error
|
||
|
|
@@ -157,7 +158,8 @@ static void ApplyMaskedPathsToHostConfig(const runtime::v1::LinuxContainerSecuri
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
-static void ApplyReadonlyPathsToHostConfig(const runtime::v1::LinuxContainerSecurityContext &sc, host_config *hostConfig,
|
||
|
|
+static void ApplyReadonlyPathsToHostConfig(const runtime::v1::LinuxContainerSecurityContext &sc,
|
||
|
|
+ host_config *hostConfig,
|
||
|
|
Errors &error)
|
||
|
|
{
|
||
|
|
if (sc.readonly_paths_size() <= 0) {
|
||
|
|
diff --git a/src/daemon/entry/connect/grpc/cri/cri_service.cc b/src/daemon/entry/connect/grpc/cri/cri_service.cc
|
||
|
|
index e33a6d34..c1986c44 100644
|
||
|
|
--- a/src/daemon/entry/connect/grpc/cri/cri_service.cc
|
||
|
|
+++ b/src/daemon/entry/connect/grpc/cri/cri_service.cc
|
||
|
|
@@ -50,7 +50,7 @@ int CRIService::Init(const isulad_daemon_configs *config)
|
||
|
|
}
|
||
|
|
|
||
|
|
Errors err;
|
||
|
|
- /* note: get config from args, now use defaults */
|
||
|
|
+ /* note: get config from args, now use defaults */
|
||
|
|
Network::NetworkPluginConf mConf;
|
||
|
|
|
||
|
|
if (config != nullptr) {
|
||
|
|
diff --git a/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_image_service.cc b/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_image_service.cc
|
||
|
|
index ac62b6eb..09c8958d 100644
|
||
|
|
--- a/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_image_service.cc
|
||
|
|
+++ b/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_image_service.cc
|
||
|
|
@@ -28,8 +28,8 @@ RuntimeV1ImageServiceImpl::RuntimeV1ImageServiceImpl()
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1ImageServiceImpl::PullImage(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::PullImageRequest *request,
|
||
|
|
- runtime::v1::PullImageResponse *reply)
|
||
|
|
+ const runtime::v1::PullImageRequest *request,
|
||
|
|
+ runtime::v1::PullImageResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -53,8 +53,8 @@ grpc::Status RuntimeV1ImageServiceImpl::PullImage(grpc::ServerContext *context,
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1ImageServiceImpl::ListImages(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ListImagesRequest *request,
|
||
|
|
- runtime::v1::ListImagesResponse *reply)
|
||
|
|
+ const runtime::v1::ListImagesRequest *request,
|
||
|
|
+ runtime::v1::ListImagesResponse *reply)
|
||
|
|
{
|
||
|
|
std::vector<std::unique_ptr<runtime::v1::Image>> images;
|
||
|
|
Errors error;
|
||
|
|
@@ -86,8 +86,8 @@ grpc::Status RuntimeV1ImageServiceImpl::ListImages(grpc::ServerContext *context,
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1ImageServiceImpl::ImageStatus(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ImageStatusRequest *request,
|
||
|
|
- runtime::v1::ImageStatusResponse *reply)
|
||
|
|
+ const runtime::v1::ImageStatusRequest *request,
|
||
|
|
+ runtime::v1::ImageStatusResponse *reply)
|
||
|
|
{
|
||
|
|
std::unique_ptr<runtime::v1::Image> image_info = nullptr;
|
||
|
|
Errors error;
|
||
|
|
@@ -117,8 +117,8 @@ grpc::Status RuntimeV1ImageServiceImpl::ImageStatus(grpc::ServerContext *context
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1ImageServiceImpl::ImageFsInfo(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ImageFsInfoRequest *request,
|
||
|
|
- runtime::v1::ImageFsInfoResponse *reply)
|
||
|
|
+ const runtime::v1::ImageFsInfoRequest *request,
|
||
|
|
+ runtime::v1::ImageFsInfoResponse *reply)
|
||
|
|
{
|
||
|
|
std::vector<std::unique_ptr<runtime::v1::FilesystemUsage>> usages;
|
||
|
|
Errors error;
|
||
|
|
@@ -150,8 +150,8 @@ grpc::Status RuntimeV1ImageServiceImpl::ImageFsInfo(grpc::ServerContext *context
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1ImageServiceImpl::RemoveImage(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::RemoveImageRequest *request,
|
||
|
|
- runtime::v1::RemoveImageResponse *reply)
|
||
|
|
+ const runtime::v1::RemoveImageRequest *request,
|
||
|
|
+ runtime::v1::RemoveImageResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
diff --git a/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_runtime_service.cc b/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_runtime_service.cc
|
||
|
|
index 1db79307..ba9459f6 100644
|
||
|
|
--- a/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_runtime_service.cc
|
||
|
|
+++ b/src/daemon/entry/connect/grpc/cri/v1/cri_v1_runtime_runtime_service.cc
|
||
|
|
@@ -25,7 +25,8 @@
|
||
|
|
|
||
|
|
using namespace CRIV1;
|
||
|
|
|
||
|
|
-void RuntimeV1RuntimeServiceImpl::Init(std::string &podSandboxImage, std::shared_ptr<Network::PluginManager> networkPlugin, Errors &err)
|
||
|
|
+void RuntimeV1RuntimeServiceImpl::Init(std::string &podSandboxImage,
|
||
|
|
+ std::shared_ptr<Network::PluginManager> networkPlugin, Errors &err)
|
||
|
|
{
|
||
|
|
// Assembly implementation for CRIRuntimeServiceImpl
|
||
|
|
service_executor_t *cb = get_service_executor();
|
||
|
|
@@ -47,8 +48,8 @@ void RuntimeV1RuntimeServiceImpl::Shutdown()
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::Version(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::VersionRequest *request,
|
||
|
|
- runtime::v1::VersionResponse *reply)
|
||
|
|
+ const runtime::v1::VersionRequest *request,
|
||
|
|
+ runtime::v1::VersionResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
if (request == nullptr || reply == nullptr) {
|
||
|
|
@@ -65,8 +66,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::Version(grpc::ServerContext *context,
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::CreateContainer(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::CreateContainerRequest *request,
|
||
|
|
- runtime::v1::CreateContainerResponse *reply)
|
||
|
|
+ const runtime::v1::CreateContainerRequest *request,
|
||
|
|
+ runtime::v1::CreateContainerResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -91,8 +92,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::CreateContainer(grpc::ServerContext *c
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::StartContainer(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::StartContainerRequest *request,
|
||
|
|
- runtime::v1::StartContainerResponse *reply)
|
||
|
|
+ const runtime::v1::StartContainerRequest *request,
|
||
|
|
+ runtime::v1::StartContainerResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -115,8 +116,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::StartContainer(grpc::ServerContext *co
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::StopContainer(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::StopContainerRequest *request,
|
||
|
|
- runtime::v1::StopContainerResponse *reply)
|
||
|
|
+ const runtime::v1::StopContainerRequest *request,
|
||
|
|
+ runtime::v1::StopContainerResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -139,8 +140,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::StopContainer(grpc::ServerContext *con
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::RemoveContainer(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::RemoveContainerRequest *request,
|
||
|
|
- runtime::v1::RemoveContainerResponse *reply)
|
||
|
|
+ const runtime::v1::RemoveContainerRequest *request,
|
||
|
|
+ runtime::v1::RemoveContainerResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -163,8 +164,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::RemoveContainer(grpc::ServerContext *c
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::ListContainers(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ListContainersRequest *request,
|
||
|
|
- runtime::v1::ListContainersResponse *reply)
|
||
|
|
+ const runtime::v1::ListContainersRequest *request,
|
||
|
|
+ runtime::v1::ListContainersResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -197,8 +198,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::ListContainers(grpc::ServerContext *co
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::ContainerStats(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ContainerStatsRequest *request,
|
||
|
|
- runtime::v1::ContainerStatsResponse *reply)
|
||
|
|
+ const runtime::v1::ContainerStatsRequest *request,
|
||
|
|
+ runtime::v1::ContainerStatsResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -223,8 +224,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::ContainerStats(grpc::ServerContext *co
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::ListContainerStats(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ListContainerStatsRequest *request,
|
||
|
|
- runtime::v1::ListContainerStatsResponse *reply)
|
||
|
|
+ const runtime::v1::ListContainerStatsRequest *request,
|
||
|
|
+ runtime::v1::ListContainerStatsResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -257,8 +258,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::ListContainerStats(grpc::ServerContext
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::ContainerStatus(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ContainerStatusRequest *request,
|
||
|
|
- runtime::v1::ContainerStatusResponse *reply)
|
||
|
|
+ const runtime::v1::ContainerStatusRequest *request,
|
||
|
|
+ runtime::v1::ContainerStatusResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -283,8 +284,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::ContainerStatus(grpc::ServerContext *c
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::ExecSync(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ExecSyncRequest *request,
|
||
|
|
- runtime::v1::ExecSyncResponse *reply)
|
||
|
|
+ const runtime::v1::ExecSyncRequest *request,
|
||
|
|
+ runtime::v1::ExecSyncResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -307,8 +308,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::ExecSync(grpc::ServerContext *context,
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::RunPodSandbox(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::RunPodSandboxRequest *request,
|
||
|
|
- runtime::v1::RunPodSandboxResponse *reply)
|
||
|
|
+ const runtime::v1::RunPodSandboxRequest *request,
|
||
|
|
+ runtime::v1::RunPodSandboxResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -335,8 +336,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::RunPodSandbox(grpc::ServerContext *con
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::StopPodSandbox(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::StopPodSandboxRequest *request,
|
||
|
|
- runtime::v1::StopPodSandboxResponse *reply)
|
||
|
|
+ const runtime::v1::StopPodSandboxRequest *request,
|
||
|
|
+ runtime::v1::StopPodSandboxResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -360,8 +361,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::StopPodSandbox(grpc::ServerContext *co
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::RemovePodSandbox(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::RemovePodSandboxRequest *request,
|
||
|
|
- runtime::v1::RemovePodSandboxResponse *reply)
|
||
|
|
+ const runtime::v1::RemovePodSandboxRequest *request,
|
||
|
|
+ runtime::v1::RemovePodSandboxResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -385,8 +386,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::RemovePodSandbox(grpc::ServerContext *
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::PodSandboxStatus(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::PodSandboxStatusRequest *request,
|
||
|
|
- runtime::v1::PodSandboxStatusResponse *reply)
|
||
|
|
+ const runtime::v1::PodSandboxStatusRequest *request,
|
||
|
|
+ runtime::v1::PodSandboxStatusResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -412,8 +413,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::PodSandboxStatus(grpc::ServerContext *
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::ListPodSandbox(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ListPodSandboxRequest *request,
|
||
|
|
- runtime::v1::ListPodSandboxResponse *reply)
|
||
|
|
+ const runtime::v1::ListPodSandboxRequest *request,
|
||
|
|
+ runtime::v1::ListPodSandboxResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -446,8 +447,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::ListPodSandbox(grpc::ServerContext *co
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::PodSandboxStats(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::PodSandboxStatsRequest *request,
|
||
|
|
- runtime::v1::PodSandboxStatsResponse *reply)
|
||
|
|
+ const runtime::v1::PodSandboxStatsRequest *request,
|
||
|
|
+ runtime::v1::PodSandboxStatsResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -474,8 +475,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::PodSandboxStats(grpc::ServerContext *c
|
||
|
|
|
||
|
|
grpc::Status
|
||
|
|
RuntimeV1RuntimeServiceImpl::ListPodSandboxStats(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ListPodSandboxStatsRequest *request,
|
||
|
|
- runtime::v1::ListPodSandboxStatsResponse *reply)
|
||
|
|
+ const runtime::v1::ListPodSandboxStatsRequest *request,
|
||
|
|
+ runtime::v1::ListPodSandboxStatsResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -508,8 +509,8 @@ RuntimeV1RuntimeServiceImpl::ListPodSandboxStats(grpc::ServerContext *context,
|
||
|
|
|
||
|
|
grpc::Status
|
||
|
|
RuntimeV1RuntimeServiceImpl::UpdateContainerResources(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::UpdateContainerResourcesRequest *request,
|
||
|
|
- runtime::v1::UpdateContainerResourcesResponse *reply)
|
||
|
|
+ const runtime::v1::UpdateContainerResourcesRequest *request,
|
||
|
|
+ runtime::v1::UpdateContainerResourcesResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -533,8 +534,8 @@ RuntimeV1RuntimeServiceImpl::UpdateContainerResources(grpc::ServerContext *conte
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::Exec(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::ExecRequest *request,
|
||
|
|
- runtime::v1::ExecResponse *response)
|
||
|
|
+ const runtime::v1::ExecRequest *request,
|
||
|
|
+ runtime::v1::ExecResponse *response)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -558,8 +559,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::Exec(grpc::ServerContext *context,
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::Attach(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::AttachRequest *request,
|
||
|
|
- runtime::v1::AttachResponse *response)
|
||
|
|
+ const runtime::v1::AttachRequest *request,
|
||
|
|
+ runtime::v1::AttachResponse *response)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -584,8 +585,8 @@ grpc::Status RuntimeV1RuntimeServiceImpl::Attach(grpc::ServerContext *context,
|
||
|
|
|
||
|
|
grpc::Status
|
||
|
|
RuntimeV1RuntimeServiceImpl::UpdateRuntimeConfig(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::UpdateRuntimeConfigRequest *request,
|
||
|
|
- runtime::v1::UpdateRuntimeConfigResponse *reply)
|
||
|
|
+ const runtime::v1::UpdateRuntimeConfigRequest *request,
|
||
|
|
+ runtime::v1::UpdateRuntimeConfigResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
@@ -608,8 +609,8 @@ RuntimeV1RuntimeServiceImpl::UpdateRuntimeConfig(grpc::ServerContext *context,
|
||
|
|
}
|
||
|
|
|
||
|
|
grpc::Status RuntimeV1RuntimeServiceImpl::Status(grpc::ServerContext *context,
|
||
|
|
- const runtime::v1::StatusRequest *request,
|
||
|
|
- runtime::v1::StatusResponse *reply)
|
||
|
|
+ const runtime::v1::StatusRequest *request,
|
||
|
|
+ runtime::v1::StatusResponse *reply)
|
||
|
|
{
|
||
|
|
Errors error;
|
||
|
|
|
||
|
|
diff --git a/src/daemon/entry/connect/grpc/cri/v1alpha/cri_runtime_runtime_service.cc b/src/daemon/entry/connect/grpc/cri/v1alpha/cri_runtime_runtime_service.cc
|
||
|
|
index a56b167c..5e85702c 100644
|
||
|
|
--- a/src/daemon/entry/connect/grpc/cri/v1alpha/cri_runtime_runtime_service.cc
|
||
|
|
+++ b/src/daemon/entry/connect/grpc/cri/v1alpha/cri_runtime_runtime_service.cc
|
||
|
|
@@ -23,7 +23,8 @@
|
||
|
|
|
||
|
|
using namespace CRI;
|
||
|
|
|
||
|
|
-void RuntimeRuntimeServiceImpl::Init(std::string &podSandboxImage, std::shared_ptr<Network::PluginManager> networkPlugin, Errors &err)
|
||
|
|
+void RuntimeRuntimeServiceImpl::Init(std::string &podSandboxImage,
|
||
|
|
+ std::shared_ptr<Network::PluginManager> networkPlugin, Errors &err)
|
||
|
|
{
|
||
|
|
// Assembly implementation for CRIRuntimeServiceImpl
|
||
|
|
service_executor_t *cb = get_service_executor();
|
||
|
|
diff --git a/src/daemon/entry/connect/grpc/grpc_service.cc b/src/daemon/entry/connect/grpc/grpc_service.cc
|
||
|
|
index 4e1ae019..61e284f3 100644
|
||
|
|
--- a/src/daemon/entry/connect/grpc/grpc_service.cc
|
||
|
|
+++ b/src/daemon/entry/connect/grpc/grpc_service.cc
|
||
|
|
@@ -109,7 +109,7 @@ public:
|
||
|
|
void Shutdown(void)
|
||
|
|
{
|
||
|
|
m_server->Shutdown();
|
||
|
|
-
|
||
|
|
+
|
||
|
|
// call CRI to shutdown stream server
|
||
|
|
m_criService.Shutdown();
|
||
|
|
|
||
|
|
diff --git a/src/daemon/entry/cri/network_plugin.cc b/src/daemon/entry/cri/network_plugin.cc
|
||
|
|
index f919a059..f8f9c7e6 100644
|
||
|
|
--- a/src/daemon/entry/cri/network_plugin.cc
|
||
|
|
+++ b/src/daemon/entry/cri/network_plugin.cc
|
||
|
|
@@ -558,14 +558,14 @@ void NoopNetworkPlugin::SetUpPod(const std::string &ns, const std::string &name,
|
||
|
|
}
|
||
|
|
|
||
|
|
container_network_settings *network_settings = static_cast<container_network_settings *>
|
||
|
|
- (util_common_calloc_s(sizeof(container_network_settings)));
|
||
|
|
+ (util_common_calloc_s(sizeof(container_network_settings)));
|
||
|
|
if (network_settings == nullptr) {
|
||
|
|
ERROR("Out of memory");
|
||
|
|
error.SetError("Out of memory");
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
auto settingsWarpper = std::unique_ptr<CStructWrapper<container_network_settings>>(new
|
||
|
|
- CStructWrapper<container_network_settings>(network_settings, free_container_network_settings));
|
||
|
|
+ CStructWrapper<container_network_settings>(network_settings, free_container_network_settings));
|
||
|
|
|
||
|
|
network_settings->sandbox_key = util_strdup_s(netnsPath.c_str());
|
||
|
|
|
||
|
|
diff --git a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||
|
|
index f635df2b..067f4210 100644
|
||
|
|
--- a/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||
|
|
+++ b/src/daemon/entry/cri/v1/v1_cri_container_manager_service.cc
|
||
|
|
@@ -149,7 +149,7 @@ void ContainerManagerService::DoUsePodLevelSELinuxConfig(const runtime::v1::Cont
|
||
|
|
auto ContainerManagerService::IsSELinuxLabelEmpty(const ::runtime::v1::SELinuxOption &selinuxOption) -> bool
|
||
|
|
{
|
||
|
|
return selinuxOption.user().length() == 0 && selinuxOption.role().length() == 0 &&
|
||
|
|
- selinuxOption.type().length() == 0 && selinuxOption.level().length() == 0;
|
||
|
|
+ selinuxOption.type().length() == 0 && selinuxOption.level().length() == 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
auto ContainerManagerService::GenerateCreateContainerHostConfig(
|
||
|
|
@@ -194,7 +194,7 @@ auto ContainerManagerService::GenerateCreateContainerHostConfig(
|
||
|
|
DoUsePodLevelSELinuxConfig(containerConfig, hostconfig, sandbox, error);
|
||
|
|
if (error.NotEmpty()) {
|
||
|
|
ERROR("Failed to add pod: %s security context to host config for container: %s",
|
||
|
|
- sandbox.GetName().c_str(), containerConfig.metadata().name().c_str());
|
||
|
|
+ sandbox.GetName().c_str(), containerConfig.metadata().name().c_str());
|
||
|
|
goto cleanup;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
@@ -539,8 +539,10 @@ void ContainerManagerService::CreateContainerLogSymlink(const std::string &conta
|
||
|
|
WARN("Deleted previously existing symlink file: %s", path);
|
||
|
|
}
|
||
|
|
if (symlink(realPath, path) != 0) {
|
||
|
|
- SYSERROR("failed to create symbolic link %s to the container log file %s for container %s", path, realPath, containerID.c_str());
|
||
|
|
- error.Errorf("failed to create symbolic link %s to the container log file %s for container %s", path, realPath, containerID.c_str());
|
||
|
|
+ SYSERROR("failed to create symbolic link %s to the container log file %s for container %s", path, realPath,
|
||
|
|
+ containerID.c_str());
|
||
|
|
+ error.Errorf("failed to create symbolic link %s to the container log file %s for container %s", path, realPath,
|
||
|
|
+ containerID.c_str());
|
||
|
|
goto cleanup;
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
diff --git a/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc b/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc
|
||
|
|
index 066eed5e..71918706 100644
|
||
|
|
--- a/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc
|
||
|
|
+++ b/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.cc
|
||
|
|
@@ -202,7 +202,7 @@ auto ImageManagerServiceImpl::status_request_from_grpc(const runtime::v1::ImageS
|
||
|
|
}
|
||
|
|
|
||
|
|
std::unique_ptr<runtime::v1::Image> ImageManagerServiceImpl::status_image_to_grpc(im_summary_response *response,
|
||
|
|
- Errors & /*error*/)
|
||
|
|
+ Errors & /*error*/)
|
||
|
|
{
|
||
|
|
imagetool_image_summary *image_info = response->image_summary;
|
||
|
|
if (image_info == nullptr) {
|
||
|
|
@@ -220,8 +220,8 @@ std::unique_ptr<runtime::v1::Image> ImageManagerServiceImpl::status_image_to_grp
|
||
|
|
}
|
||
|
|
|
||
|
|
std::unique_ptr<runtime::v1::Image> ImageManagerServiceImpl::ImageStatus(const runtime::v1::ImageSpec
|
||
|
|
- &image,
|
||
|
|
- Errors &error)
|
||
|
|
+ &image,
|
||
|
|
+ Errors &error)
|
||
|
|
{
|
||
|
|
im_summary_request *request { nullptr };
|
||
|
|
im_summary_response *response { nullptr };
|
||
|
|
diff --git a/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.h b/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.h
|
||
|
|
index 3f13a157..1c276e06 100644
|
||
|
|
--- a/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.h
|
||
|
|
+++ b/src/daemon/entry/cri/v1/v1_cri_image_manager_service_impl.h
|
||
|
|
@@ -33,7 +33,7 @@ public:
|
||
|
|
std::vector<std::unique_ptr<runtime::v1::Image>> &images, Errors &error) override;
|
||
|
|
|
||
|
|
std::unique_ptr<runtime::v1::Image> ImageStatus(const runtime::v1::ImageSpec &image,
|
||
|
|
- Errors &error) override;
|
||
|
|
+ Errors &error) override;
|
||
|
|
|
||
|
|
std::string PullImage(const runtime::v1::ImageSpec &image, const runtime::v1::AuthConfig &auth,
|
||
|
|
Errors &error) override;
|
||
|
|
diff --git a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
|
||
|
|
index 2c802900..0f6b8508 100644
|
||
|
|
--- a/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
|
||
|
|
+++ b/src/daemon/entry/cri/v1/v1_cri_pod_sandbox_manager_service.cc
|
||
|
|
@@ -196,7 +196,8 @@ void PodSandboxManagerService::UpdateSandboxConfig(runtime::v1::PodSandboxConfig
|
||
|
|
// TODO: Update SecurityContext with default values
|
||
|
|
}
|
||
|
|
|
||
|
|
-void PodSandboxManagerService::SetupSandboxFiles(const std::string &resolvPath, const runtime::v1::PodSandboxConfig &config, Errors &error)
|
||
|
|
+void PodSandboxManagerService::SetupSandboxFiles(const std::string &resolvPath,
|
||
|
|
+ const runtime::v1::PodSandboxConfig &config, Errors &error)
|
||
|
|
{
|
||
|
|
if (resolvPath.empty()) {
|
||
|
|
return;
|
||
|
|
@@ -423,7 +424,8 @@ void PodSandboxManagerService::ClearCniNetwork(const std::shared_ptr<sandbox::Sa
|
||
|
|
stdAnnos.insert(std::pair<std::string, std::string>(CRIHelpers::Constants::POD_SANDBOX_KEY, sandboxKey));
|
||
|
|
|
||
|
|
Errors pluginErr;
|
||
|
|
- m_pluginManager->TearDownPod(config.metadata().namespace_(), config.metadata().name(), Network::DEFAULT_NETWORK_INTERFACE_NAME,
|
||
|
|
+ m_pluginManager->TearDownPod(config.metadata().namespace_(), config.metadata().name(),
|
||
|
|
+ Network::DEFAULT_NETWORK_INTERFACE_NAME,
|
||
|
|
sandbox->GetId(), stdAnnos, pluginErr);
|
||
|
|
if (pluginErr.NotEmpty()) {
|
||
|
|
WARN("TearDownPod cni network failed: %s", pluginErr.GetCMessage());
|
||
|
|
@@ -492,7 +494,8 @@ auto PodSandboxManagerService::GetContainerListResponse(const std::string &readS
|
||
|
|
}
|
||
|
|
|
||
|
|
ret = m_cb->container.list(list_request, &list_response);
|
||
|
|
- auto list_response_wrapper = makeUniquePtrCStructWrapper<container_list_response>(list_response, free_container_list_response);
|
||
|
|
+ auto list_response_wrapper = makeUniquePtrCStructWrapper<container_list_response>(list_response,
|
||
|
|
+ free_container_list_response);
|
||
|
|
if (list_response_wrapper == nullptr) {
|
||
|
|
ERROR("Failed to call list container callback");
|
||
|
|
errors.push_back("Failed to call list container callback");
|
||
|
|
@@ -510,7 +513,7 @@ auto PodSandboxManagerService::GetContainerListResponse(const std::string &readS
|
||
|
|
}
|
||
|
|
|
||
|
|
return list_response_wrapper;
|
||
|
|
-}
|
||
|
|
+}
|
||
|
|
|
||
|
|
auto PodSandboxManagerService::StopAllContainersInSandbox(const std::string &readSandboxID,
|
||
|
|
Errors &error) -> int
|
||
|
|
@@ -751,8 +754,8 @@ void PodSandboxManagerService::GetIPs(std::shared_ptr<sandbox::Sandbox> sandbox,
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
- auto settings = std::unique_ptr<CStructWrapper<container_network_settings>>(new
|
||
|
|
- CStructWrapper<container_network_settings>(network_settings, free_container_network_settings));
|
||
|
|
+ auto settings = std::unique_ptr<CStructWrapper<container_network_settings>>(new
|
||
|
|
+ CStructWrapper<container_network_settings>(network_settings, free_container_network_settings));
|
||
|
|
if (settings == nullptr) {
|
||
|
|
ERROR("Out of memory");
|
||
|
|
return;
|
||
|
|
diff --git a/src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc b/src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc
|
||
|
|
index 9da25768..b0abdb52 100644
|
||
|
|
--- a/src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc
|
||
|
|
+++ b/src/daemon/entry/cri/v1alpha/cri_container_manager_service.cc
|
||
|
|
@@ -547,7 +547,8 @@ void ContainerManagerService::CreateContainerLogSymlink(const std::string &conta
|
||
|
|
WARN("Deleted previously existing symlink file: %s", path);
|
||
|
|
}
|
||
|
|
if (symlink(realPath, path) != 0) {
|
||
|
|
- SYSERROR("failed to create symbolic link %s to the container log file %s for container %s", path, realPath, containerID.c_str());
|
||
|
|
+ SYSERROR("failed to create symbolic link %s to the container log file %s for container %s", path, realPath,
|
||
|
|
+ containerID.c_str());
|
||
|
|
error.Errorf("failed to create symbolic link %s to the container log file %s for container %s: %s", path,
|
||
|
|
realPath, containerID.c_str());
|
||
|
|
goto cleanup;
|
||
|
|
diff --git a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
|
||
|
|
index 8eff22ac..bc40cb06 100644
|
||
|
|
--- a/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
|
||
|
|
+++ b/src/daemon/entry/cri/v1alpha/cri_pod_sandbox_manager_service.cc
|
||
|
|
@@ -569,7 +569,7 @@ void PodSandboxManagerService::UpdatePodSandboxNetworkSettings(const std::string
|
||
|
|
}
|
||
|
|
|
||
|
|
auto req = (container_update_network_settings_request *)util_common_calloc_s(
|
||
|
|
- sizeof(container_update_network_settings_request));
|
||
|
|
+ sizeof(container_update_network_settings_request));
|
||
|
|
if (req == nullptr) {
|
||
|
|
error.Errorf("container update network settings request: Out of memory");
|
||
|
|
return;
|
||
|
|
diff --git a/src/daemon/entry/cri/v1alpha/cri_security_context.cc b/src/daemon/entry/cri/v1alpha/cri_security_context.cc
|
||
|
|
index 57ec3a63..2b6c42fe 100644
|
||
|
|
--- a/src/daemon/entry/cri/v1alpha/cri_security_context.cc
|
||
|
|
+++ b/src/daemon/entry/cri/v1alpha/cri_security_context.cc
|
||
|
|
@@ -130,7 +130,8 @@ static void ModifyHostConfigscSupplementalGroups(const runtime::v1alpha2::LinuxC
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
-static void ApplyMaskedPathsToHostConfig(const runtime::v1alpha2::LinuxContainerSecurityContext &sc, host_config *hostConfig,
|
||
|
|
+static void ApplyMaskedPathsToHostConfig(const runtime::v1alpha2::LinuxContainerSecurityContext &sc,
|
||
|
|
+ host_config *hostConfig,
|
||
|
|
Errors &error)
|
||
|
|
{
|
||
|
|
if (sc.masked_paths_size() <= 0) {
|
||
|
|
@@ -159,7 +160,8 @@ static void ApplyMaskedPathsToHostConfig(const runtime::v1alpha2::LinuxContainer
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
-static void ApplyReadonlyPathsToHostConfig(const runtime::v1alpha2::LinuxContainerSecurityContext &sc, host_config *hostConfig,
|
||
|
|
+static void ApplyReadonlyPathsToHostConfig(const runtime::v1alpha2::LinuxContainerSecurityContext &sc,
|
||
|
|
+ host_config *hostConfig,
|
||
|
|
Errors &error)
|
||
|
|
{
|
||
|
|
if (sc.readonly_paths_size() <= 0) {
|
||
|
|
diff --git a/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.cc b/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.cc
|
||
|
|
index e55e46f0..b06092a7 100644
|
||
|
|
--- a/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.cc
|
||
|
|
+++ b/src/daemon/entry/cri/v1alpha/v1alpha_cri_helpers.cc
|
||
|
|
@@ -392,7 +392,7 @@ auto GetSecurityOpts(const commonSecurityContext &context, const char &separator
|
||
|
|
}
|
||
|
|
|
||
|
|
std::vector<std::string> selinuxOpts = CRIHelpersV1Alpha::GetSELinuxLabelOpts(context.hasSELinuxOption,
|
||
|
|
- context.selinuxOption, separator, error);
|
||
|
|
+ context.selinuxOption, separator, error);
|
||
|
|
if (error.NotEmpty()) {
|
||
|
|
error.Errorf("Failed to generate SELinuxLabel options for container %s", error.GetMessage().c_str());
|
||
|
|
return securityOpts;
|
||
|
|
diff --git a/src/daemon/executor/container_cb/execution_create.c b/src/daemon/executor/container_cb/execution_create.c
|
||
|
|
index 4b6f62de..6b6c3b75 100644
|
||
|
|
--- a/src/daemon/executor/container_cb/execution_create.c
|
||
|
|
+++ b/src/daemon/executor/container_cb/execution_create.c
|
||
|
|
@@ -766,8 +766,8 @@ static int maintain_container_id(const container_create_request *request, char *
|
||
|
|
used_id = container_name_index_get(name);
|
||
|
|
ERROR("Name %s is in use by container %s", name, used_id);
|
||
|
|
isulad_set_error_message("Conflict. The name \"%s\" is already in use by container %s. "
|
||
|
|
- "You have to remove (or rename) that container to be able to reuse that name.",
|
||
|
|
- name, used_id);
|
||
|
|
+ "You have to remove (or rename) that container to be able to reuse that name.",
|
||
|
|
+ name, used_id);
|
||
|
|
free(used_id);
|
||
|
|
used_id = NULL;
|
||
|
|
ret = -1;
|
||
|
|
@@ -1342,7 +1342,7 @@ static int v2_spec_fill_sandbox_info(const container_sandbox_info *sandbox_info,
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
- if(dup_container_sandbox_info(sandbox_info, &v2_spec->sandbox_info) != 0) {
|
||
|
|
+ if (dup_container_sandbox_info(sandbox_info, &v2_spec->sandbox_info) != 0) {
|
||
|
|
ERROR("Failed to dup sandbox info");
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
@@ -1431,7 +1431,7 @@ int container_create_cb(const container_create_request *request, container_creat
|
||
|
|
v2_spec_fill_basic_info(id, name, image_name, image_type, container_spec, v2_spec);
|
||
|
|
|
||
|
|
#ifdef ENABLE_CRI_API_V1
|
||
|
|
- if(v2_spec_fill_sandbox_info(request->sandbox, v2_spec) != 0) {
|
||
|
|
+ if (v2_spec_fill_sandbox_info(request->sandbox, v2_spec) != 0) {
|
||
|
|
ERROR("Failed to fill sandbox info");
|
||
|
|
cc = ISULAD_ERR_INPUT;
|
||
|
|
goto clean_container_root_dir;
|
||
|
|
diff --git a/src/daemon/executor/container_cb/execution_information.c b/src/daemon/executor/container_cb/execution_information.c
|
||
|
|
index 95f522c6..420f08df 100644
|
||
|
|
--- a/src/daemon/executor/container_cb/execution_information.c
|
||
|
|
+++ b/src/daemon/executor/container_cb/execution_information.c
|
||
|
|
@@ -250,7 +250,7 @@ static int get_proxy_env(char **proxy, const char *type)
|
||
|
|
*proxy = NULL;
|
||
|
|
goto out;
|
||
|
|
}
|
||
|
|
-
|
||
|
|
+
|
||
|
|
out:
|
||
|
|
util_free_sensitive_string(tmp_proxy);
|
||
|
|
return ret;
|
||
|
|
@@ -634,7 +634,8 @@ out:
|
||
|
|
return pid_arg;
|
||
|
|
}
|
||
|
|
|
||
|
|
-static int get_pids(const char *name, const char *runtime, const char *rootpath, const char *statepath, pid_t **pids, size_t *pids_len,
|
||
|
|
+static int get_pids(const char *name, const char *runtime, const char *rootpath, const char *statepath, pid_t **pids,
|
||
|
|
+ size_t *pids_len,
|
||
|
|
char **pid_args)
|
||
|
|
{
|
||
|
|
int ret = 0;
|
||
|
|
diff --git a/src/daemon/modules/api/container_api.h b/src/daemon/modules/api/container_api.h
|
||
|
|
index 49849c2d..8e3cd7ac 100644
|
||
|
|
--- a/src/daemon/modules/api/container_api.h
|
||
|
|
+++ b/src/daemon/modules/api/container_api.h
|
||
|
|
@@ -284,7 +284,8 @@ bool container_is_in_gc_progress(const char *id);
|
||
|
|
int container_module_init();
|
||
|
|
|
||
|
|
#ifdef ENABLE_CRI_API_V1
|
||
|
|
-static inline bool is_sandbox_container(container_sandbox_info *sandbox) {
|
||
|
|
+static inline bool is_sandbox_container(container_sandbox_info *sandbox)
|
||
|
|
+{
|
||
|
|
return sandbox != NULL && sandbox->is_sandbox_container;
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
diff --git a/src/daemon/modules/container/restore/restore.c b/src/daemon/modules/container/restore/restore.c
|
||
|
|
index a60b1410..fad5b071 100644
|
||
|
|
--- a/src/daemon/modules/container/restore/restore.c
|
||
|
|
+++ b/src/daemon/modules/container/restore/restore.c
|
||
|
|
@@ -291,7 +291,8 @@ static void restore_state(container_t *cont)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (tempret != 0) {
|
||
|
|
- WARN("Failed to restore container %s, make real status to STOPPED. Due to cannot load container with status %d", id, status);
|
||
|
|
+ WARN("Failed to restore container %s, make real status to STOPPED. Due to cannot load container with status %d", id,
|
||
|
|
+ status);
|
||
|
|
real_status.status = RUNTIME_CONTAINER_STATUS_STOPPED;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
diff --git a/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_exec.c b/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_exec.c
|
||
|
|
index 4908565e..74d6d74a 100644
|
||
|
|
--- a/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_exec.c
|
||
|
|
+++ b/src/daemon/modules/network/cni_operator/libcni/invoke/libcni_exec.c
|
||
|
|
@@ -482,7 +482,7 @@ static int do_parse_version_info_stdout_str(int exec_ret, const cni_exec_error *
|
||
|
|
const char *stdout_str, cni_version_info **result_version)
|
||
|
|
{
|
||
|
|
__isula_auto_free char *err_msg = NULL;
|
||
|
|
- struct parser_context ctx = { OPT_GEN_SIMPLIFY, 0 };
|
||
|
|
+ struct parser_context ctx = { OPT_GEN_SIMPLIFY, 0 };
|
||
|
|
__isula_auto_free parser_error perr = NULL;
|
||
|
|
|
||
|
|
if (exec_ret != 0) {
|
||
|
|
diff --git a/src/daemon/modules/network/cni_operator/libcni/libcni_api.c b/src/daemon/modules/network/cni_operator/libcni/libcni_api.c
|
||
|
|
index 7f62df78..068881be 100644
|
||
|
|
--- a/src/daemon/modules/network/cni_operator/libcni/libcni_api.c
|
||
|
|
+++ b/src/daemon/modules/network/cni_operator/libcni/libcni_api.c
|
||
|
|
@@ -209,7 +209,7 @@ static int inject_cni_aliases(const struct runtime_conf *rt, cni_net_conf_runtim
|
||
|
|
}
|
||
|
|
|
||
|
|
for (i = 0; i < rt->aliases_len; i++) {
|
||
|
|
- rt_config->aliases[i]= util_strdup_s(rt->aliases[i]);
|
||
|
|
+ rt_config->aliases[i] = util_strdup_s(rt->aliases[i]);
|
||
|
|
}
|
||
|
|
rt_config->aliases_len = rt->aliases_len;
|
||
|
|
return 0;
|
||
|
|
@@ -472,7 +472,7 @@ static int find_plugin_in_path(const char *plugin, const char * const *paths, si
|
||
|
|
ERROR("Invalid plugin name: %s", plugin);
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
-
|
||
|
|
+
|
||
|
|
for (i = 0; i < len; i++) {
|
||
|
|
if (do_check_file(plugin, paths[i], find_path) == 0) {
|
||
|
|
ret = 0;
|
||
|
|
@@ -689,7 +689,8 @@ int cni_add_network_list(const struct cni_network_list_conf *list, const struct
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
- if (*pret != NULL && version_greater_than_or_equal_to((*pret)->cniversion, SUPPORT_CACHE_AND_CHECK_VERSION, &greater) != 0) {
|
||
|
|
+ if (*pret != NULL &&
|
||
|
|
+ version_greater_than_or_equal_to((*pret)->cniversion, SUPPORT_CACHE_AND_CHECK_VERSION, &greater) != 0) {
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -867,7 +868,7 @@ static int version_network(const char *plugin_name, cni_version_info **result_ve
|
||
|
|
}
|
||
|
|
|
||
|
|
int cni_version_network_list(const struct cni_network_list_conf *list,
|
||
|
|
- struct cni_version_info_list **result_version_list)
|
||
|
|
+ struct cni_version_info_list **result_version_list)
|
||
|
|
{
|
||
|
|
int ret = 0;
|
||
|
|
int i;
|
||
|
|
diff --git a/src/daemon/modules/network/cni_operator/libcni/libcni_api.h b/src/daemon/modules/network/cni_operator/libcni/libcni_api.h
|
||
|
|
index f94ab3f7..2f10d6e9 100644
|
||
|
|
--- a/src/daemon/modules/network/cni_operator/libcni/libcni_api.h
|
||
|
|
+++ b/src/daemon/modules/network/cni_operator/libcni/libcni_api.h
|
||
|
|
@@ -84,7 +84,7 @@ int cni_del_network_list(const struct cni_network_list_conf *list, const struct
|
||
|
|
|
||
|
|
int cni_check_network_list(const struct cni_network_list_conf *list, const struct runtime_conf *rc,
|
||
|
|
struct cni_opt_result **p_result);
|
||
|
|
-
|
||
|
|
+
|
||
|
|
int cni_version_network_list(const struct cni_network_list_conf *list,
|
||
|
|
struct cni_version_info_list **result_version_list);
|
||
|
|
|
||
|
|
diff --git a/src/daemon/modules/network/cni_operator/libcni/libcni_cached.c b/src/daemon/modules/network/cni_operator/libcni/libcni_cached.c
|
||
|
|
index 222511d6..1457c9be 100644
|
||
|
|
--- a/src/daemon/modules/network/cni_operator/libcni/libcni_cached.c
|
||
|
|
+++ b/src/daemon/modules/network/cni_operator/libcni/libcni_cached.c
|
||
|
|
@@ -205,7 +205,7 @@ static int do_cache_insert_aliases(const struct runtime_conf *rc, cni_cached_inf
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
- for (i = 0; i < rc->aliases_len; i++){
|
||
|
|
+ for (i = 0; i < rc->aliases_len; i++) {
|
||
|
|
tmp_aliases[i] = util_strdup_s(rc->aliases[i]);
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/src/daemon/modules/network/cni_operator/libcni/libcni_result_type.c b/src/daemon/modules/network/cni_operator/libcni/libcni_result_type.c
|
||
|
|
index 8a0ce1dd..2365a128 100644
|
||
|
|
--- a/src/daemon/modules/network/cni_operator/libcni/libcni_result_type.c
|
||
|
|
+++ b/src/daemon/modules/network/cni_operator/libcni/libcni_result_type.c
|
||
|
|
@@ -137,7 +137,7 @@ void free_cni_version_info_list(struct cni_version_info_list *val)
|
||
|
|
if (val == NULL) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
-
|
||
|
|
+
|
||
|
|
for (i = 0; i < val->result_versions_len; i++) {
|
||
|
|
free_cni_version_info(val->result_versions[i]);
|
||
|
|
val->result_versions[i] = NULL;
|
||
|
|
diff --git a/src/daemon/modules/runtime/isula/isula_rt_ops.c b/src/daemon/modules/runtime/isula/isula_rt_ops.c
|
||
|
|
index e61d1f91..859356e5 100644
|
||
|
|
--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c
|
||
|
|
+++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c
|
||
|
|
@@ -1495,7 +1495,7 @@ static int get_attach_socketfd(const char *attach_socket, int *socket_fd)
|
||
|
|
|
||
|
|
if (strlen(attach_socket) >= sizeof(addr.sun_path)) {
|
||
|
|
SYSERROR("Invalid attach socket path: %s", attach_socket);
|
||
|
|
- return -1;
|
||
|
|
+ return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
tmp_socket = socket(AF_UNIX, SOCK_STREAM, 0);
|
||
|
|
diff --git a/src/daemon/modules/runtime/shim/shim_rt_monitor.cc b/src/daemon/modules/runtime/shim/shim_rt_monitor.cc
|
||
|
|
index f5178c26..2547a206 100644
|
||
|
|
--- a/src/daemon/modules/runtime/shim/shim_rt_monitor.cc
|
||
|
|
+++ b/src/daemon/modules/runtime/shim/shim_rt_monitor.cc
|
||
|
|
@@ -31,7 +31,7 @@
|
||
|
|
#include "error.h"
|
||
|
|
|
||
|
|
extern "C" {
|
||
|
|
- #include <shim_v2.h>
|
||
|
|
+#include <shim_v2.h>
|
||
|
|
}
|
||
|
|
|
||
|
|
struct shim_monitor_data {
|
||
|
|
diff --git a/src/daemon/modules/runtime/shim/shim_rt_ops.c b/src/daemon/modules/runtime/shim/shim_rt_ops.c
|
||
|
|
index 56fc43c2..1bc9dc54 100644
|
||
|
|
--- a/src/daemon/modules/runtime/shim/shim_rt_ops.c
|
||
|
|
+++ b/src/daemon/modules/runtime/shim/shim_rt_ops.c
|
||
|
|
@@ -395,7 +395,7 @@ int rt_shim_create(const char *id, const char *runtime, const rt_create_params_t
|
||
|
|
|
||
|
|
/**
|
||
|
|
* If task address is not set, create a new shim-v2 and get the address.
|
||
|
|
- * If task address is set, use it directly.
|
||
|
|
+ * If task address is set, use it directly.
|
||
|
|
*/
|
||
|
|
if (params->task_addr == NULL || strlen(params->task_addr) == 0) {
|
||
|
|
if (shim_bin_v2_create(runtime, id, params->bundle, NULL, response, state_path) != 0) {
|
||
|
|
diff --git a/src/daemon/modules/service/service_container.c b/src/daemon/modules/service/service_container.c
|
||
|
|
index 01427ddf..97f73768 100644
|
||
|
|
--- a/src/daemon/modules/service/service_container.c
|
||
|
|
+++ b/src/daemon/modules/service/service_container.c
|
||
|
|
@@ -2197,7 +2197,8 @@ static int exec_prepare_console(const container_t *cont, const container_exec_re
|
||
|
|
return exec_prepare_vsock(cont, request, stdinfd, stdout_handler, stderr_handler, io_addresses, sync_fd, thread_id);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
- return exec_prepare_fifo(cont, request, stdinfd, stdout_handler, stderr_handler, io_addresses, iopath, sync_fd, thread_id);
|
||
|
|
+ return exec_prepare_fifo(cont, request, stdinfd, stdout_handler, stderr_handler, io_addresses, iopath, sync_fd,
|
||
|
|
+ thread_id);
|
||
|
|
}
|
||
|
|
|
||
|
|
static void exec_container_end(container_exec_response *response, const container_t *cont,
|
||
|
|
diff --git a/src/daemon/modules/service/vsock_io_handler.cc b/src/daemon/modules/service/vsock_io_handler.cc
|
||
|
|
index efc74bc8..2c73490a 100644
|
||
|
|
--- a/src/daemon/modules/service/vsock_io_handler.cc
|
||
|
|
+++ b/src/daemon/modules/service/vsock_io_handler.cc
|
||
|
|
@@ -165,7 +165,7 @@ static int vsock_connect(uint32_t cid, uint32_t port)
|
||
|
|
sa.svm_cid = cid;
|
||
|
|
sa.svm_port = port;
|
||
|
|
|
||
|
|
- if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) !=0) {
|
||
|
|
+ if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) {
|
||
|
|
SYSERROR("Failed to connect vsock socket");
|
||
|
|
close(fd);
|
||
|
|
return -1;
|
||
|
|
@@ -314,7 +314,7 @@ void delete_daemon_vsockpaths(const char *sandbox_id, const char *vsockpaths[])
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
-enum IOFlowType{
|
||
|
|
+enum IOFlowType {
|
||
|
|
IO_SRC = 0,
|
||
|
|
IO_DST,
|
||
|
|
IO_FLOW_INVALID,
|
||
|
|
@@ -784,7 +784,8 @@ static void *IOCopyThread(void *arg)
|
||
|
|
return NULL;
|
||
|
|
}
|
||
|
|
|
||
|
|
-int start_vsock_io_copy(const char *exec_id, int sync_fd, bool detach, const char *fifoin, const char *fifoout, const char *fifoerr,
|
||
|
|
+int start_vsock_io_copy(const char *exec_id, int sync_fd, bool detach, const char *fifoin, const char *fifoout,
|
||
|
|
+ const char *fifoerr,
|
||
|
|
int stdin_fd, struct io_write_wrapper *stdout_handler, struct io_write_wrapper *stderr_handler,
|
||
|
|
const char *vsocks[], pthread_t *tid)
|
||
|
|
{
|
||
|
|
diff --git a/src/daemon/modules/service/vsock_io_handler.h b/src/daemon/modules/service/vsock_io_handler.h
|
||
|
|
index cc0c1dd0..8bda7711 100644
|
||
|
|
--- a/src/daemon/modules/service/vsock_io_handler.h
|
||
|
|
+++ b/src/daemon/modules/service/vsock_io_handler.h
|
||
|
|
@@ -20,8 +20,7 @@
|
||
|
|
#include <pthread.h>
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
-extern "C"
|
||
|
|
-{
|
||
|
|
+extern "C" {
|
||
|
|
#endif
|
||
|
|
|
||
|
|
bool is_vsock_path(const char *path);
|
||
|
|
@@ -35,7 +34,8 @@ int create_daemon_vsockpaths(const char *sandbox_id, uint32_t cid, bool attach_s
|
||
|
|
|
||
|
|
void delete_daemon_vsockpaths(const char *sandbox_id, const char *vsockpaths[]);
|
||
|
|
|
||
|
|
-int start_vsock_io_copy(const char *exec_id, int sync_fd, bool detach, const char *fifoin, const char *fifoout, const char *fifoerr,
|
||
|
|
+int start_vsock_io_copy(const char *exec_id, int sync_fd, bool detach, const char *fifoin, const char *fifoout,
|
||
|
|
+ const char *fifoerr,
|
||
|
|
int stdin_fd, struct io_write_wrapper *stdout_handler, struct io_write_wrapper *stderr_handler,
|
||
|
|
const char *vsocks[], pthread_t *tid);
|
||
|
|
|
||
|
|
diff --git a/src/daemon/sandbox/controller/sandboxer/client/grpc_async_wait_call.cc b/src/daemon/sandbox/controller/sandboxer/client/grpc_async_wait_call.cc
|
||
|
|
index d6d94461..c6f97da1 100644
|
||
|
|
--- a/src/daemon/sandbox/controller/sandboxer/client/grpc_async_wait_call.cc
|
||
|
|
+++ b/src/daemon/sandbox/controller/sandboxer/client/grpc_async_wait_call.cc
|
||
|
|
@@ -36,7 +36,8 @@ SandboxerAsyncWaitCall::SandboxerAsyncWaitCall(std::shared_ptr<SandboxStatusCall
|
||
|
|
m_remove = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerAsyncWaitCall::Call(containerd::services::sandbox::v1::Controller::StubInterface &stub, grpc::CompletionQueue &cq) -> bool
|
||
|
|
+auto SandboxerAsyncWaitCall::Call(containerd::services::sandbox::v1::Controller::StubInterface &stub,
|
||
|
|
+ grpc::CompletionQueue &cq) -> bool
|
||
|
|
{
|
||
|
|
containerd::services::sandbox::v1::ControllerWaitRequest request;
|
||
|
|
m_context = std::unique_ptr<grpc::ClientContext>(new grpc::ClientContext());
|
||
|
|
@@ -96,10 +97,11 @@ SandboxerAsyncWaitStatus SandboxerAsyncWaitCall::HandleResponse()
|
||
|
|
ControllerExitInfo exitInfo;
|
||
|
|
SandboxerAsyncWaitStatus waitStatus = SANDBOXER_ASYNC_WAIT_STATUS_ERROR;
|
||
|
|
|
||
|
|
- switch(m_status.error_code()) {
|
||
|
|
+ switch (m_status.error_code()) {
|
||
|
|
case grpc::StatusCode::UNAVAILABLE:
|
||
|
|
// If the status is unavailable, connection failed, we should retry
|
||
|
|
- WARN("Sandboxer controller wait rpc server unavailable, error_code: %d: %s", m_status.error_code(), m_status.error_message().c_str());
|
||
|
|
+ WARN("Sandboxer controller wait rpc server unavailable, error_code: %d: %s", m_status.error_code(),
|
||
|
|
+ m_status.error_message().c_str());
|
||
|
|
waitStatus = SANDBOXER_ASYNC_WAIT_STATUS_RETRY;
|
||
|
|
m_retryTimes++;
|
||
|
|
// If retried times is more than 10, we should retry every 300 seconds
|
||
|
|
@@ -128,7 +130,8 @@ SandboxerAsyncWaitStatus SandboxerAsyncWaitCall::HandleResponse()
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
// TODO: More error code should be handled
|
||
|
|
- ERROR("Sandboxer controller wait request failed, error_code: %d: %s", m_status.error_code(), m_status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller wait request failed, error_code: %d: %s", m_status.error_code(),
|
||
|
|
+ m_status.error_message().c_str());
|
||
|
|
SandboxExitCallback(false, exitInfo);
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
diff --git a/src/daemon/sandbox/controller/sandboxer/client/grpc_async_wait_call.h b/src/daemon/sandbox/controller/sandboxer/client/grpc_async_wait_call.h
|
||
|
|
index eb633e99..6e5a6756 100644
|
||
|
|
--- a/src/daemon/sandbox/controller/sandboxer/client/grpc_async_wait_call.h
|
||
|
|
+++ b/src/daemon/sandbox/controller/sandboxer/client/grpc_async_wait_call.h
|
||
|
|
@@ -49,16 +49,26 @@ public:
|
||
|
|
void SandboxPendingCallback();
|
||
|
|
void SandboxReadyCallback();
|
||
|
|
auto GetSandboxId() -> const std::string &;
|
||
|
|
- auto MarkRemove() -> void { m_remove = true; }
|
||
|
|
- auto ToRemove() -> bool { return m_remove; }
|
||
|
|
- auto ResetRetryTimes() -> void { m_retryTimes = 0; }
|
||
|
|
+ auto MarkRemove() -> void
|
||
|
|
+ {
|
||
|
|
+ m_remove = true;
|
||
|
|
+ }
|
||
|
|
+ auto ToRemove() -> bool
|
||
|
|
+ {
|
||
|
|
+ return m_remove;
|
||
|
|
+ }
|
||
|
|
+ auto ResetRetryTimes() -> void
|
||
|
|
+ {
|
||
|
|
+ m_retryTimes = 0;
|
||
|
|
+ }
|
||
|
|
|
||
|
|
protected:
|
||
|
|
std::shared_ptr<containerd::services::sandbox::v1::Controller::StubInterface> m_stub;
|
||
|
|
std::shared_ptr<SandboxStatusCallback> m_cb;
|
||
|
|
std::string m_sandboxId;
|
||
|
|
std::string m_sandboxer;
|
||
|
|
- std::unique_ptr<grpc::ClientAsyncResponseReaderInterface<containerd::services::sandbox::v1::ControllerWaitResponse>> m_responseReader;
|
||
|
|
+ std::unique_ptr<grpc::ClientAsyncResponseReaderInterface<containerd::services::sandbox::v1::ControllerWaitResponse>>
|
||
|
|
+ m_responseReader;
|
||
|
|
std::unique_ptr<grpc::ClientContext> m_context;
|
||
|
|
containerd::services::sandbox::v1::ControllerWaitResponse m_response;
|
||
|
|
grpc::Status m_status;
|
||
|
|
diff --git a/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_client.cc b/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_client.cc
|
||
|
|
index b5dda0ed..11c2b014 100644
|
||
|
|
--- a/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_client.cc
|
||
|
|
+++ b/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_client.cc
|
||
|
|
@@ -102,14 +102,16 @@ auto SandboxerClient::Create(const std::string &sandboxId, const ControllerCreat
|
||
|
|
status = m_stub->Create(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller create request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller create request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-void SandboxerClient::StartResponseToSandboxInfo(const containerd::services::sandbox::v1::ControllerStartResponse &response,
|
||
|
|
+void SandboxerClient::StartResponseToSandboxInfo(const containerd::services::sandbox::v1::ControllerStartResponse
|
||
|
|
+ &response,
|
||
|
|
ControllerSandboxInfo &sandboxInfo)
|
||
|
|
{
|
||
|
|
sandboxInfo.id = response.sandbox_id();
|
||
|
|
@@ -132,7 +134,8 @@ auto SandboxerClient::Start(const std::string &sandboxId, ControllerSandboxInfo
|
||
|
|
status = m_stub->Start(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller start request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller start request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -174,7 +177,8 @@ auto SandboxerClient::InitPrepareRequest(containerd::services::sandbox::v1::Prep
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::Prepare(const std::string &sandboxId, const ControllerPrepareParams ¶ms, std::string &bundle, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::Prepare(const std::string &sandboxId, const ControllerPrepareParams ¶ms, std::string &bundle,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
grpc::ClientContext context;
|
||
|
|
containerd::services::sandbox::v1::PrepareRequest request;
|
||
|
|
@@ -189,7 +193,8 @@ auto SandboxerClient::Prepare(const std::string &sandboxId, const ControllerPrep
|
||
|
|
status = m_stub->Prepare(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller prepare request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller prepare request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -199,7 +204,7 @@ auto SandboxerClient::Prepare(const std::string &sandboxId, const ControllerPrep
|
||
|
|
}
|
||
|
|
|
||
|
|
auto SandboxerClient::Purge(const std::string &sandboxId, const std::string &containerId,
|
||
|
|
- const std::string &execId, Errors &error) -> bool
|
||
|
|
+ const std::string &execId, Errors &error) -> bool
|
||
|
|
{
|
||
|
|
grpc::ClientContext context;
|
||
|
|
containerd::services::sandbox::v1::PurgeRequest request;
|
||
|
|
@@ -214,7 +219,8 @@ auto SandboxerClient::Purge(const std::string &sandboxId, const std::string &con
|
||
|
|
status = m_stub->Purge(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller purge request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller purge request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -237,7 +243,8 @@ auto SandboxerClient::InitUpdateResourcesRequest(containerd::services::sandbox::
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::UpdateResources(const std::string &sandboxId, const ControllerUpdateResourcesParams ¶ms, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::UpdateResources(const std::string &sandboxId, const ControllerUpdateResourcesParams ¶ms,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
grpc::ClientContext context;
|
||
|
|
containerd::services::sandbox::v1::UpdateResourcesRequest request;
|
||
|
|
@@ -245,21 +252,24 @@ auto SandboxerClient::UpdateResources(const std::string &sandboxId, const Contro
|
||
|
|
grpc::Status status;
|
||
|
|
|
||
|
|
if (!InitUpdateResourcesRequest(request, sandboxId, params)) {
|
||
|
|
- error.SetError("Failed to init update-resources request for sandboxer update-resources request, sandbox id: " + sandboxId);
|
||
|
|
+ error.SetError("Failed to init update-resources request for sandboxer update-resources request, sandbox id: " +
|
||
|
|
+ sandboxId);
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
status = m_stub->UpdateResources(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller update resources request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller update resources request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-void SandboxerClient::PlatformResponseToPlatformInfo(const containerd::services::sandbox::v1::ControllerPlatformResponse &response,
|
||
|
|
+void SandboxerClient::PlatformResponseToPlatformInfo(const containerd::services::sandbox::v1::ControllerPlatformResponse
|
||
|
|
+ &response,
|
||
|
|
ControllerPlatformInfo &platformInfo)
|
||
|
|
{
|
||
|
|
auto &platform = response.platform();
|
||
|
|
@@ -268,7 +278,8 @@ void SandboxerClient::PlatformResponseToPlatformInfo(const containerd::services:
|
||
|
|
platformInfo.variant = platform.variant();
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::Platform(const std::string &sandboxId, ControllerPlatformInfo &platformInfo, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::Platform(const std::string &sandboxId, ControllerPlatformInfo &platformInfo,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
grpc::ClientContext context;
|
||
|
|
containerd::services::sandbox::v1::ControllerPlatformRequest request;
|
||
|
|
@@ -281,7 +292,8 @@ auto SandboxerClient::Platform(const std::string &sandboxId, ControllerPlatformI
|
||
|
|
status = m_stub->Platform(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller platform request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller platform request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -304,14 +316,16 @@ auto SandboxerClient::Stop(const std::string &sandboxId, uint32_t timeoutSecs, E
|
||
|
|
status = m_stub->Stop(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller stop request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller stop request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-void SandboxerClient::StatusResponseToSandboxStatus(const containerd::services::sandbox::v1::ControllerStatusResponse &response,
|
||
|
|
+void SandboxerClient::StatusResponseToSandboxStatus(const containerd::services::sandbox::v1::ControllerStatusResponse
|
||
|
|
+ &response,
|
||
|
|
ControllerSandboxStatus &sandboxStatus)
|
||
|
|
{
|
||
|
|
sandboxStatus.id = response.sandbox_id();
|
||
|
|
@@ -324,7 +338,8 @@ void SandboxerClient::StatusResponseToSandboxStatus(const containerd::services::
|
||
|
|
sandboxStatus.extra = response.extra().value();
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::Status(const std::string &sandboxId, bool verbose, ControllerSandboxStatus &sandboxStatus, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::Status(const std::string &sandboxId, bool verbose, ControllerSandboxStatus &sandboxStatus,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
grpc::ClientContext context;
|
||
|
|
containerd::services::sandbox::v1::ControllerStatusRequest request;
|
||
|
|
@@ -338,7 +353,8 @@ auto SandboxerClient::Status(const std::string &sandboxId, bool verbose, Control
|
||
|
|
status = m_stub->Status(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller status request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller status request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -360,14 +376,16 @@ auto SandboxerClient::Shutdown(const std::string &sandboxId, Errors &error) -> b
|
||
|
|
status = m_stub->Shutdown(&context, request, &response);
|
||
|
|
if (!status.ok()) {
|
||
|
|
error.SetError(status.error_message());
|
||
|
|
- ERROR("Sandboxer controller shutdown request failed, error_code: %d: %s", status.error_code(), status.error_message().c_str());
|
||
|
|
+ ERROR("Sandboxer controller shutdown request failed, error_code: %d: %s", status.error_code(),
|
||
|
|
+ status.error_message().c_str());
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::Wait(std::shared_ptr<SandboxStatusCallback> cb, const std::string &sandboxId, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::Wait(std::shared_ptr<SandboxStatusCallback> cb, const std::string &sandboxId,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
if (m_monitor == nullptr) {
|
||
|
|
error.SetError("Cannot wait for sandbox, sandboxer client monitor is not initialized, "
|
||
|
|
diff --git a/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_client.h b/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_client.h
|
||
|
|
index 85e1e608..accca16b 100644
|
||
|
|
--- a/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_client.h
|
||
|
|
+++ b/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_client.h
|
||
|
|
@@ -48,12 +48,14 @@ public:
|
||
|
|
|
||
|
|
auto Platform(const std::string &sandboxId, ControllerPlatformInfo &platformInfo, Errors &error) -> bool;
|
||
|
|
|
||
|
|
- auto Prepare(const std::string &sandboxId, const ControllerPrepareParams ¶ms, std::string &bundle, Errors &error) -> bool;
|
||
|
|
+ auto Prepare(const std::string &sandboxId, const ControllerPrepareParams ¶ms, std::string &bundle,
|
||
|
|
+ Errors &error) -> bool;
|
||
|
|
|
||
|
|
auto Purge(const std::string &sandboxId, const std::string &containerId,
|
||
|
|
const std::string &execId, Errors &error) -> bool;
|
||
|
|
|
||
|
|
- auto UpdateResources(const std::string &sandboxId, const ControllerUpdateResourcesParams ¶ms, Errors &error) -> bool;
|
||
|
|
+ auto UpdateResources(const std::string &sandboxId, const ControllerUpdateResourcesParams ¶ms,
|
||
|
|
+ Errors &error) -> bool;
|
||
|
|
|
||
|
|
auto Stop(const std::string &sandboxId, uint32_t timeoutSecs, Errors &error) -> bool;
|
||
|
|
|
||
|
|
diff --git a/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_monitor.cc b/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_monitor.cc
|
||
|
|
index 1417ee40..485a0b23 100644
|
||
|
|
--- a/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_monitor.cc
|
||
|
|
+++ b/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_monitor.cc
|
||
|
|
@@ -24,7 +24,7 @@ namespace sandbox {
|
||
|
|
const int64_t DEFERRED_QUEUE_CHECK_INTERVAL = 200; // milliseconds
|
||
|
|
|
||
|
|
SandboxerClientMonitor::SandboxerClientMonitor(std::shared_ptr<grpc::Channel> channel, const std::string &sandboxer):
|
||
|
|
- m_channel(channel), m_sandboxer(sandboxer) ,m_teardown(false)
|
||
|
|
+ m_channel(channel), m_sandboxer(sandboxer), m_teardown(false)
|
||
|
|
{
|
||
|
|
m_stub = containerd::services::sandbox::v1::Controller::NewStub(m_channel);
|
||
|
|
}
|
||
|
|
@@ -46,7 +46,7 @@ auto SandboxerClientMonitor::Monitor(SandboxerAsyncWaitCall *call) -> bool
|
||
|
|
}
|
||
|
|
|
||
|
|
// Try to monitor the call, if failed, we should delete it right way
|
||
|
|
- if (!call->Call(*m_stub ,m_cq)) {
|
||
|
|
+ if (!call->Call(*m_stub, m_cq)) {
|
||
|
|
// The failure is most likely due to the fact that the completion queue is shutdown
|
||
|
|
delete call;
|
||
|
|
return false;
|
||
|
|
@@ -114,11 +114,11 @@ void SandboxerClientMonitor::WaitForDeferredCall()
|
||
|
|
// 2. SandboxerAsyncWaitCall *: The call handled by the future
|
||
|
|
void SandboxerClientMonitor::InvokeDeferredCall(SandboxerAsyncWaitCall *call)
|
||
|
|
{
|
||
|
|
- m_futures.push_back(std::async([this, call](){
|
||
|
|
+ m_futures.push_back(std::async([this, call]() {
|
||
|
|
// Random sleep for 50 ~ 200 milliseconds to avoid thundering herd
|
||
|
|
std::random_device rd;
|
||
|
|
std::mt19937 gen(rd());
|
||
|
|
- std::uniform_int_distribution<> dis(DEFERRED_QUEUE_CHECK_INTERVAL/4, DEFERRED_QUEUE_CHECK_INTERVAL);
|
||
|
|
+ std::uniform_int_distribution<> dis(DEFERRED_QUEUE_CHECK_INTERVAL / 4, DEFERRED_QUEUE_CHECK_INTERVAL);
|
||
|
|
int sleepTime = dis(gen);
|
||
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
|
||
|
|
|
||
|
|
@@ -186,7 +186,7 @@ void SandboxerClientMonitor::CheckCompletedFutures()
|
||
|
|
// or OnSandboxExit in the HandleResponse function.
|
||
|
|
// In this case, the OnSandboxReady will overwrite the
|
||
|
|
// status, but it is ok, because:
|
||
|
|
- // 1. If OnSandboxPending has been invoked,
|
||
|
|
+ // 1. If OnSandboxPending has been invoked,
|
||
|
|
// retry will happen pretty soon, and the
|
||
|
|
// callback will be invoked again.
|
||
|
|
// 2. If OnSandboxExit has been invoked, the caller
|
||
|
|
diff --git a/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_monitor.h b/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_monitor.h
|
||
|
|
index 32fca934..b5740b44 100644
|
||
|
|
--- a/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_monitor.h
|
||
|
|
+++ b/src/daemon/sandbox/controller/sandboxer/client/grpc_sandboxer_monitor.h
|
||
|
|
@@ -68,7 +68,7 @@ private:
|
||
|
|
// Vector for holding all the calls for monitoring
|
||
|
|
std::vector<SandboxerAsyncWaitCall *> m_calls;
|
||
|
|
std::mutex m_callsMutex;
|
||
|
|
- // Use to indicate whether
|
||
|
|
+ // Use to indicate whether
|
||
|
|
bool m_teardown;
|
||
|
|
// Vector for holding all the retry calls
|
||
|
|
std::vector<SandboxerAsyncWaitCall *> m_deferredCalls;
|
||
|
|
diff --git a/src/daemon/sandbox/controller/shim/shim_controller.cc b/src/daemon/sandbox/controller/shim/shim_controller.cc
|
||
|
|
index baddf1aa..39fcf8ea 100644
|
||
|
|
--- a/src/daemon/sandbox/controller/shim/shim_controller.cc
|
||
|
|
+++ b/src/daemon/sandbox/controller/shim/shim_controller.cc
|
||
|
|
@@ -247,7 +247,8 @@ auto ShimController::GenerateSandboxCreateContainerRequest(const std::string &sa
|
||
|
|
return nullptr;
|
||
|
|
}
|
||
|
|
|
||
|
|
- auto requestWrapper = PackCreateContainerRequest(sandboxId, params, hostConfigWrapper->get(), customConfigWrapper->get(), error);
|
||
|
|
+ auto requestWrapper = PackCreateContainerRequest(sandboxId, params, hostConfigWrapper->get(),
|
||
|
|
+ customConfigWrapper->get(), error);
|
||
|
|
if (requestWrapper == nullptr) {
|
||
|
|
ERROR("Failed to pack create container request");
|
||
|
|
error.SetError("Failed to pack create container request");
|
||
|
|
@@ -570,7 +571,7 @@ bool ShimController::UpdateNetworkSettings(const std::string &sandboxId, const s
|
||
|
|
}
|
||
|
|
|
||
|
|
auto requestWrapper = makeUniquePtrCStructWrapper<container_update_network_settings_request>(
|
||
|
|
- free_container_update_network_settings_request);
|
||
|
|
+ free_container_update_network_settings_request);
|
||
|
|
if (requestWrapper == nullptr) {
|
||
|
|
ERROR("container update network settings request: Out of memory");
|
||
|
|
error.Errorf("container update network settings request: Out of memory");
|
||
|
|
@@ -583,7 +584,7 @@ bool ShimController::UpdateNetworkSettings(const std::string &sandboxId, const s
|
||
|
|
container_update_network_settings_response *response { nullptr };
|
||
|
|
int ret = m_cb->container.update_network_settings(request, &response);
|
||
|
|
auto responseWrapper = makeUniquePtrCStructWrapper<container_update_network_settings_response>(
|
||
|
|
- response, free_container_update_network_settings_response);
|
||
|
|
+ response, free_container_update_network_settings_response);
|
||
|
|
|
||
|
|
if (ret != 0) {
|
||
|
|
if (response != nullptr && response->errmsg != nullptr) {
|
||
|
|
diff --git a/src/daemon/sandbox/sandbox.cc b/src/daemon/sandbox/sandbox.cc
|
||
|
|
index c8fd30be..b1832265 100644
|
||
|
|
--- a/src/daemon/sandbox/sandbox.cc
|
||
|
|
+++ b/src/daemon/sandbox/sandbox.cc
|
||
|
|
@@ -942,7 +942,8 @@ auto Sandbox::ParseSandboxMetadataFile() -> std::unique_ptr<CStructWrapper<sandb
|
||
|
|
if (metadata == NULL) {
|
||
|
|
return nullptr;
|
||
|
|
}
|
||
|
|
- return std::unique_ptr<CStructWrapper<sandbox_metadata>>(new CStructWrapper<sandbox_metadata>(metadata, free_sandbox_metadata));
|
||
|
|
+ return std::unique_ptr<CStructWrapper<sandbox_metadata>>(new CStructWrapper<sandbox_metadata>(metadata,
|
||
|
|
+ free_sandbox_metadata));
|
||
|
|
}
|
||
|
|
|
||
|
|
auto Sandbox::isValidMetadata(std::unique_ptr<CStructWrapper<sandbox_metadata>> &metadata) -> bool
|
||
|
|
diff --git a/src/daemon/sandbox/sandbox_manager.cc b/src/daemon/sandbox/sandbox_manager.cc
|
||
|
|
index 60ce97d5..d3db4fb4 100644
|
||
|
|
--- a/src/daemon/sandbox/sandbox_manager.cc
|
||
|
|
+++ b/src/daemon/sandbox/sandbox_manager.cc
|
||
|
|
@@ -60,7 +60,8 @@ auto SandboxManager::Init(Errors &error) -> bool
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxManager::CreateSandbox(const std::string &name, RuntimeInfo &info, std::string &netNsPath, std::string &netMode,
|
||
|
|
+auto SandboxManager::CreateSandbox(const std::string &name, RuntimeInfo &info, std::string &netNsPath,
|
||
|
|
+ std::string &netMode,
|
||
|
|
const runtime::v1::PodSandboxConfig &sandboxConfig, const std::string &image, Errors &error) -> std::shared_ptr<Sandbox>
|
||
|
|
{
|
||
|
|
std::shared_ptr<Sandbox> sandbox;
|
||
|
|
diff --git a/src/daemon/sandbox/sandbox_manager.h b/src/daemon/sandbox/sandbox_manager.h
|
||
|
|
index 3a6ce3c9..c9ed78ed 100644
|
||
|
|
--- a/src/daemon/sandbox/sandbox_manager.h
|
||
|
|
+++ b/src/daemon/sandbox/sandbox_manager.h
|
||
|
|
@@ -37,7 +37,8 @@ public:
|
||
|
|
|
||
|
|
// Create meanningful sandbox instance
|
||
|
|
auto CreateSandbox(const std::string &name, RuntimeInfo &info, std::string &netNsPath, std::string &netMode,
|
||
|
|
- const runtime::v1::PodSandboxConfig &sandboxConfig, const std::string &image, Errors &error) -> std::shared_ptr<Sandbox>;
|
||
|
|
+ const runtime::v1::PodSandboxConfig &sandboxConfig, const std::string &image,
|
||
|
|
+ Errors &error) -> std::shared_ptr<Sandbox>;
|
||
|
|
|
||
|
|
auto GetSandbox(const std::string &idOrName) -> std::shared_ptr<Sandbox>;
|
||
|
|
auto DeleteSandbox(const std::string &idOrName, Errors &error) -> bool;
|
||
|
|
diff --git a/src/daemon/sandbox/sandbox_ops.cc b/src/daemon/sandbox/sandbox_ops.cc
|
||
|
|
index 2f4a46f6..005063c0 100644
|
||
|
|
--- a/src/daemon/sandbox/sandbox_ops.cc
|
||
|
|
+++ b/src/daemon/sandbox/sandbox_ops.cc
|
||
|
|
@@ -70,7 +70,7 @@ static int do_sandbox_prepare(const container_config_v2_common_config *config,
|
||
|
|
}
|
||
|
|
|
||
|
|
params.containerId = config->id;
|
||
|
|
- params.execId = (nullptr == exec_id) ? "" :exec_id;
|
||
|
|
+ params.execId = (nullptr == exec_id) ? "" : exec_id;
|
||
|
|
params.spec = std::move(std::unique_ptr<std::string>(new std::string(oci_spec)));
|
||
|
|
|
||
|
|
if (generate_ctrl_rootfs(params, config) != 0) {
|
||
|
|
diff --git a/src/daemon/sandbox/sandbox_ops.h b/src/daemon/sandbox/sandbox_ops.h
|
||
|
|
index bcb1e9d2..bef884fb 100644
|
||
|
|
--- a/src/daemon/sandbox/sandbox_ops.h
|
||
|
|
+++ b/src/daemon/sandbox/sandbox_ops.h
|
||
|
|
@@ -21,8 +21,7 @@
|
||
|
|
#include <isula_libutils/oci_runtime_spec.h>
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
-extern "C"
|
||
|
|
-{
|
||
|
|
+extern "C" {
|
||
|
|
#endif
|
||
|
|
|
||
|
|
int sandbox_prepare_container(const container_config_v2_common_config *config,
|
||
|
|
diff --git a/src/utils/cpputils/url.cc b/src/utils/cpputils/url.cc
|
||
|
|
index baaded07..c1e5d27f 100644
|
||
|
|
--- a/src/utils/cpputils/url.cc
|
||
|
|
+++ b/src/utils/cpputils/url.cc
|
||
|
|
@@ -122,8 +122,9 @@ int UnescapeDealWithPercentSign(size_t &i, std::string &s, const EncodeMode &mod
|
||
|
|
}
|
||
|
|
// for 3 bit hex, max value is 8
|
||
|
|
if (mode == EncodeMode::ENCODE_HOST && s1 < 8 &&
|
||
|
|
- std::string(s.begin() + static_cast<long>(i), s.begin() + static_cast<long>(i+3)) != percentSign) {
|
||
|
|
- ERROR("invalid URL escape %s", std::string(s.begin() + static_cast<long>(i), s.begin() + static_cast<long>(i + 3)).c_str());
|
||
|
|
+ std::string(s.begin() + static_cast<long>(i), s.begin() + static_cast<long>(i + 3)) != percentSign) {
|
||
|
|
+ ERROR("invalid URL escape %s", std::string(s.begin() + static_cast<long>(i),
|
||
|
|
+ s.begin() + static_cast<long>(i + 3)).c_str());
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
if (mode == EncodeMode::ENCODE_ZONE) {
|
||
|
|
diff --git a/src/utils/cutils/error.h b/src/utils/cutils/error.h
|
||
|
|
index 75eae760..1ad799fa 100644
|
||
|
|
--- a/src/utils/cutils/error.h
|
||
|
|
+++ b/src/utils/cutils/error.h
|
||
|
|
@@ -47,7 +47,7 @@ extern "C" {
|
||
|
|
/* info for detach */ \
|
||
|
|
XX(INFO_DETACH, "Attach detach") \
|
||
|
|
/* err max */ \
|
||
|
|
- XX(ERR_UNKNOWN, "Unknown error")
|
||
|
|
+ XX(ERR_UNKNOWN, "Unknown error")
|
||
|
|
|
||
|
|
#define ISULAD_ERRNO_GEN(n, s) ISULAD_##n,
|
||
|
|
typedef enum { ISULAD_ERRNO_MAP(ISULAD_ERRNO_GEN) } isulad_errno_t;
|
||
|
|
diff --git a/src/utils/cutils/map/map.h b/src/utils/cutils/map/map.h
|
||
|
|
index 45ce26b8..d569a3da 100644
|
||
|
|
--- a/src/utils/cutils/map/map.h
|
||
|
|
+++ b/src/utils/cutils/map/map.h
|
||
|
|
@@ -20,10 +20,6 @@
|
||
|
|
|
||
|
|
#include "rb_tree.h"
|
||
|
|
|
||
|
|
-#ifdef __cplusplus
|
||
|
|
-extern "C" {
|
||
|
|
-#endif
|
||
|
|
-
|
||
|
|
struct _map_t;
|
||
|
|
|
||
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||
|
|
@@ -113,9 +109,5 @@ void map_clear(map_t *map);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
-#ifdef __cplusplus
|
||
|
|
-}
|
||
|
|
-#endif
|
||
|
|
-
|
||
|
|
#endif // UTILS_CUTILS_MAP_MAP_H
|
||
|
|
|
||
|
|
diff --git a/src/utils/tar/isulad_tar.c b/src/utils/tar/isulad_tar.c
|
||
|
|
index 2e61d823..bbe4c3b2 100644
|
||
|
|
--- a/src/utils/tar/isulad_tar.c
|
||
|
|
+++ b/src/utils/tar/isulad_tar.c
|
||
|
|
@@ -97,7 +97,8 @@ cleanup:
|
||
|
|
return ret;
|
||
|
|
}
|
||
|
|
|
||
|
|
-static int resolve_host_source_path(const char *path, bool follow_link, char **resolved_path, char **rebase_name, char **err)
|
||
|
|
+static int resolve_host_source_path(const char *path, bool follow_link, char **resolved_path, char **rebase_name,
|
||
|
|
+ char **err)
|
||
|
|
{
|
||
|
|
int ret = -1;
|
||
|
|
int nret = 0;
|
||
|
|
@@ -419,7 +420,8 @@ cleanup:
|
||
|
|
return ret;
|
||
|
|
}
|
||
|
|
|
||
|
|
-static int tar_resource_rebase(const char *path, const char *rebase, const char *root_dir, struct io_read_wrapper *archive_reader, char **err)
|
||
|
|
+static int tar_resource_rebase(const char *path, const char *rebase, const char *root_dir,
|
||
|
|
+ struct io_read_wrapper *archive_reader, char **err)
|
||
|
|
{
|
||
|
|
int ret = -1;
|
||
|
|
int nret;
|
||
|
|
@@ -450,7 +452,8 @@ cleanup:
|
||
|
|
return ret;
|
||
|
|
}
|
||
|
|
|
||
|
|
-int tar_resource(const struct archive_copy_info *info, const char *root_dir, struct io_read_wrapper *archive_reader, char **err)
|
||
|
|
+int tar_resource(const struct archive_copy_info *info, const char *root_dir, struct io_read_wrapper *archive_reader,
|
||
|
|
+ char **err)
|
||
|
|
{
|
||
|
|
if (info == NULL || root_dir == NULL || archive_reader == NULL || err == NULL) {
|
||
|
|
return -1;
|
||
|
|
diff --git a/src/utils/tar/isulad_tar.h b/src/utils/tar/isulad_tar.h
|
||
|
|
index 414bb024..401dcf50 100644
|
||
|
|
--- a/src/utils/tar/isulad_tar.h
|
||
|
|
+++ b/src/utils/tar/isulad_tar.h
|
||
|
|
@@ -43,7 +43,8 @@ struct archive_copy_info *copy_info_source_path(const char *path, bool follow_li
|
||
|
|
char *prepare_archive_copy(const struct archive_copy_info *srcinfo, const struct archive_copy_info *dstinfo,
|
||
|
|
char **src_base, char **dst_base, char **err);
|
||
|
|
|
||
|
|
-int tar_resource(const struct archive_copy_info *info, const char *root_dir, struct io_read_wrapper *archive_reader, char **err);
|
||
|
|
+int tar_resource(const struct archive_copy_info *info, const char *root_dir, struct io_read_wrapper *archive_reader,
|
||
|
|
+ char **err);
|
||
|
|
|
||
|
|
int archive_copy_to(const struct io_read_wrapper *content, const struct archive_copy_info *srcinfo,
|
||
|
|
const char *dstpath, const char *root_dir, char **err);
|
||
|
|
diff --git a/test/cutils/utils_file/utils_file_ut.cc b/test/cutils/utils_file/utils_file_ut.cc
|
||
|
|
index cacfef45..b3e35744 100644
|
||
|
|
--- a/test/cutils/utils_file/utils_file_ut.cc
|
||
|
|
+++ b/test/cutils/utils_file/utils_file_ut.cc
|
||
|
|
@@ -200,7 +200,7 @@ TEST(utils_file, test_util_proc_file_line_by_line)
|
||
|
|
ASSERT_EQ(util_proc_file_line_by_line(fp, nullptr, (void *)checked_layers), -1);
|
||
|
|
fclose(fp);
|
||
|
|
ASSERT_EQ(util_path_remove(path.c_str()), 0);
|
||
|
|
-
|
||
|
|
+
|
||
|
|
ASSERT_EQ(util_proc_file_line_by_line(nullptr, parse_checked_layer_cb, (void *)checked_layers), -1);
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/test/mocks/callback_mock.cc b/test/mocks/callback_mock.cc
|
||
|
|
index ef0e347c..153446eb 100644
|
||
|
|
--- a/test/mocks/callback_mock.cc
|
||
|
|
+++ b/test/mocks/callback_mock.cc
|
||
|
|
@@ -25,7 +25,8 @@ void MockCallback_SetMock(std::shared_ptr<MockContainerCallback> mock)
|
||
|
|
g_container_callback_mock = mock;
|
||
|
|
}
|
||
|
|
|
||
|
|
-static int service_executor_container_create(const container_create_request *request, container_create_response **response)
|
||
|
|
+static int service_executor_container_create(const container_create_request *request,
|
||
|
|
+ container_create_response **response)
|
||
|
|
{
|
||
|
|
if (g_container_callback_mock != nullptr) {
|
||
|
|
return g_container_callback_mock->ContainerCreate(request, response);
|
||
|
|
@@ -50,7 +51,8 @@ static int service_executor_container_stop(const container_stop_request *request
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
-static int service_executor_container_remove(const container_delete_request *request, container_delete_response **response)
|
||
|
|
+static int service_executor_container_remove(const container_delete_request *request,
|
||
|
|
+ container_delete_response **response)
|
||
|
|
{
|
||
|
|
if (g_container_callback_mock != nullptr) {
|
||
|
|
return g_container_callback_mock->ContainerRemove(request, response);
|
||
|
|
@@ -67,7 +69,7 @@ static int service_executor_container_wait(const container_wait_request *request
|
||
|
|
}
|
||
|
|
|
||
|
|
static int service_executor_container_update_network_settings(const container_update_network_settings_request *request,
|
||
|
|
- container_update_network_settings_response **response)
|
||
|
|
+ container_update_network_settings_response **response)
|
||
|
|
{
|
||
|
|
if (g_container_callback_mock != nullptr) {
|
||
|
|
return g_container_callback_mock->ContainerUpdateNetworkSettings(request, response);
|
||
|
|
diff --git a/test/mocks/controller_stub_mock.cc b/test/mocks/controller_stub_mock.cc
|
||
|
|
index eadf3cb4..712540bb 100644
|
||
|
|
--- a/test/mocks/controller_stub_mock.cc
|
||
|
|
+++ b/test/mocks/controller_stub_mock.cc
|
||
|
|
@@ -2,221 +2,313 @@
|
||
|
|
|
||
|
|
static std::shared_ptr<MockControllerStub> g_controller_stub_mock = NULL;
|
||
|
|
|
||
|
|
-std::unique_ptr<DummyControllerStub> NewDummyControllerStub() {
|
||
|
|
- std::unique_ptr<DummyControllerStub> stub(new DummyControllerStub());
|
||
|
|
- return stub;
|
||
|
|
+std::unique_ptr<DummyControllerStub> NewDummyControllerStub()
|
||
|
|
+{
|
||
|
|
+ std::unique_ptr<DummyControllerStub> stub(new DummyControllerStub());
|
||
|
|
+ return stub;
|
||
|
|
}
|
||
|
|
|
||
|
|
-void MockControllerStub_SetMock(std::shared_ptr<MockControllerStub> mock) {
|
||
|
|
+void MockControllerStub_SetMock(std::shared_ptr<MockControllerStub> mock)
|
||
|
|
+{
|
||
|
|
g_controller_stub_mock = mock;
|
||
|
|
}
|
||
|
|
|
||
|
|
-::grpc::Status DummyControllerStub::Create(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::containerd::services::sandbox::v1::ControllerCreateResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Create(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::Start(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::containerd::services::sandbox::v1::ControllerStartResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Start(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::Platform(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::containerd::services::sandbox::v1::ControllerPlatformResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Platform(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::Prepare(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::containerd::services::sandbox::v1::PrepareResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Prepare(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::Purge(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::containerd::services::sandbox::v1::PurgeResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Purge(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::UpdateResources(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::containerd::services::sandbox::v1::UpdateResourcesResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->UpdateResources(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::Stop(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::containerd::services::sandbox::v1::ControllerStopResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Stop(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::Wait(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::containerd::services::sandbox::v1::ControllerWaitResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Wait(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::containerd::services::sandbox::v1::ControllerStatusResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Status(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::Status DummyControllerStub::Shutdown(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::containerd::services::sandbox::v1::ControllerShutdownResponse* response) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return ::grpc::Status::OK;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->Shutdown(context, request, response);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>* DummyControllerStub::AsyncCreateRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncCreateRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>* DummyControllerStub::PrepareAsyncCreateRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncCreateRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>* DummyControllerStub::AsyncStartRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncStartRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>* DummyControllerStub::PrepareAsyncStartRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncStartRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>* DummyControllerStub::AsyncPlatformRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncPlatformRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>* DummyControllerStub::PrepareAsyncPlatformRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncPlatformRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>* DummyControllerStub::AsyncPrepareRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncPrepareRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>* DummyControllerStub::PrepareAsyncPrepareRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncPrepareRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>* DummyControllerStub::AsyncPurgeRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncPurgeRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>* DummyControllerStub::PrepareAsyncPurgeRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncPurgeRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>* DummyControllerStub::AsyncUpdateResourcesRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncUpdateResourcesRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>* DummyControllerStub::PrepareAsyncUpdateResourcesRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncUpdateResourcesRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>* DummyControllerStub::AsyncStopRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncStopRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>* DummyControllerStub::PrepareAsyncStopRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncStopRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>* DummyControllerStub::AsyncWaitRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncWaitRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>* DummyControllerStub::PrepareAsyncWaitRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncWaitRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>* DummyControllerStub::AsyncStatusRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncStatusRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>* DummyControllerStub::PrepareAsyncStatusRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncStatusRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>* DummyControllerStub::AsyncShutdownRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->AsyncShutdownRaw(context, request, cq);
|
||
|
|
-}
|
||
|
|
-
|
||
|
|
-::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>* DummyControllerStub::PrepareAsyncShutdownRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::grpc::CompletionQueue* cq) {
|
||
|
|
- if (g_controller_stub_mock == NULL) {
|
||
|
|
- return NULL;
|
||
|
|
- }
|
||
|
|
- return g_controller_stub_mock->PrepareAsyncShutdownRaw(context, request, cq);
|
||
|
|
+::grpc::Status DummyControllerStub::Create(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerCreateRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerCreateResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Create(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::Start(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStartRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStartResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Start(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::Platform(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerPlatformResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Platform(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::Prepare(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PrepareRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::PrepareResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Prepare(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::Purge(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PurgeRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::PurgeResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Purge(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::UpdateResources(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::UpdateResourcesResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->UpdateResources(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::Stop(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStopRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStopResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Stop(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::Wait(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerWaitRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerWaitResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Wait(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStatusRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStatusResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Status(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::Status DummyControllerStub::Shutdown(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerShutdownResponse* response)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return ::grpc::Status::OK;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->Shutdown(context, request, response);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>*
|
||
|
|
+DummyControllerStub::AsyncCreateRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerCreateRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncCreateRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncCreateRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerCreateRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncCreateRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>*
|
||
|
|
+DummyControllerStub::AsyncStartRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStartRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncStartRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncStartRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStartRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncStartRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>*
|
||
|
|
+DummyControllerStub::AsyncPlatformRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncPlatformRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncPlatformRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncPlatformRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>*
|
||
|
|
+DummyControllerStub::AsyncPrepareRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PrepareRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncPrepareRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncPrepareRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PrepareRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncPrepareRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>*
|
||
|
|
+DummyControllerStub::AsyncPurgeRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PurgeRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncPurgeRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncPurgeRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PurgeRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncPurgeRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>*
|
||
|
|
+DummyControllerStub::AsyncUpdateResourcesRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncUpdateResourcesRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncUpdateResourcesRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncUpdateResourcesRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>*
|
||
|
|
+DummyControllerStub::AsyncStopRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStopRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncStopRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncStopRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStopRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncStopRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>*
|
||
|
|
+DummyControllerStub::AsyncWaitRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerWaitRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncWaitRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncWaitRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerWaitRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncWaitRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>*
|
||
|
|
+DummyControllerStub::AsyncStatusRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStatusRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncStatusRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncStatusRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStatusRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncStatusRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>*
|
||
|
|
+DummyControllerStub::AsyncShutdownRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->AsyncShutdownRaw(context, request, cq);
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>*
|
||
|
|
+DummyControllerStub::PrepareAsyncShutdownRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request, ::grpc::CompletionQueue* cq)
|
||
|
|
+{
|
||
|
|
+ if (g_controller_stub_mock == NULL) {
|
||
|
|
+ return NULL;
|
||
|
|
+ }
|
||
|
|
+ return g_controller_stub_mock->PrepareAsyncShutdownRaw(context, request, cq);
|
||
|
|
}
|
||
|
|
diff --git a/test/mocks/controller_stub_mock.h b/test/mocks/controller_stub_mock.h
|
||
|
|
index b3920bf8..85cb82bb 100644
|
||
|
|
--- a/test/mocks/controller_stub_mock.h
|
||
|
|
+++ b/test/mocks/controller_stub_mock.h
|
||
|
|
@@ -23,73 +23,212 @@
|
||
|
|
// MockControllerStub is a mock implementation of the Controller::StubInterface interface.
|
||
|
|
class MockControllerStub {
|
||
|
|
public:
|
||
|
|
- MOCK_METHOD3(Create, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::containerd::services::sandbox::v1::ControllerCreateResponse* response));
|
||
|
|
- MOCK_METHOD3(Start, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::containerd::services::sandbox::v1::ControllerStartResponse* response));
|
||
|
|
- MOCK_METHOD3(Platform, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::containerd::services::sandbox::v1::ControllerPlatformResponse* response));
|
||
|
|
- MOCK_METHOD3(Prepare, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::containerd::services::sandbox::v1::PrepareResponse* response));
|
||
|
|
- MOCK_METHOD3(Purge, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::containerd::services::sandbox::v1::PurgeResponse* response));
|
||
|
|
- MOCK_METHOD3(UpdateResources, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::containerd::services::sandbox::v1::UpdateResourcesResponse* response));
|
||
|
|
- MOCK_METHOD3(Stop, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::containerd::services::sandbox::v1::ControllerStopResponse* response));
|
||
|
|
- MOCK_METHOD3(Wait, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::containerd::services::sandbox::v1::ControllerWaitResponse* response));
|
||
|
|
- MOCK_METHOD3(Status, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::containerd::services::sandbox::v1::ControllerStatusResponse* response));
|
||
|
|
- MOCK_METHOD3(Shutdown, ::grpc::Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::containerd::services::sandbox::v1::ControllerShutdownResponse* response));
|
||
|
|
- MOCK_METHOD3(AsyncCreateRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncCreateRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncStartRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncStartRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncPlatformRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncPlatformRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncPrepareRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncPrepareRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncPurgeRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncPurgeRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncUpdateResourcesRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncUpdateResourcesRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncStopRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncStopRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncWaitRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncWaitRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncStatusRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncStatusRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(AsyncShutdownRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
- MOCK_METHOD3(PrepareAsyncShutdownRaw, ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>*(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(Create, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerCreateRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerCreateResponse* response));
|
||
|
|
+ MOCK_METHOD3(Start, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStartRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStartResponse* response));
|
||
|
|
+ MOCK_METHOD3(Platform, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerPlatformResponse* response));
|
||
|
|
+ MOCK_METHOD3(Prepare, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PrepareRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::PrepareResponse* response));
|
||
|
|
+ MOCK_METHOD3(Purge, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PurgeRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::PurgeResponse* response));
|
||
|
|
+ MOCK_METHOD3(UpdateResources, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::UpdateResourcesResponse* response));
|
||
|
|
+ MOCK_METHOD3(Stop, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStopRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStopResponse* response));
|
||
|
|
+ MOCK_METHOD3(Wait, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerWaitRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerWaitResponse* response));
|
||
|
|
+ MOCK_METHOD3(Status, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStatusRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStatusResponse* response));
|
||
|
|
+ MOCK_METHOD3(Shutdown, ::grpc::Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerShutdownResponse* response));
|
||
|
|
+ MOCK_METHOD3(AsyncCreateRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncCreateRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncStartRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncStartRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncPlatformRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncPlatformRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncPrepareRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncPrepareRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncPurgeRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncPurgeRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncUpdateResourcesRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncUpdateResourcesRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncStopRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncStopRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncWaitRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncWaitRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncStatusRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncStatusRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(AsyncShutdownRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
+ MOCK_METHOD3(PrepareAsyncShutdownRaw,
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>*
|
||
|
|
+ (::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq));
|
||
|
|
};
|
||
|
|
|
||
|
|
class DummyControllerStub: public containerd::services::sandbox::v1::Controller::StubInterface {
|
||
|
|
public:
|
||
|
|
DummyControllerStub() = default;
|
||
|
|
~DummyControllerStub() = default;
|
||
|
|
- ::grpc::Status Create(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::containerd::services::sandbox::v1::ControllerCreateResponse* response) override;
|
||
|
|
- ::grpc::Status Start(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::containerd::services::sandbox::v1::ControllerStartResponse* response) override;
|
||
|
|
- ::grpc::Status Platform(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::containerd::services::sandbox::v1::ControllerPlatformResponse* response) override;
|
||
|
|
- ::grpc::Status Prepare(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::containerd::services::sandbox::v1::PrepareResponse* response) override;
|
||
|
|
- ::grpc::Status Purge(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::containerd::services::sandbox::v1::PurgeResponse* response) override;
|
||
|
|
- ::grpc::Status UpdateResources(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::containerd::services::sandbox::v1::UpdateResourcesResponse* response) override;
|
||
|
|
- ::grpc::Status Stop(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::containerd::services::sandbox::v1::ControllerStopResponse* response) override;
|
||
|
|
- ::grpc::Status Wait(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::containerd::services::sandbox::v1::ControllerWaitResponse* response) override;
|
||
|
|
- ::grpc::Status Status(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::containerd::services::sandbox::v1::ControllerStatusResponse* response) override;
|
||
|
|
- ::grpc::Status Shutdown(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::containerd::services::sandbox::v1::ControllerShutdownResponse* response) override;
|
||
|
|
+ ::grpc::Status Create(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerCreateRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerCreateResponse* response) override;
|
||
|
|
+ ::grpc::Status Start(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStartRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStartResponse* response) override;
|
||
|
|
+ ::grpc::Status Platform(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerPlatformResponse* response) override;
|
||
|
|
+ ::grpc::Status Prepare(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PrepareRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::PrepareResponse* response) override;
|
||
|
|
+ ::grpc::Status Purge(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::PurgeResponse* response) override;
|
||
|
|
+ ::grpc::Status UpdateResources(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::UpdateResourcesResponse* response) override;
|
||
|
|
+ ::grpc::Status Stop(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStopRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStopResponse* response) override;
|
||
|
|
+ ::grpc::Status Wait(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerWaitRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerWaitResponse* response) override;
|
||
|
|
+ ::grpc::Status Status(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStatusRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerStatusResponse* response) override;
|
||
|
|
+ ::grpc::Status Shutdown(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request,
|
||
|
|
+ ::containerd::services::sandbox::v1::ControllerShutdownResponse* response) override;
|
||
|
|
private:
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>* AsyncCreateRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>* PrepareAsyncCreateRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerCreateRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>* AsyncStartRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>* PrepareAsyncStartRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStartRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>* AsyncPlatformRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>* PrepareAsyncPlatformRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerPlatformRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>* AsyncPrepareRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>* PrepareAsyncPrepareRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>* AsyncPurgeRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>* PrepareAsyncPurgeRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>* AsyncUpdateResourcesRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>* PrepareAsyncUpdateResourcesRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::UpdateResourcesRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>* AsyncStopRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>* PrepareAsyncStopRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>* AsyncWaitRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>* PrepareAsyncWaitRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>* AsyncStatusRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>* PrepareAsyncStatusRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStatusRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>* AsyncShutdownRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
- ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>* PrepareAsyncShutdownRaw(::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerShutdownRequest& request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>*
|
||
|
|
+ AsyncCreateRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerCreateRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerCreateResponse>*
|
||
|
|
+ PrepareAsyncCreateRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerCreateRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>*
|
||
|
|
+ AsyncStartRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStartRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStartResponse>*
|
||
|
|
+ PrepareAsyncStartRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStartRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>*
|
||
|
|
+ AsyncPlatformRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerPlatformResponse>*
|
||
|
|
+ PrepareAsyncPlatformRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerPlatformRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>* AsyncPrepareRaw(
|
||
|
|
+ ::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PrepareRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PrepareResponse>*
|
||
|
|
+ PrepareAsyncPrepareRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::PrepareRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>* AsyncPurgeRaw(
|
||
|
|
+ ::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::PurgeResponse>* PrepareAsyncPurgeRaw(
|
||
|
|
+ ::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::PurgeRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>*
|
||
|
|
+ AsyncUpdateResourcesRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::UpdateResourcesResponse>*
|
||
|
|
+ PrepareAsyncUpdateResourcesRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::UpdateResourcesRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>* AsyncStopRaw(
|
||
|
|
+ ::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerStopRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStopResponse>*
|
||
|
|
+ PrepareAsyncStopRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStopRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>* AsyncWaitRaw(
|
||
|
|
+ ::grpc::ClientContext* context, const ::containerd::services::sandbox::v1::ControllerWaitRequest &request,
|
||
|
|
+ ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerWaitResponse>*
|
||
|
|
+ PrepareAsyncWaitRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerWaitRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>*
|
||
|
|
+ AsyncStatusRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStatusRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerStatusResponse>*
|
||
|
|
+ PrepareAsyncStatusRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerStatusRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>*
|
||
|
|
+ AsyncShutdownRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
+ ::grpc::ClientAsyncResponseReaderInterface< ::containerd::services::sandbox::v1::ControllerShutdownResponse>*
|
||
|
|
+ PrepareAsyncShutdownRaw(::grpc::ClientContext* context,
|
||
|
|
+ const ::containerd::services::sandbox::v1::ControllerShutdownRequest &request, ::grpc::CompletionQueue* cq) override;
|
||
|
|
};
|
||
|
|
|
||
|
|
std::unique_ptr<DummyControllerStub> NewDummyControllerStub();
|
||
|
|
diff --git a/test/mocks/grpc_async_wait_call_mock.cc b/test/mocks/grpc_async_wait_call_mock.cc
|
||
|
|
index 034cc65c..5eef1794 100644
|
||
|
|
--- a/test/mocks/grpc_async_wait_call_mock.cc
|
||
|
|
+++ b/test/mocks/grpc_async_wait_call_mock.cc
|
||
|
|
@@ -34,7 +34,8 @@ SandboxerAsyncWaitCall::SandboxerAsyncWaitCall(std::shared_ptr<SandboxStatusCall
|
||
|
|
m_remove = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerAsyncWaitCall::Call(containerd::services::sandbox::v1::Controller::StubInterface &stub, grpc::CompletionQueue &cq) -> bool
|
||
|
|
+auto SandboxerAsyncWaitCall::Call(containerd::services::sandbox::v1::Controller::StubInterface &stub,
|
||
|
|
+ grpc::CompletionQueue &cq) -> bool
|
||
|
|
{
|
||
|
|
if (g_sandboxer_async_wait_call_mock == NULL) {
|
||
|
|
return true;
|
||
|
|
diff --git a/test/mocks/grpc_async_wait_call_mock.h b/test/mocks/grpc_async_wait_call_mock.h
|
||
|
|
index eb890ced..c79f998e 100644
|
||
|
|
--- a/test/mocks/grpc_async_wait_call_mock.h
|
||
|
|
+++ b/test/mocks/grpc_async_wait_call_mock.h
|
||
|
|
@@ -29,7 +29,7 @@ public:
|
||
|
|
MOCK_METHOD2(SandboxExitCallback, void(bool statusOK, const ControllerExitInfo &exitInfo));
|
||
|
|
MOCK_METHOD0(SandboxPendingCallback, void());
|
||
|
|
MOCK_METHOD0(SandboxReadyCallback, void());
|
||
|
|
- MOCK_METHOD0(GetSandboxId, const std::string &());
|
||
|
|
+ MOCK_METHOD0(GetSandboxId, const std::string & ());
|
||
|
|
};
|
||
|
|
|
||
|
|
void MockSandboxerAsyncWaitCall_SetMock(std::shared_ptr<SandboxerAsyncWaitCallMock> mock);
|
||
|
|
diff --git a/test/mocks/grpc_sandboxer_client_mock.cc b/test/mocks/grpc_sandboxer_client_mock.cc
|
||
|
|
index 0e57cfe5..03df9048 100644
|
||
|
|
--- a/test/mocks/grpc_sandboxer_client_mock.cc
|
||
|
|
+++ b/test/mocks/grpc_sandboxer_client_mock.cc
|
||
|
|
@@ -58,7 +58,8 @@ auto SandboxerClient::Start(const std::string &sandboxId, ControllerSandboxInfo
|
||
|
|
return g_sandboxer_client_mock->Start(sandboxId, sandboxInfo, error);
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::Platform(const std::string &sandboxId, ControllerPlatformInfo &platformInfo, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::Platform(const std::string &sandboxId, ControllerPlatformInfo &platformInfo,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
if (g_sandboxer_client_mock == NULL) {
|
||
|
|
return true;
|
||
|
|
@@ -66,7 +67,8 @@ auto SandboxerClient::Platform(const std::string &sandboxId, ControllerPlatformI
|
||
|
|
return g_sandboxer_client_mock->Platform(sandboxId, platformInfo, error);
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::Prepare(const std::string &sandboxId, const ControllerPrepareParams ¶ms, std::string &bundle, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::Prepare(const std::string &sandboxId, const ControllerPrepareParams ¶ms, std::string &bundle,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
if (g_sandboxer_client_mock == NULL) {
|
||
|
|
return true;
|
||
|
|
@@ -83,7 +85,8 @@ auto SandboxerClient::Purge(const std::string &sandboxId, const std::string &con
|
||
|
|
return g_sandboxer_client_mock->Purge(sandboxId, containerId, execId, error);
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::UpdateResources(const std::string &sandboxId, const ControllerUpdateResourcesParams ¶ms, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::UpdateResources(const std::string &sandboxId, const ControllerUpdateResourcesParams ¶ms,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
if (g_sandboxer_client_mock == NULL) {
|
||
|
|
return true;
|
||
|
|
@@ -99,7 +102,8 @@ auto SandboxerClient::Stop(const std::string &sandboxId, uint32_t timeoutSecs, E
|
||
|
|
return g_sandboxer_client_mock->Stop(sandboxId, timeoutSecs, error);
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::Wait(std::shared_ptr<SandboxStatusCallback> cb, const std::string &sandboxId, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::Wait(std::shared_ptr<SandboxStatusCallback> cb, const std::string &sandboxId,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
if (g_sandboxer_client_mock == NULL) {
|
||
|
|
return true;
|
||
|
|
@@ -107,7 +111,8 @@ auto SandboxerClient::Wait(std::shared_ptr<SandboxStatusCallback> cb, const std:
|
||
|
|
return g_sandboxer_client_mock->Wait(cb, sandboxId, error);
|
||
|
|
}
|
||
|
|
|
||
|
|
-auto SandboxerClient::Status(const std::string &sandboxId, bool verbose, ControllerSandboxStatus &sandboxStatus, Errors &error) -> bool
|
||
|
|
+auto SandboxerClient::Status(const std::string &sandboxId, bool verbose, ControllerSandboxStatus &sandboxStatus,
|
||
|
|
+ Errors &error) -> bool
|
||
|
|
{
|
||
|
|
if (g_sandboxer_client_mock == NULL) {
|
||
|
|
return true;
|
||
|
|
diff --git a/test/mocks/grpc_sandboxer_client_mock.h b/test/mocks/grpc_sandboxer_client_mock.h
|
||
|
|
index a3dcd690..ac06462a 100644
|
||
|
|
--- a/test/mocks/grpc_sandboxer_client_mock.h
|
||
|
|
+++ b/test/mocks/grpc_sandboxer_client_mock.h
|
||
|
|
@@ -28,12 +28,16 @@ public:
|
||
|
|
MOCK_METHOD3(Create, bool(const std::string &sandboxId, const ControllerCreateParams ¶ms, Errors &error));
|
||
|
|
MOCK_METHOD3(Start, bool(const std::string &sandboxId, ControllerSandboxInfo &sandboxInfo, Errors &error));
|
||
|
|
MOCK_METHOD3(Platform, bool(const std::string &sandboxId, ControllerPlatformInfo &platformInfo, Errors &error));
|
||
|
|
- MOCK_METHOD4(Prepare, bool(const std::string &sandboxId, const ControllerPrepareParams ¶ms, std::string &bundle, Errors &error));
|
||
|
|
- MOCK_METHOD4(Purge, bool(const std::string &sandboxId, const std::string &containerId, const std::string &execId, Errors &error));
|
||
|
|
- MOCK_METHOD3(UpdateResources, bool(const std::string &sandboxId, const ControllerUpdateResourcesParams ¶ms, Errors &error));
|
||
|
|
+ MOCK_METHOD4(Prepare, bool(const std::string &sandboxId, const ControllerPrepareParams ¶ms, std::string &bundle,
|
||
|
|
+ Errors &error));
|
||
|
|
+ MOCK_METHOD4(Purge, bool(const std::string &sandboxId, const std::string &containerId, const std::string &execId,
|
||
|
|
+ Errors &error));
|
||
|
|
+ MOCK_METHOD3(UpdateResources, bool(const std::string &sandboxId, const ControllerUpdateResourcesParams ¶ms,
|
||
|
|
+ Errors &error));
|
||
|
|
MOCK_METHOD3(Stop, bool(const std::string &sandboxId, uint32_t timeoutSecs, Errors &error));
|
||
|
|
MOCK_METHOD3(Wait, bool(std::shared_ptr<SandboxStatusCallback> cb, const std::string &sandboxId, Errors &error));
|
||
|
|
- MOCK_METHOD4(Status, bool(const std::string &sandboxId, bool verbose, ControllerSandboxStatus &sandboxStatus, Errors &error));
|
||
|
|
+ MOCK_METHOD4(Status, bool(const std::string &sandboxId, bool verbose, ControllerSandboxStatus &sandboxStatus,
|
||
|
|
+ Errors &error));
|
||
|
|
MOCK_METHOD2(Shutdown, bool(const std::string &sandboxId, Errors &error));
|
||
|
|
};
|
||
|
|
|
||
|
|
diff --git a/test/mocks/grpc_sandboxer_monitor_mock.cc b/test/mocks/grpc_sandboxer_monitor_mock.cc
|
||
|
|
index e307e0ae..b3ddda87 100644
|
||
|
|
--- a/test/mocks/grpc_sandboxer_monitor_mock.cc
|
||
|
|
+++ b/test/mocks/grpc_sandboxer_monitor_mock.cc
|
||
|
|
@@ -19,7 +19,7 @@ static std::shared_ptr<SandboxerClientMonitorMock> g_sandboxer_client_monitor_mo
|
||
|
|
|
||
|
|
|
||
|
|
SandboxerClientMonitor::SandboxerClientMonitor(std::shared_ptr<grpc::Channel> channel, const std::string &sandboxer):
|
||
|
|
- m_channel(channel), m_sandboxer(sandboxer) ,m_teardown(false) {}
|
||
|
|
+ m_channel(channel), m_sandboxer(sandboxer), m_teardown(false) {}
|
||
|
|
|
||
|
|
void SandboxerClientMonitor::Start()
|
||
|
|
{
|
||
|
|
diff --git a/test/mocks/isulad_config_mock.h b/test/mocks/isulad_config_mock.h
|
||
|
|
index 6a92fc13..6c6ff7f1 100644
|
||
|
|
--- a/test/mocks/isulad_config_mock.h
|
||
|
|
+++ b/test/mocks/isulad_config_mock.h
|
||
|
|
@@ -40,7 +40,7 @@ public:
|
||
|
|
MOCK_METHOD0(InitIsuladDaemonConstants, int (void));
|
||
|
|
MOCK_METHOD0(GetIsuladDaemonConstants, isulad_daemon_constants * (void));
|
||
|
|
MOCK_METHOD0(ConfGetIsuladUsernsRemap, char *(void));
|
||
|
|
- MOCK_METHOD0(ConfGetServerConf, struct service_arguments *(void));
|
||
|
|
+ MOCK_METHOD0(ConfGetServerConf, struct service_arguments * (void));
|
||
|
|
MOCK_METHOD0(ConfGetSandboxRootPath, char *(void));
|
||
|
|
MOCK_METHOD0(ConfGetSandboxStatePath, char *(void));
|
||
|
|
};
|
||
|
|
diff --git a/test/mocks/sandbox_mock.cc b/test/mocks/sandbox_mock.cc
|
||
|
|
index e5aefdda..9db57a93 100644
|
||
|
|
--- a/test/mocks/sandbox_mock.cc
|
||
|
|
+++ b/test/mocks/sandbox_mock.cc
|
||
|
|
@@ -77,7 +77,7 @@ const std::string &Sandbox::GetRuntimeHandle() const
|
||
|
|
return defaultStr;
|
||
|
|
}
|
||
|
|
|
||
|
|
-const runtime::v1::PodSandboxConfig & Sandbox::GetSandboxConfig() const
|
||
|
|
+const runtime::v1::PodSandboxConfig &Sandbox::GetSandboxConfig() const
|
||
|
|
{
|
||
|
|
if (g_sandbox_mock != nullptr) {
|
||
|
|
return g_sandbox_mock->GetSandboxConfig();
|
||
|
|
diff --git a/test/mocks/sandbox_mock.h b/test/mocks/sandbox_mock.h
|
||
|
|
index 341042e9..98f40ad2 100644
|
||
|
|
--- a/test/mocks/sandbox_mock.h
|
||
|
|
+++ b/test/mocks/sandbox_mock.h
|
||
|
|
@@ -31,7 +31,7 @@ public:
|
||
|
|
MOCK_METHOD0(GetName, const std::string & ());
|
||
|
|
MOCK_METHOD0(GetSandboxer, const std::string & ());
|
||
|
|
MOCK_METHOD0(GetRuntimeHandle, const std::string & ());
|
||
|
|
- MOCK_METHOD0(GetSandboxConfig, const runtime::v1::PodSandboxConfig &());
|
||
|
|
+ MOCK_METHOD0(GetSandboxConfig, const runtime::v1::PodSandboxConfig & ());
|
||
|
|
MOCK_METHOD0(GetMutableSandboxConfig, std::shared_ptr<runtime::v1::PodSandboxConfig>());
|
||
|
|
MOCK_METHOD0(GetRootDir, const std::string & ());
|
||
|
|
MOCK_METHOD0(GetStateDir, std::string & ());
|
||
|
|
diff --git a/test/mocks/service_container_api_mock.h b/test/mocks/service_container_api_mock.h
|
||
|
|
index 350a2fff..9a39f483 100644
|
||
|
|
--- a/test/mocks/service_container_api_mock.h
|
||
|
|
+++ b/test/mocks/service_container_api_mock.h
|
||
|
|
@@ -23,7 +23,7 @@
|
||
|
|
|
||
|
|
class MockServiceContainerApi {
|
||
|
|
public:
|
||
|
|
- MOCK_METHOD3(InspectContainer, container_inspect *(const char *id, int timeout, bool with_host_config));
|
||
|
|
+ MOCK_METHOD3(InspectContainer, container_inspect * (const char *id, int timeout, bool with_host_config));
|
||
|
|
};
|
||
|
|
|
||
|
|
void MockServiceContainerApi_SetMock(std::shared_ptr<MockServiceContainerApi> mock);
|
||
|
|
diff --git a/test/mocks/shim_controller_mock.cc b/test/mocks/shim_controller_mock.cc
|
||
|
|
index 88694dbe..e0ffc563 100644
|
||
|
|
--- a/test/mocks/shim_controller_mock.cc
|
||
|
|
+++ b/test/mocks/shim_controller_mock.cc
|
||
|
|
@@ -117,7 +117,8 @@ bool ShimController::Wait(std::shared_ptr<SandboxStatusCallback> cb, const std::
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-std::unique_ptr<ControllerSandboxStatus> ShimController::Status(const std::string &sandboxId, bool verbose, Errors &error)
|
||
|
|
+std::unique_ptr<ControllerSandboxStatus> ShimController::Status(const std::string &sandboxId, bool verbose,
|
||
|
|
+ Errors &error)
|
||
|
|
{
|
||
|
|
if (g_shim_controller_mock != nullptr) {
|
||
|
|
return g_shim_controller_mock->Status(sandboxId, verbose, error);
|
||
|
|
@@ -133,7 +134,8 @@ bool ShimController::Shutdown(const std::string &sandboxId, Errors &error)
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
-bool ShimController::UpdateNetworkSettings(const std::string &sandboxId, const std::string &networkSettings, Errors &error)
|
||
|
|
+bool ShimController::UpdateNetworkSettings(const std::string &sandboxId, const std::string &networkSettings,
|
||
|
|
+ Errors &error)
|
||
|
|
{
|
||
|
|
if (g_shim_controller_mock != nullptr) {
|
||
|
|
return g_shim_controller_mock->UpdateNetworkSettings(sandboxId, networkSettings, error);
|
||
|
|
diff --git a/test/mocks/shim_controller_mock.h b/test/mocks/shim_controller_mock.h
|
||
|
|
index 3be05246..6d0de591 100644
|
||
|
|
--- a/test/mocks/shim_controller_mock.h
|
||
|
|
+++ b/test/mocks/shim_controller_mock.h
|
||
|
|
@@ -39,15 +39,17 @@ public:
|
||
|
|
const ControllerPrepareParams ¶ms,
|
||
|
|
Errors &error));
|
||
|
|
MOCK_METHOD4(Purge, bool(const std::string &sandboxId, const std::string &containerId,
|
||
|
|
- const std::string &execId, Errors &error));
|
||
|
|
+ const std::string &execId, Errors &error));
|
||
|
|
MOCK_METHOD3(UpdateResources, bool(const std::string &sandboxId,
|
||
|
|
const ControllerUpdateResourcesParams ¶ms,
|
||
|
|
Errors &error));
|
||
|
|
MOCK_METHOD3(Stop, bool(const std::string &sandboxId, uint32_t timeoutSecs, Errors &error));
|
||
|
|
MOCK_METHOD3(Wait, bool(std::shared_ptr<SandboxStatusCallback> cb, const std::string &sandboxId, Errors &error));
|
||
|
|
- MOCK_METHOD3(Status, std::unique_ptr<ControllerSandboxStatus>(const std::string &sandboxId, bool verbose, Errors &error));
|
||
|
|
+ MOCK_METHOD3(Status, std::unique_ptr<ControllerSandboxStatus>(const std::string &sandboxId, bool verbose,
|
||
|
|
+ Errors &error));
|
||
|
|
MOCK_METHOD2(Shutdown, bool(const std::string &sandboxId, Errors &error));
|
||
|
|
- MOCK_METHOD3(UpdateNetworkSettings, bool(const std::string &sandboxId, const std::string &networkSettings, Errors &error));
|
||
|
|
+ MOCK_METHOD3(UpdateNetworkSettings, bool(const std::string &sandboxId, const std::string &networkSettings,
|
||
|
|
+ Errors &error));
|
||
|
|
};
|
||
|
|
|
||
|
|
void MockShimController_SetMock(std::shared_ptr<MockShimController> mock);
|
||
|
|
diff --git a/test/network/cni_operate/cni_operate_ut.cc b/test/network/cni_operate/cni_operate_ut.cc
|
||
|
|
index 4194641b..f61fee57 100644
|
||
|
|
--- a/test/network/cni_operate/cni_operate_ut.cc
|
||
|
|
+++ b/test/network/cni_operate/cni_operate_ut.cc
|
||
|
|
@@ -47,28 +47,28 @@ using namespace std;
|
||
|
|
|
||
|
|
extern "C" {
|
||
|
|
DECLARE_WRAPPER(cni_cache_read, cni_cached_info *,
|
||
|
|
- (const char *cache_dir, const char *net_name, const struct runtime_conf *rc));
|
||
|
|
+ (const char *cache_dir, const char *net_name, const struct runtime_conf *rc));
|
||
|
|
DEFINE_WRAPPER(cni_cache_read, cni_cached_info *,
|
||
|
|
- (const char *cache_dir, const char *net_name, const struct runtime_conf *rc),
|
||
|
|
- (cache_dir, net_name, rc));
|
||
|
|
+ (const char *cache_dir, const char *net_name, const struct runtime_conf *rc),
|
||
|
|
+ (cache_dir, net_name, rc));
|
||
|
|
|
||
|
|
- DECLARE_WRAPPER(cni_check_network_list, int,
|
||
|
|
- (const struct cni_network_list_conf *list, const struct runtime_conf *rc, struct cni_opt_result **p_result));
|
||
|
|
+ DECLARE_WRAPPER(cni_check_network_list, int,
|
||
|
|
+ (const struct cni_network_list_conf *list, const struct runtime_conf *rc, struct cni_opt_result **p_result));
|
||
|
|
DEFINE_WRAPPER(cni_check_network_list, int,
|
||
|
|
- (const struct cni_network_list_conf *list, const struct runtime_conf *rc, struct cni_opt_result **p_result),
|
||
|
|
- (list, rc, p_result));
|
||
|
|
+ (const struct cni_network_list_conf *list, const struct runtime_conf *rc, struct cni_opt_result **p_result),
|
||
|
|
+ (list, rc, p_result));
|
||
|
|
|
||
|
|
- DECLARE_WRAPPER(util_atomic_write_file, int,
|
||
|
|
- (const char *fname, const char *content, size_t content_len, mode_t mode, bool sync));
|
||
|
|
+ DECLARE_WRAPPER(util_atomic_write_file, int,
|
||
|
|
+ (const char *fname, const char *content, size_t content_len, mode_t mode, bool sync));
|
||
|
|
DEFINE_WRAPPER(util_atomic_write_file, int,
|
||
|
|
- (const char *fname, const char *content, size_t content_len, mode_t mode, bool sync),
|
||
|
|
- (fname, content, content_len, mode, sync));
|
||
|
|
-
|
||
|
|
- DECLARE_WRAPPER(cni_del_network_list, int,
|
||
|
|
- (const struct cni_network_list_conf *list, const struct runtime_conf *rc, struct cni_opt_result **p_result));
|
||
|
|
+ (const char *fname, const char *content, size_t content_len, mode_t mode, bool sync),
|
||
|
|
+ (fname, content, content_len, mode, sync));
|
||
|
|
+
|
||
|
|
+ DECLARE_WRAPPER(cni_del_network_list, int,
|
||
|
|
+ (const struct cni_network_list_conf *list, const struct runtime_conf *rc, struct cni_opt_result **p_result));
|
||
|
|
DEFINE_WRAPPER(cni_del_network_list, int,
|
||
|
|
- (const struct cni_network_list_conf *list, const struct runtime_conf *rc, struct cni_opt_result **p_result),
|
||
|
|
- (list, rc, p_result));
|
||
|
|
+ (const struct cni_network_list_conf *list, const struct runtime_conf *rc, struct cni_opt_result **p_result),
|
||
|
|
+ (list, rc, p_result));
|
||
|
|
|
||
|
|
DECLARE_WRAPPER(calloc, void *, (size_t nmemb, size_t size));
|
||
|
|
DEFINE_WRAPPER(calloc, void *, (size_t nmemb, size_t size), (nmemb, size));
|
||
|
|
@@ -90,19 +90,19 @@ public:
|
||
|
|
m_list.bytes = cni_net_conf_list_generate_json(m_list.list, &ctx, &jerr);
|
||
|
|
m_aliases_array = invoke_network_get_aliases_from_cached_info(m_info);
|
||
|
|
m_manager = {
|
||
|
|
- .id = (char *)"827bdd4b0b4e28d24dbaf3c563687ff6ffd23cd8fda38cadf818ac324fe5de3e",
|
||
|
|
+ .id = (char *)"827bdd4b0b4e28d24dbaf3c563687ff6ffd23cd8fda38cadf818ac324fe5de3e",
|
||
|
|
.netns_path = (char *)"/var/run/netns/isulacni-7dbc2c7d85279d5a",
|
||
|
|
.ifname = (char *)"eth0"
|
||
|
|
};
|
||
|
|
m_manager.annotations = map_new(MAP_STR_STR, MAP_DEFAULT_CMP_FUNC, MAP_DEFAULT_FREE_FUNC);
|
||
|
|
-
|
||
|
|
+
|
||
|
|
ctx = { OPT_PARSE_STRICT, 0 };
|
||
|
|
aliases_json = cni_array_of_strings_container_generate_json(m_aliases_array, &ctx, &jerr);
|
||
|
|
if (aliases_json == nullptr) {
|
||
|
|
printf("Parse aliases_json failed: %s", jerr);
|
||
|
|
}
|
||
|
|
(void)map_replace(m_manager.annotations, (void *)aliases_str, (void *)aliases_json);
|
||
|
|
-
|
||
|
|
+
|
||
|
|
free(aliases_json);
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -140,7 +140,7 @@ TEST_F(CniOperateUnitTest, test_check_network_plane)
|
||
|
|
MOCK_CLEAR(calloc);
|
||
|
|
}
|
||
|
|
|
||
|
|
- {
|
||
|
|
+ {
|
||
|
|
// cached info will be free in check_network_plane
|
||
|
|
MOCK_SET(cni_cache_read, invoke_network_get_cached_info((char *)CNI_CACHE_INFO));
|
||
|
|
MOCK_SET(cni_check_network_list, 0);
|
||
|
|
diff --git a/test/network/network_mock.cc b/test/network/network_mock.cc
|
||
|
|
index 1fa1cc2e..27422b5f 100644
|
||
|
|
--- a/test/network/network_mock.cc
|
||
|
|
+++ b/test/network/network_mock.cc
|
||
|
|
@@ -64,7 +64,7 @@ cni_array_of_strings_container *invoke_network_get_aliases_from_cached_info(cni_
|
||
|
|
aliases_array->items = (char **)isula_smart_calloc_s(sizeof(char *), info->aliases_len);
|
||
|
|
EXPECT_THAT(aliases_array->items, testing::NotNull()) << "Out of memory" << std::endl;
|
||
|
|
for (size_t i = 0; i < info->aliases_len; i++) {
|
||
|
|
- aliases_array->items[i]= util_strdup_s(info->aliases[i]);
|
||
|
|
+ aliases_array->items[i] = util_strdup_s(info->aliases[i]);
|
||
|
|
aliases_array->len += 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/test/sandbox/controller/controller_common.cc b/test/sandbox/controller/controller_common.cc
|
||
|
|
index ed9c84d7..5f870c34 100644
|
||
|
|
--- a/test/sandbox/controller/controller_common.cc
|
||
|
|
+++ b/test/sandbox/controller/controller_common.cc
|
||
|
|
@@ -15,7 +15,8 @@
|
||
|
|
|
||
|
|
#include "controller_common.h"
|
||
|
|
|
||
|
|
-std::unique_ptr<sandbox::ControllerMountInfo> CreateTestMountInfo() {
|
||
|
|
+std::unique_ptr<sandbox::ControllerMountInfo> CreateTestMountInfo()
|
||
|
|
+{
|
||
|
|
std::unique_ptr<sandbox::ControllerMountInfo> mountInfo(new sandbox::ControllerMountInfo());
|
||
|
|
mountInfo->source = "/rootfs";
|
||
|
|
mountInfo->destination = "/rootfs";
|
||
|
|
@@ -23,7 +24,8 @@ std::unique_ptr<sandbox::ControllerMountInfo> CreateTestMountInfo() {
|
||
|
|
return mountInfo;
|
||
|
|
}
|
||
|
|
|
||
|
|
-std::unique_ptr<sandbox::ControllerCreateParams> CreateTestCreateParams() {
|
||
|
|
+std::unique_ptr<sandbox::ControllerCreateParams> CreateTestCreateParams()
|
||
|
|
+{
|
||
|
|
std::unique_ptr<sandbox::ControllerCreateParams> params(new sandbox::ControllerCreateParams());
|
||
|
|
params->config = std::make_shared<runtime::v1::PodSandboxConfig>();
|
||
|
|
params->netNSPath = "/proc/1/ns/net";
|
||
|
|
@@ -31,7 +33,8 @@ std::unique_ptr<sandbox::ControllerCreateParams> CreateTestCreateParams() {
|
||
|
|
return params;
|
||
|
|
}
|
||
|
|
|
||
|
|
-std::unique_ptr<sandbox::ControllerStreamInfo> CreateTestStreamInfo() {
|
||
|
|
+std::unique_ptr<sandbox::ControllerStreamInfo> CreateTestStreamInfo()
|
||
|
|
+{
|
||
|
|
std::unique_ptr<sandbox::ControllerStreamInfo> streamInfo(new sandbox::ControllerStreamInfo());
|
||
|
|
streamInfo->stdin = "/tmp/stdin";
|
||
|
|
streamInfo->stdout = "/tmp/stdout";
|
||
|
|
@@ -40,7 +43,8 @@ std::unique_ptr<sandbox::ControllerStreamInfo> CreateTestStreamInfo() {
|
||
|
|
return streamInfo;
|
||
|
|
}
|
||
|
|
|
||
|
|
-std::unique_ptr<sandbox::ControllerPrepareParams> CreateTestPrepareParams() {
|
||
|
|
+std::unique_ptr<sandbox::ControllerPrepareParams> CreateTestPrepareParams()
|
||
|
|
+{
|
||
|
|
std::unique_ptr<sandbox::ControllerPrepareParams> params(new sandbox::ControllerPrepareParams());
|
||
|
|
params->containerId = DUMMY_CONTAINER_ID;
|
||
|
|
params->execId = DUMMY_EXEC_ID;
|
||
|
|
@@ -51,7 +55,9 @@ std::unique_ptr<sandbox::ControllerPrepareParams> CreateTestPrepareParams() {
|
||
|
|
return params;
|
||
|
|
}
|
||
|
|
|
||
|
|
-std::unique_ptr<sandbox::ControllerUpdateResourcesParams> CreateTestUpdateResourcesParams(google::protobuf::Map<std::string, std::string> &annotations) {
|
||
|
|
+std::unique_ptr<sandbox::ControllerUpdateResourcesParams> CreateTestUpdateResourcesParams(
|
||
|
|
+ google::protobuf::Map<std::string, std::string> &annotations)
|
||
|
|
+{
|
||
|
|
std::unique_ptr<std::string> resources(new std::string("{cpu: 12}"));
|
||
|
|
std::unique_ptr<sandbox::ControllerUpdateResourcesParams> params(
|
||
|
|
new sandbox::ControllerUpdateResourcesParams{DUMMY_SANDBOX_ID, std::move(resources), annotations}
|
||
|
|
diff --git a/test/sandbox/controller/controller_common.h b/test/sandbox/controller/controller_common.h
|
||
|
|
index e5a22e34..c01ae83c 100644
|
||
|
|
--- a/test/sandbox/controller/controller_common.h
|
||
|
|
+++ b/test/sandbox/controller/controller_common.h
|
||
|
|
@@ -33,6 +33,7 @@ std::unique_ptr<sandbox::ControllerStreamInfo> CreateTestStreamInfo();
|
||
|
|
|
||
|
|
std::unique_ptr<sandbox::ControllerPrepareParams> CreateTestPrepareParams();
|
||
|
|
|
||
|
|
-std::unique_ptr<sandbox::ControllerUpdateResourcesParams> CreateTestUpdateResourcesParams(google::protobuf::Map<std::string, std::string> &annotations);
|
||
|
|
+std::unique_ptr<sandbox::ControllerUpdateResourcesParams> CreateTestUpdateResourcesParams(
|
||
|
|
+ google::protobuf::Map<std::string, std::string> &annotations);
|
||
|
|
|
||
|
|
#endif // _ISULAD_TEST_SANDBOX_CONTROLLER_CONTROLLER_COMMON_H
|
||
|
|
\ No newline at end of file
|
||
|
|
diff --git a/test/sandbox/controller/manager/controller_manager_ut.cc b/test/sandbox/controller/manager/controller_manager_ut.cc
|
||
|
|
index 8467fbd4..705baaca 100644
|
||
|
|
--- a/test/sandbox/controller/manager/controller_manager_ut.cc
|
||
|
|
+++ b/test/sandbox/controller/manager/controller_manager_ut.cc
|
||
|
|
@@ -33,11 +33,13 @@ public:
|
||
|
|
|
||
|
|
class ControllerManagerTest : public testing::Test {
|
||
|
|
protected:
|
||
|
|
- void SetUp() override {
|
||
|
|
+ void SetUp() override
|
||
|
|
+ {
|
||
|
|
MockIsuladConf_SetMock(isuladConfMock.get());
|
||
|
|
}
|
||
|
|
|
||
|
|
- void TearDown() override {
|
||
|
|
+ void TearDown() override
|
||
|
|
+ {
|
||
|
|
MockIsuladConf_SetMock(nullptr);
|
||
|
|
static_cast<ControllerManagerWrapper*>(ControllerManagerWrapper::GetInstance())->Clear();
|
||
|
|
}
|
||
|
|
@@ -45,7 +47,8 @@ protected:
|
||
|
|
std::unique_ptr<MockIsuladConf> isuladConfMock = std::unique_ptr<MockIsuladConf>(new MockIsuladConf());
|
||
|
|
};
|
||
|
|
|
||
|
|
-static struct service_arguments *CreateDummyServerConf(const std::string &conf) {
|
||
|
|
+static struct service_arguments *CreateDummyServerConf(const std::string &conf)
|
||
|
|
+{
|
||
|
|
parser_error err = nullptr;
|
||
|
|
struct service_arguments *args = (struct service_arguments *)util_common_calloc_s(sizeof(struct service_arguments));
|
||
|
|
if (args == nullptr) {
|
||
|
|
@@ -59,7 +62,8 @@ static struct service_arguments *CreateDummyServerConf(const std::string &conf)
|
||
|
|
return args;
|
||
|
|
}
|
||
|
|
|
||
|
|
-static void FreeDummyServerconf(struct service_arguments *args) {
|
||
|
|
+static void FreeDummyServerconf(struct service_arguments *args)
|
||
|
|
+{
|
||
|
|
if (args != nullptr) {
|
||
|
|
free_isulad_daemon_configs(args->json_confs);
|
||
|
|
free(args);
|
||
|
|
@@ -70,7 +74,8 @@ static void FreeDummyServerconf(struct service_arguments *args) {
|
||
|
|
TEST_F(ControllerManagerTest, InitTestSucceed)
|
||
|
|
{
|
||
|
|
Errors err;
|
||
|
|
- const std::string daemonConfig = "{\"cri-sandboxers\": {\"kuasar\": {\"name\": \"vmm\",\"address\": \"/run/vmm-sandboxer.sock\"}}}";
|
||
|
|
+ const std::string daemonConfig =
|
||
|
|
+ "{\"cri-sandboxers\": {\"kuasar\": {\"name\": \"vmm\",\"address\": \"/run/vmm-sandboxer.sock\"}}}";
|
||
|
|
struct service_arguments *args = CreateDummyServerConf(daemonConfig);
|
||
|
|
ASSERT_NE(args, nullptr);
|
||
|
|
EXPECT_CALL(*isuladConfMock, ConfGetServerConf()).Times(1).WillOnce(testing::Return(args));
|
||
|
|
@@ -130,7 +135,8 @@ TEST_F(ControllerManagerTest, InitTestSucceedWithNullConfig)
|
||
|
|
TEST_F(ControllerManagerTest, InitTestFailedWithDupShimConfig)
|
||
|
|
{
|
||
|
|
Errors err;
|
||
|
|
- const std::string daemonConfig = "{\"cri-sandboxers\": {\"kuasar\": {\"name\": \"shim\",\"address\": \"/run/vmm-sandboxer.sock\"}}}";
|
||
|
|
+ const std::string daemonConfig =
|
||
|
|
+ "{\"cri-sandboxers\": {\"kuasar\": {\"name\": \"shim\",\"address\": \"/run/vmm-sandboxer.sock\"}}}";
|
||
|
|
struct service_arguments *args = CreateDummyServerConf(daemonConfig);
|
||
|
|
ASSERT_NE(args, nullptr);
|
||
|
|
EXPECT_CALL(*isuladConfMock, ConfGetServerConf()).Times(1).WillOnce(testing::Return(args));
|
||
|
|
@@ -148,7 +154,8 @@ TEST_F(ControllerManagerTest, InitTestFailedWithDupShimConfig)
|
||
|
|
TEST_F(ControllerManagerTest, InitTestFailedWithDupKuasarConfig)
|
||
|
|
{
|
||
|
|
Errors err;
|
||
|
|
- const std::string daemonConfig = "{\"cri-sandboxers\": {\"kuasar\": {\"name\": \"vmm1\",\"address\": \"/run/vmm1-sandboxer.sock\"},\"kuasar\": {\"name\": \"vmm2\",\"address\": \"/run/vmm2-sandboxer.sock\"}}}";
|
||
|
|
+ const std::string daemonConfig =
|
||
|
|
+ "{\"cri-sandboxers\": {\"kuasar\": {\"name\": \"vmm1\",\"address\": \"/run/vmm1-sandboxer.sock\"},\"kuasar\": {\"name\": \"vmm2\",\"address\": \"/run/vmm2-sandboxer.sock\"}}}";
|
||
|
|
struct service_arguments *args = CreateDummyServerConf(daemonConfig);
|
||
|
|
ASSERT_NE(args, nullptr);
|
||
|
|
EXPECT_CALL(*isuladConfMock, ConfGetServerConf()).Times(1).WillOnce(testing::Return(args));
|
||
|
|
@@ -162,7 +169,8 @@ TEST_F(ControllerManagerTest, InitTestFailedWithDupKuasarConfig)
|
||
|
|
TEST_F(ControllerManagerTest, InitTestFailedWithDupNameConfig)
|
||
|
|
{
|
||
|
|
Errors err;
|
||
|
|
- const std::string daemonConfig = "{\"cri-sandboxers\": {\"kuasar1\": {\"name\": \"vmm\",\"address\": \"/run/vmm1-sandboxer.sock\"},\"kuasar2\": {\"name\": \"vmm\",\"address\": \"/run/vmm2-sandboxer.sock\"}}}";
|
||
|
|
+ const std::string daemonConfig =
|
||
|
|
+ "{\"cri-sandboxers\": {\"kuasar1\": {\"name\": \"vmm\",\"address\": \"/run/vmm1-sandboxer.sock\"},\"kuasar2\": {\"name\": \"vmm\",\"address\": \"/run/vmm2-sandboxer.sock\"}}}";
|
||
|
|
struct service_arguments *args = CreateDummyServerConf(daemonConfig);
|
||
|
|
ASSERT_NE(args, nullptr);
|
||
|
|
EXPECT_CALL(*isuladConfMock, ConfGetServerConf()).Times(1).WillOnce(testing::Return(args));
|
||
|
|
@@ -176,7 +184,8 @@ TEST_F(ControllerManagerTest, InitTestFailedWithDupNameConfig)
|
||
|
|
TEST_F(ControllerManagerTest, InitTestFailedWithDupInit)
|
||
|
|
{
|
||
|
|
Errors err;
|
||
|
|
- const std::string daemonConfig = "{\"cri-sandboxers\": {\"kuasar\": {\"name\": \"vmm\",\"address\": \"/run/vmm-sandboxer.sock\"}}}";
|
||
|
|
+ const std::string daemonConfig =
|
||
|
|
+ "{\"cri-sandboxers\": {\"kuasar\": {\"name\": \"vmm\",\"address\": \"/run/vmm-sandboxer.sock\"}}}";
|
||
|
|
struct service_arguments *args = CreateDummyServerConf(daemonConfig);
|
||
|
|
ASSERT_NE(args, nullptr);
|
||
|
|
EXPECT_CALL(*isuladConfMock, ConfGetServerConf()).Times(2).WillRepeatedly(testing::Return(args));
|
||
|
|
diff --git a/test/sandbox/controller/sandboxer/async_wait_call/async_wait_call_ut.cc b/test/sandbox/controller/sandboxer/async_wait_call/async_wait_call_ut.cc
|
||
|
|
index 0596771a..1a58344c 100644
|
||
|
|
--- a/test/sandbox/controller/sandboxer/async_wait_call/async_wait_call_ut.cc
|
||
|
|
+++ b/test/sandbox/controller/sandboxer/async_wait_call/async_wait_call_ut.cc
|
||
|
|
@@ -35,17 +35,20 @@ public:
|
||
|
|
|
||
|
|
class AsyncWaitCallTest : public testing::Test {
|
||
|
|
protected:
|
||
|
|
- void SetUp() override {
|
||
|
|
+ void SetUp() override
|
||
|
|
+ {
|
||
|
|
m_sandboxId = "8040f13d54889ad4cd";
|
||
|
|
m_sandboxer = "test_sandboxer";
|
||
|
|
m_callback = std::shared_ptr<DummyCallback>(new DummyCallback());
|
||
|
|
- m_call = std::unique_ptr<sandbox::SandboxerAsyncWaitCall>(new sandbox::SandboxerAsyncWaitCall(m_callback, m_sandboxId, m_sandboxer));
|
||
|
|
+ m_call = std::unique_ptr<sandbox::SandboxerAsyncWaitCall>(new sandbox::SandboxerAsyncWaitCall(m_callback, m_sandboxId,
|
||
|
|
+ m_sandboxer));
|
||
|
|
m_stub = std::unique_ptr<DummyControllerStub>(NewDummyControllerStub());
|
||
|
|
m_stub_mock = std::make_shared<MockControllerStub>();
|
||
|
|
MockControllerStub_SetMock(m_stub_mock);
|
||
|
|
}
|
||
|
|
|
||
|
|
- void TearDown() override {
|
||
|
|
+ void TearDown() override
|
||
|
|
+ {
|
||
|
|
MockControllerStub_SetMock(nullptr);
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/test/sandbox/controller/sandboxer/async_wait_call/dummy_monitor_utils.h b/test/sandbox/controller/sandboxer/async_wait_call/dummy_monitor_utils.h
|
||
|
|
index 3a12d042..7e98d844 100644
|
||
|
|
--- a/test/sandbox/controller/sandboxer/async_wait_call/dummy_monitor_utils.h
|
||
|
|
+++ b/test/sandbox/controller/sandboxer/async_wait_call/dummy_monitor_utils.h
|
||
|
|
@@ -21,7 +21,8 @@
|
||
|
|
|
||
|
|
#include "controller.h"
|
||
|
|
|
||
|
|
-class DummyClientAsyncResponseReader: public grpc::ClientAsyncResponseReaderInterface<containerd::services::sandbox::v1::ControllerWaitResponse> {
|
||
|
|
+class DummyClientAsyncResponseReader: public
|
||
|
|
+ grpc::ClientAsyncResponseReaderInterface<containerd::services::sandbox::v1::ControllerWaitResponse> {
|
||
|
|
public:
|
||
|
|
DummyClientAsyncResponseReader() = default;
|
||
|
|
~DummyClientAsyncResponseReader() = default;
|
||
|
|
@@ -30,26 +31,32 @@ public:
|
||
|
|
|
||
|
|
void ReadInitialMetadata(void *tag) override {}
|
||
|
|
|
||
|
|
- void Finish(containerd::services::sandbox::v1::ControllerWaitResponse *response, grpc::Status *status, void *tag) override {
|
||
|
|
+ void Finish(containerd::services::sandbox::v1::ControllerWaitResponse *response, grpc::Status *status,
|
||
|
|
+ void *tag) override
|
||
|
|
+ {
|
||
|
|
response->set_exit_status(m_exitStatus);
|
||
|
|
response->mutable_exited_at()->CopyFrom(m_exitedAt);
|
||
|
|
*status = m_status;
|
||
|
|
m_tag = tag;
|
||
|
|
}
|
||
|
|
|
||
|
|
- void SetExitAt(const google::protobuf::Timestamp &exitAt) {
|
||
|
|
+ void SetExitAt(const google::protobuf::Timestamp &exitAt)
|
||
|
|
+ {
|
||
|
|
m_exitedAt = exitAt;
|
||
|
|
}
|
||
|
|
|
||
|
|
- void SetExitStatus(uint32_t status) {
|
||
|
|
+ void SetExitStatus(uint32_t status)
|
||
|
|
+ {
|
||
|
|
m_exitStatus = status;
|
||
|
|
}
|
||
|
|
|
||
|
|
- void SetStatus(grpc::Status status) {
|
||
|
|
+ void SetStatus(grpc::Status status)
|
||
|
|
+ {
|
||
|
|
m_status = status;
|
||
|
|
}
|
||
|
|
|
||
|
|
- void *GetTag() {
|
||
|
|
+ void *GetTag()
|
||
|
|
+ {
|
||
|
|
return m_tag;
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -70,28 +77,39 @@ enum AsyncWaitCallStatus {
|
||
|
|
|
||
|
|
class DummyCallback: public sandbox::SandboxStatusCallback {
|
||
|
|
public:
|
||
|
|
- DummyCallback() {
|
||
|
|
+ DummyCallback()
|
||
|
|
+ {
|
||
|
|
m_status = ASYNC_WAIT_CALL_STATUS_UNKNOWN;
|
||
|
|
}
|
||
|
|
~DummyCallback() = default;
|
||
|
|
|
||
|
|
- void OnSandboxReady() override { m_status = ASYNC_WAIT_CALL_STATUS_READY; }
|
||
|
|
- void OnSandboxPending() override { m_status = ASYNC_WAIT_CALL_STATUS_PENDING; }
|
||
|
|
- void OnSandboxExit(const sandbox::ControllerExitInfo &exitInfo) override {
|
||
|
|
+ void OnSandboxReady() override
|
||
|
|
+ {
|
||
|
|
+ m_status = ASYNC_WAIT_CALL_STATUS_READY;
|
||
|
|
+ }
|
||
|
|
+ void OnSandboxPending() override
|
||
|
|
+ {
|
||
|
|
+ m_status = ASYNC_WAIT_CALL_STATUS_PENDING;
|
||
|
|
+ }
|
||
|
|
+ void OnSandboxExit(const sandbox::ControllerExitInfo &exitInfo) override
|
||
|
|
+ {
|
||
|
|
m_status = ASYNC_WAIT_CALL_STATUS_EXIT;
|
||
|
|
m_exitStatus = exitInfo.exitStatus;
|
||
|
|
m_exitedAt = exitInfo.exitedAt;
|
||
|
|
}
|
||
|
|
|
||
|
|
- AsyncWaitCallStatus GetStatus() {
|
||
|
|
+ AsyncWaitCallStatus GetStatus()
|
||
|
|
+ {
|
||
|
|
return m_status;
|
||
|
|
}
|
||
|
|
|
||
|
|
- uint32_t GetExitStatus() {
|
||
|
|
+ uint32_t GetExitStatus()
|
||
|
|
+ {
|
||
|
|
return m_exitStatus;
|
||
|
|
}
|
||
|
|
|
||
|
|
- uint64_t GetExitedAt() {
|
||
|
|
+ uint64_t GetExitedAt()
|
||
|
|
+ {
|
||
|
|
return m_exitedAt;
|
||
|
|
}
|
||
|
|
private:
|
||
|
|
diff --git a/test/sandbox/controller/sandboxer/sandboxer_client/sandboxer_client_ut.cc b/test/sandbox/controller/sandboxer/sandboxer_client/sandboxer_client_ut.cc
|
||
|
|
index 0804b38b..b0f4758f 100644
|
||
|
|
--- a/test/sandbox/controller/sandboxer/sandboxer_client/sandboxer_client_ut.cc
|
||
|
|
+++ b/test/sandbox/controller/sandboxer/sandboxer_client/sandboxer_client_ut.cc
|
||
|
|
@@ -21,7 +21,8 @@
|
||
|
|
|
||
|
|
class SandboxerClientWrapper : public sandbox::SandboxerClient {
|
||
|
|
public:
|
||
|
|
- SandboxerClientWrapper(const std::string &sandboxer, const std::string &address) : SandboxerClient(sandboxer, address) {
|
||
|
|
+ SandboxerClientWrapper(const std::string &sandboxer, const std::string &address) : SandboxerClient(sandboxer, address)
|
||
|
|
+ {
|
||
|
|
m_stub = NewDummyControllerStub();
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -30,7 +31,8 @@ public:
|
||
|
|
|
||
|
|
class ControllerSandboxerClientTest : public testing::Test {
|
||
|
|
protected:
|
||
|
|
- void SetUp() override {
|
||
|
|
+ void SetUp() override
|
||
|
|
+ {
|
||
|
|
m_sandboxer = "sandboxer";
|
||
|
|
m_address = "/tmp/sandboxer.sock";
|
||
|
|
|
||
|
|
@@ -39,7 +41,8 @@ protected:
|
||
|
|
MockControllerStub_SetMock(m_stub);
|
||
|
|
}
|
||
|
|
|
||
|
|
- void TearDown() override {
|
||
|
|
+ void TearDown() override
|
||
|
|
+ {
|
||
|
|
MockControllerStub_SetMock(nullptr);
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -50,18 +53,21 @@ protected:
|
||
|
|
std::shared_ptr<SandboxerClientWrapper> m_sandboxerClient;
|
||
|
|
};
|
||
|
|
|
||
|
|
-static std::unique_ptr<containerd::services::sandbox::v1::ControllerStartResponse> CreateTestGrpcStartResponse() {
|
||
|
|
- std::unique_ptr<containerd::services::sandbox::v1::ControllerStartResponse> response(new containerd::services::sandbox::v1::ControllerStartResponse());
|
||
|
|
+static std::unique_ptr<containerd::services::sandbox::v1::ControllerStartResponse> CreateTestGrpcStartResponse()
|
||
|
|
+{
|
||
|
|
+ std::unique_ptr<containerd::services::sandbox::v1::ControllerStartResponse> response(
|
||
|
|
+ new containerd::services::sandbox::v1::ControllerStartResponse());
|
||
|
|
response->set_sandbox_id(DUMMY_SANDBOX_ID);
|
||
|
|
response->set_pid(1);
|
||
|
|
- response->mutable_created_at()->set_seconds(DUMMY_CREATE_AT/SECOND_TO_NANOS);
|
||
|
|
- response->mutable_created_at()->set_nanos(DUMMY_CREATE_AT%SECOND_TO_NANOS);
|
||
|
|
+ response->mutable_created_at()->set_seconds(DUMMY_CREATE_AT / SECOND_TO_NANOS);
|
||
|
|
+ response->mutable_created_at()->set_nanos(DUMMY_CREATE_AT % SECOND_TO_NANOS);
|
||
|
|
response->mutable_labels()->insert({"label1", "value1"});
|
||
|
|
return response;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Create platform response for test.
|
||
|
|
-static std::unique_ptr<containerd::services::sandbox::v1::ControllerPlatformResponse> CreateTestPlatformResponse() {
|
||
|
|
+static std::unique_ptr<containerd::services::sandbox::v1::ControllerPlatformResponse> CreateTestPlatformResponse()
|
||
|
|
+{
|
||
|
|
std::unique_ptr<containerd::services::sandbox::v1::ControllerPlatformResponse> response(
|
||
|
|
new containerd::services::sandbox::v1::ControllerPlatformResponse()
|
||
|
|
);
|
||
|
|
@@ -72,7 +78,8 @@ static std::unique_ptr<containerd::services::sandbox::v1::ControllerPlatformResp
|
||
|
|
}
|
||
|
|
|
||
|
|
// Create status response for test
|
||
|
|
-static std::unique_ptr<containerd::services::sandbox::v1::ControllerStatusResponse> CreateTestStatusResponse() {
|
||
|
|
+static std::unique_ptr<containerd::services::sandbox::v1::ControllerStatusResponse> CreateTestStatusResponse()
|
||
|
|
+{
|
||
|
|
std::unique_ptr<containerd::services::sandbox::v1::ControllerStatusResponse> response(
|
||
|
|
new containerd::services::sandbox::v1::ControllerStatusResponse()
|
||
|
|
);
|
||
|
|
@@ -80,29 +87,32 @@ static std::unique_ptr<containerd::services::sandbox::v1::ControllerStatusRespon
|
||
|
|
response->set_state("running");
|
||
|
|
response->set_pid(1);
|
||
|
|
response->set_task_address(DUMMY_TASK_ADDRESS);
|
||
|
|
- response->mutable_created_at()->set_seconds(DUMMY_CREATE_AT/SECOND_TO_NANOS);
|
||
|
|
- response->mutable_created_at()->set_nanos(DUMMY_CREATE_AT%SECOND_TO_NANOS);
|
||
|
|
- response->mutable_exited_at()->set_seconds(DUMMY_CREATE_AT/SECOND_TO_NANOS);
|
||
|
|
- response->mutable_exited_at()->set_nanos(DUMMY_CREATE_AT%SECOND_TO_NANOS);
|
||
|
|
+ response->mutable_created_at()->set_seconds(DUMMY_CREATE_AT / SECOND_TO_NANOS);
|
||
|
|
+ response->mutable_created_at()->set_nanos(DUMMY_CREATE_AT % SECOND_TO_NANOS);
|
||
|
|
+ response->mutable_exited_at()->set_seconds(DUMMY_CREATE_AT / SECOND_TO_NANOS);
|
||
|
|
+ response->mutable_exited_at()->set_nanos(DUMMY_CREATE_AT % SECOND_TO_NANOS);
|
||
|
|
response->mutable_info()->insert({"info1", "value1"});
|
||
|
|
response->mutable_extra()->set_value("{extra: test}");
|
||
|
|
return response;
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for Create *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, CreateTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, CreateTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
std::unique_ptr<sandbox::ControllerCreateParams> params = CreateTestCreateParams();
|
||
|
|
// Fake a grpc create response.
|
||
|
|
containerd::services::sandbox::v1::ControllerCreateResponse response;
|
||
|
|
response.set_sandbox_id(DUMMY_SANDBOX_ID);
|
||
|
|
// Set response to return sandbox_id, and return OK for stub_->Create().
|
||
|
|
- EXPECT_CALL(*m_stub, Create).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(response), testing::Return(grpc::Status::OK)));
|
||
|
|
+ EXPECT_CALL(*m_stub, Create).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(response),
|
||
|
|
+ testing::Return(grpc::Status::OK)));
|
||
|
|
EXPECT_TRUE(m_sandboxerClient->Create(DUMMY_SANDBOX_ID, *params, err));
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, CreateTestNullConfig) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, CreateTestNullConfig)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
std::unique_ptr<sandbox::ControllerCreateParams> params(new sandbox::ControllerCreateParams());
|
||
|
|
params->config = nullptr;
|
||
|
|
@@ -113,20 +123,23 @@ TEST_F(ControllerSandboxerClientTest, CreateTestNullConfig) {
|
||
|
|
EXPECT_THAT(err.GetCMessage(), testing::HasSubstr("Failed to init create request for sandboxer create request"));
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, CreateTestNullMount) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, CreateTestNullMount)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
std::unique_ptr<sandbox::ControllerCreateParams> params = CreateTestCreateParams();
|
||
|
|
params->mounts.push_back(nullptr);
|
||
|
|
containerd::services::sandbox::v1::ControllerCreateRequest request;
|
||
|
|
// Save request to check mount size.
|
||
|
|
- EXPECT_CALL(*m_stub, Create).Times(1).WillOnce(testing::DoAll(testing::SaveArg<1>(&request), testing::Return(grpc::Status::OK)));
|
||
|
|
+ EXPECT_CALL(*m_stub, Create).Times(1).WillOnce(testing::DoAll(testing::SaveArg<1>(&request),
|
||
|
|
+ testing::Return(grpc::Status::OK)));
|
||
|
|
EXPECT_TRUE(m_sandboxerClient->Create(DUMMY_SANDBOX_ID, *params, err));
|
||
|
|
// The nullptr pushed in params should not be counted.
|
||
|
|
EXPECT_EQ(request.rootfs_size(), 1);
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, CreateTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, CreateTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
std::unique_ptr<sandbox::ControllerCreateParams> params = CreateTestCreateParams();
|
||
|
|
// Fake a grpc create response.
|
||
|
|
@@ -138,11 +151,13 @@ TEST_F(ControllerSandboxerClientTest, CreateTestStatusNotOK) {
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for Start *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, StartTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, StartTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
sandbox::ControllerSandboxInfo sandboxInfo;
|
||
|
|
std::unique_ptr<containerd::services::sandbox::v1::ControllerStartResponse> response = CreateTestGrpcStartResponse();
|
||
|
|
- EXPECT_CALL(*m_stub, Start).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(*response), testing::Return(grpc::Status::OK)));
|
||
|
|
+ EXPECT_CALL(*m_stub, Start).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(*response),
|
||
|
|
+ testing::Return(grpc::Status::OK)));
|
||
|
|
EXPECT_TRUE(m_sandboxerClient->Start(DUMMY_SANDBOX_ID, sandboxInfo, err));
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
EXPECT_EQ(sandboxInfo.id, DUMMY_SANDBOX_ID);
|
||
|
|
@@ -152,7 +167,8 @@ TEST_F(ControllerSandboxerClientTest, StartTestSucceed) {
|
||
|
|
EXPECT_EQ(sandboxInfo.labels["label1"], "value1");
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, StartTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, StartTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
sandbox::ControllerSandboxInfo sandboxInfo;
|
||
|
|
EXPECT_CALL(*m_stub, Start).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED, "gRPC Abort")));
|
||
|
|
@@ -161,7 +177,8 @@ TEST_F(ControllerSandboxerClientTest, StartTestStatusNotOK) {
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for Prepare *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, PrepareTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, PrepareTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
std::string bundle;
|
||
|
|
std::unique_ptr<sandbox::ControllerPrepareParams> params = CreateTestPrepareParams();
|
||
|
|
@@ -169,13 +186,15 @@ TEST_F(ControllerSandboxerClientTest, PrepareTestSucceed) {
|
||
|
|
containerd::services::sandbox::v1::PrepareResponse response;
|
||
|
|
response.set_bundle("/tmp/bundle");
|
||
|
|
// Set response to return bundle, and return OK for stub_->Prepare().
|
||
|
|
- EXPECT_CALL(*m_stub, Prepare).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(response), testing::Return(grpc::Status::OK)));
|
||
|
|
+ EXPECT_CALL(*m_stub, Prepare).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(response),
|
||
|
|
+ testing::Return(grpc::Status::OK)));
|
||
|
|
EXPECT_TRUE(m_sandboxerClient->Prepare(DUMMY_SANDBOX_ID, *params, bundle, err));
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
EXPECT_EQ(bundle, "/tmp/bundle");
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, PrepareTestNullSpec) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, PrepareTestNullSpec)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
std::string bundle;
|
||
|
|
std::unique_ptr<sandbox::ControllerPrepareParams> params = CreateTestPrepareParams();
|
||
|
|
@@ -186,21 +205,24 @@ TEST_F(ControllerSandboxerClientTest, PrepareTestNullSpec) {
|
||
|
|
EXPECT_THAT(err.GetCMessage(), testing::HasSubstr("Failed to init prepare request for sandboxer prepare request"));
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, PrepareTestNullMount) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, PrepareTestNullMount)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
std::string bundle;
|
||
|
|
std::unique_ptr<sandbox::ControllerPrepareParams> params = CreateTestPrepareParams();
|
||
|
|
params->rootfs.push_back(nullptr);
|
||
|
|
containerd::services::sandbox::v1::PrepareRequest request;
|
||
|
|
// Save request to check mount size.
|
||
|
|
- EXPECT_CALL(*m_stub, Prepare).Times(1).WillOnce(testing::DoAll(testing::SaveArg<1>(&request), testing::Return(grpc::Status::OK)));
|
||
|
|
+ EXPECT_CALL(*m_stub, Prepare).Times(1).WillOnce(testing::DoAll(testing::SaveArg<1>(&request),
|
||
|
|
+ testing::Return(grpc::Status::OK)));
|
||
|
|
EXPECT_TRUE(m_sandboxerClient->Prepare(DUMMY_SANDBOX_ID, *params, bundle, err));
|
||
|
|
// The nullptr pushed in params should not be counted.
|
||
|
|
EXPECT_EQ(request.rootfs_size(), 2);
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, PrepareTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, PrepareTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
std::string bundle;
|
||
|
|
std::unique_ptr<sandbox::ControllerPrepareParams> params = CreateTestPrepareParams();
|
||
|
|
@@ -210,7 +232,8 @@ TEST_F(ControllerSandboxerClientTest, PrepareTestStatusNotOK) {
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for Purge *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, PurgeTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, PurgeTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
// Set response to return OK for stub_->Purge().
|
||
|
|
EXPECT_CALL(*m_stub, Purge).Times(1).WillOnce(testing::Return(grpc::Status::OK));
|
||
|
|
@@ -218,7 +241,8 @@ TEST_F(ControllerSandboxerClientTest, PurgeTestSucceed) {
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, PurgeTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, PurgeTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
EXPECT_CALL(*m_stub, Purge).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED, "gRPC Abort")));
|
||
|
|
EXPECT_FALSE(m_sandboxerClient->Purge(DUMMY_SANDBOX_ID, DUMMY_CONTAINER_ID, DUMMY_EXEC_ID, err));
|
||
|
|
@@ -226,7 +250,8 @@ TEST_F(ControllerSandboxerClientTest, PurgeTestStatusNotOK) {
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for UpdateResources *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, UpdateResourcesTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, UpdateResourcesTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
google::protobuf::Map<std::string, std::string> annotations;
|
||
|
|
std::unique_ptr<sandbox::ControllerUpdateResourcesParams> params = CreateTestUpdateResourcesParams(annotations);
|
||
|
|
@@ -236,7 +261,8 @@ TEST_F(ControllerSandboxerClientTest, UpdateResourcesTestSucceed) {
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, UpdateResourcesTestNullResources) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, UpdateResourcesTestNullResources)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
google::protobuf::Map<std::string, std::string> annotations;
|
||
|
|
std::unique_ptr<sandbox::ControllerUpdateResourcesParams> params = CreateTestUpdateResourcesParams(annotations);
|
||
|
|
@@ -244,24 +270,29 @@ TEST_F(ControllerSandboxerClientTest, UpdateResourcesTestNullResources) {
|
||
|
|
// Stub should not be called
|
||
|
|
EXPECT_CALL(*m_stub, UpdateResources).Times(0);
|
||
|
|
EXPECT_FALSE(m_sandboxerClient->UpdateResources(DUMMY_SANDBOX_ID, *params, err));
|
||
|
|
- EXPECT_THAT(err.GetCMessage(), testing::HasSubstr("Failed to init update-resources request for sandboxer update-resources request"));
|
||
|
|
+ EXPECT_THAT(err.GetCMessage(),
|
||
|
|
+ testing::HasSubstr("Failed to init update-resources request for sandboxer update-resources request"));
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, UpdateResourcesTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, UpdateResourcesTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
google::protobuf::Map<std::string, std::string> annotations;
|
||
|
|
std::unique_ptr<sandbox::ControllerUpdateResourcesParams> params = CreateTestUpdateResourcesParams(annotations);
|
||
|
|
- EXPECT_CALL(*m_stub, UpdateResources).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED, "gRPC Abort")));
|
||
|
|
+ EXPECT_CALL(*m_stub, UpdateResources).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED,
|
||
|
|
+ "gRPC Abort")));
|
||
|
|
EXPECT_FALSE(m_sandboxerClient->UpdateResources(DUMMY_SANDBOX_ID, *params, err));
|
||
|
|
EXPECT_THAT(err.GetCMessage(), testing::HasSubstr("gRPC Abort"));
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for Platform *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, PlatformTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, PlatformTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
sandbox::ControllerPlatformInfo platformInfo;
|
||
|
|
std::unique_ptr<containerd::services::sandbox::v1::ControllerPlatformResponse> response = CreateTestPlatformResponse();
|
||
|
|
- EXPECT_CALL(*m_stub, Platform).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(*response), testing::Return(grpc::Status::OK)));
|
||
|
|
+ EXPECT_CALL(*m_stub, Platform).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(*response),
|
||
|
|
+ testing::Return(grpc::Status::OK)));
|
||
|
|
EXPECT_TRUE(m_sandboxerClient->Platform(DUMMY_SANDBOX_ID, platformInfo, err));
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
EXPECT_EQ(platformInfo.os, "linux");
|
||
|
|
@@ -269,16 +300,19 @@ TEST_F(ControllerSandboxerClientTest, PlatformTestSucceed) {
|
||
|
|
EXPECT_EQ(platformInfo.variant, "ubuntu");
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, PlatformTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, PlatformTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
sandbox::ControllerPlatformInfo platformInfo;
|
||
|
|
- EXPECT_CALL(*m_stub, Platform).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED, "gRPC Abort")));
|
||
|
|
+ EXPECT_CALL(*m_stub, Platform).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED,
|
||
|
|
+ "gRPC Abort")));
|
||
|
|
EXPECT_FALSE(m_sandboxerClient->Platform(DUMMY_SANDBOX_ID, platformInfo, err));
|
||
|
|
EXPECT_THAT(err.GetCMessage(), testing::HasSubstr("gRPC Abort"));
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for Stop *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, StopTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, StopTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
// Set response to return OK for stub_->Stop().
|
||
|
|
EXPECT_CALL(*m_stub, Stop).Times(1).WillOnce(testing::Return(grpc::Status::OK));
|
||
|
|
@@ -286,7 +320,8 @@ TEST_F(ControllerSandboxerClientTest, StopTestSucceed) {
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, StopTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, StopTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
EXPECT_CALL(*m_stub, Stop).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED, "gRPC Abort")));
|
||
|
|
EXPECT_FALSE(m_sandboxerClient->Stop(DUMMY_SANDBOX_ID, 0, err));
|
||
|
|
@@ -294,11 +329,13 @@ TEST_F(ControllerSandboxerClientTest, StopTestStatusNotOK) {
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for Status *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, StatusTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, StatusTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
sandbox::ControllerSandboxStatus sandboxStatus;
|
||
|
|
std::unique_ptr<containerd::services::sandbox::v1::ControllerStatusResponse> response = CreateTestStatusResponse();
|
||
|
|
- EXPECT_CALL(*m_stub, Status).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(*response), testing::Return(grpc::Status::OK)));
|
||
|
|
+ EXPECT_CALL(*m_stub, Status).Times(1).WillOnce(testing::DoAll(testing::SetArgPointee<2>(*response),
|
||
|
|
+ testing::Return(grpc::Status::OK)));
|
||
|
|
EXPECT_TRUE(m_sandboxerClient->Status(DUMMY_SANDBOX_ID, false, sandboxStatus, err));
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
EXPECT_EQ(sandboxStatus.id, DUMMY_SANDBOX_ID);
|
||
|
|
@@ -312,7 +349,8 @@ TEST_F(ControllerSandboxerClientTest, StatusTestSucceed) {
|
||
|
|
EXPECT_EQ(sandboxStatus.extra, "{extra: test}");
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, StatusTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, StatusTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
sandbox::ControllerSandboxStatus sandboxStatus;
|
||
|
|
EXPECT_CALL(*m_stub, Status).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED, "gRPC Abort")));
|
||
|
|
@@ -321,7 +359,8 @@ TEST_F(ControllerSandboxerClientTest, StatusTestStatusNotOK) {
|
||
|
|
}
|
||
|
|
|
||
|
|
/************* Unit tests for Shutdown *************/
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, ShutdownTestSucceed) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, ShutdownTestSucceed)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
// Set response to return OK for stub_->Shutdown().
|
||
|
|
EXPECT_CALL(*m_stub, Shutdown).Times(1).WillOnce(testing::Return(grpc::Status::OK));
|
||
|
|
@@ -329,9 +368,11 @@ TEST_F(ControllerSandboxerClientTest, ShutdownTestSucceed) {
|
||
|
|
EXPECT_TRUE(err.Empty());
|
||
|
|
}
|
||
|
|
|
||
|
|
-TEST_F(ControllerSandboxerClientTest, ShutdownTestStatusNotOK) {
|
||
|
|
+TEST_F(ControllerSandboxerClientTest, ShutdownTestStatusNotOK)
|
||
|
|
+{
|
||
|
|
Errors err;
|
||
|
|
- EXPECT_CALL(*m_stub, Shutdown).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED, "gRPC Abort")));
|
||
|
|
+ EXPECT_CALL(*m_stub, Shutdown).Times(1).WillOnce(testing::Return(grpc::Status(grpc::StatusCode::ABORTED,
|
||
|
|
+ "gRPC Abort")));
|
||
|
|
EXPECT_FALSE(m_sandboxerClient->Shutdown(DUMMY_SANDBOX_ID, err));
|
||
|
|
EXPECT_THAT(err.GetCMessage(), testing::HasSubstr("gRPC Abort"));
|
||
|
|
}
|
||
|
|
diff --git a/test/sandbox/controller/sandboxer/sandboxer_controller/sandboxer_controller_ut.cc b/test/sandbox/controller/sandboxer/sandboxer_controller/sandboxer_controller_ut.cc
|
||
|
|
index 52c3f28a..f49d7cc5 100644
|
||
|
|
--- a/test/sandbox/controller/sandboxer/sandboxer_controller/sandboxer_controller_ut.cc
|
||
|
|
+++ b/test/sandbox/controller/sandboxer/sandboxer_controller/sandboxer_controller_ut.cc
|
||
|
|
@@ -21,7 +21,8 @@
|
||
|
|
|
||
|
|
class SandboxerControllerTest : public testing::Test {
|
||
|
|
protected:
|
||
|
|
- void SetUp() override {
|
||
|
|
+ void SetUp() override
|
||
|
|
+ {
|
||
|
|
Errors err;
|
||
|
|
m_contoller = std::move(std::unique_ptr<SandboxerController>(new SandboxerController(m_sandboxer, m_address)));
|
||
|
|
m_sandboxerClientMock = std::make_shared<SandboxerClientMock>();
|
||
|
|
@@ -30,7 +31,8 @@ protected:
|
||
|
|
m_contoller->Init(err);
|
||
|
|
}
|
||
|
|
|
||
|
|
- void TearDown() override {
|
||
|
|
+ void TearDown() override
|
||
|
|
+ {
|
||
|
|
m_contoller.reset(nullptr);
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -74,7 +76,8 @@ TEST_F(SandboxerControllerTest, StartTestSucceed)
|
||
|
|
Errors err;
|
||
|
|
std::unique_ptr<sandbox::ControllerSandboxInfo> sandboxInfo = CreateTestSandboxInfo();
|
||
|
|
// Set response to return sandbox_id, and return OK for stub_->Start().
|
||
|
|
- EXPECT_CALL(*m_sandboxerClientMock, Start).Times(1).WillOnce(testing::DoAll(testing::SetArgReferee<1>(*sandboxInfo), testing::Return(true)));
|
||
|
|
+ EXPECT_CALL(*m_sandboxerClientMock, Start).Times(1).WillOnce(testing::DoAll(testing::SetArgReferee<1>(*sandboxInfo),
|
||
|
|
+ testing::Return(true)));
|
||
|
|
std::unique_ptr<sandbox::ControllerSandboxInfo> ret = m_contoller->Start(DUMMY_SANDBOX_ID, err);
|
||
|
|
EXPECT_EQ(ret->id, DUMMY_SANDBOX_ID);
|
||
|
|
EXPECT_EQ(ret->pid, 1234);
|
||
|
|
@@ -99,7 +102,8 @@ TEST_F(SandboxerControllerTest, PlatformTestSucceed)
|
||
|
|
platformInfo->arch = "amd64";
|
||
|
|
platformInfo->variant = "openEuler";
|
||
|
|
// Set response to return sandbox_id, and return OK for stub_->Platform().
|
||
|
|
- EXPECT_CALL(*m_sandboxerClientMock, Platform).Times(1).WillOnce(testing::DoAll(testing::SetArgReferee<1>(*platformInfo), testing::Return(true)));
|
||
|
|
+ EXPECT_CALL(*m_sandboxerClientMock, Platform).Times(1).WillOnce(testing::DoAll(testing::SetArgReferee<1>(*platformInfo),
|
||
|
|
+ testing::Return(true)));
|
||
|
|
std::unique_ptr<sandbox::ControllerPlatformInfo> ret = m_contoller->Platform(DUMMY_SANDBOX_ID, err);
|
||
|
|
EXPECT_EQ(ret->os, "linux");
|
||
|
|
EXPECT_EQ(ret->arch, "amd64");
|
||
|
|
@@ -121,7 +125,8 @@ TEST_F(SandboxerControllerTest, PrepareTestSucceed)
|
||
|
|
Errors err;
|
||
|
|
std::string bundle = "/tmp/bundle";
|
||
|
|
// Set response to return sandbox_id, and return OK for stub_->Prepare().
|
||
|
|
- EXPECT_CALL(*m_sandboxerClientMock, Prepare).Times(1).WillOnce(testing::DoAll(testing::SetArgReferee<2>(bundle), testing::Return(true)));
|
||
|
|
+ EXPECT_CALL(*m_sandboxerClientMock, Prepare).Times(1).WillOnce(testing::DoAll(testing::SetArgReferee<2>(bundle),
|
||
|
|
+ testing::Return(true)));
|
||
|
|
std::string ret = m_contoller->Prepare(DUMMY_SANDBOX_ID, *CreateTestPrepareParams(), err);
|
||
|
|
EXPECT_EQ(ret, bundle);
|
||
|
|
}
|
||
|
|
@@ -201,7 +206,8 @@ TEST_F(SandboxerControllerTest, StatusTestSucceed)
|
||
|
|
sandboxStatus->info["test"] = "test";
|
||
|
|
sandboxStatus->exitedAt = DUMMY_EXITED_AT;
|
||
|
|
// Set response to return sandbox_id, and return OK for stub_->Status().
|
||
|
|
- EXPECT_CALL(*m_sandboxerClientMock, Status).Times(1).WillOnce(testing::DoAll(testing::SetArgReferee<2>(*sandboxStatus), testing::Return(true)));
|
||
|
|
+ EXPECT_CALL(*m_sandboxerClientMock, Status).Times(1).WillOnce(testing::DoAll(testing::SetArgReferee<2>(*sandboxStatus),
|
||
|
|
+ testing::Return(true)));
|
||
|
|
std::unique_ptr<sandbox::ControllerSandboxStatus> ret = m_contoller->Status(DUMMY_SANDBOX_ID, false, err);
|
||
|
|
EXPECT_EQ(ret->id, DUMMY_SANDBOX_ID);
|
||
|
|
EXPECT_EQ(ret->state, "created");
|
||
|
|
diff --git a/test/sandbox/controller/shim/shim_controller_ut.cc b/test/sandbox/controller/shim/shim_controller_ut.cc
|
||
|
|
index 978e2c36..e43cc645 100644
|
||
|
|
--- a/test/sandbox/controller/shim/shim_controller_ut.cc
|
||
|
|
+++ b/test/sandbox/controller/shim/shim_controller_ut.cc
|
||
|
|
@@ -24,7 +24,8 @@
|
||
|
|
|
||
|
|
class ShimControllerTest : public testing::Test {
|
||
|
|
protected:
|
||
|
|
- void SetUp() override {
|
||
|
|
+ void SetUp() override
|
||
|
|
+ {
|
||
|
|
Errors err;
|
||
|
|
m_contoller = std::move(std::unique_ptr<sandbox::ShimController>(new sandbox::ShimController(m_sandboxer)));
|
||
|
|
m_containerCallbackMock = std::make_shared<MockContainerCallback>();
|
||
|
|
@@ -37,7 +38,8 @@ protected:
|
||
|
|
service_callback_init();
|
||
|
|
}
|
||
|
|
|
||
|
|
- void TearDown() override {
|
||
|
|
+ void TearDown() override
|
||
|
|
+ {
|
||
|
|
m_contoller.reset(nullptr);
|
||
|
|
}
|
||
|
|
|
||
|
|
--
|
||
|
|
2.42.0
|
||
|
|
|