|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +#include "agent/task_worker_pool.h" |
| 19 | + |
| 20 | +#include <gtest/gtest.h> |
| 21 | + |
| 22 | +#include "olap/options.h" |
| 23 | +#include "cloud/cloud_storage_engine.h" |
| 24 | +#include "runtime/cluster_info.h" |
| 25 | + |
| 26 | +namespace doris { |
| 27 | + |
| 28 | +TEST(CloudTaskWorkerPoolTest, ReportTabletCallbackWithDebugPoint) { |
| 29 | + bool original_enable_debug_points = config::enable_debug_points; |
| 30 | + config::enable_debug_points = true; |
| 31 | + |
| 32 | + ExecEnv::GetInstance()->set_storage_engine(std::make_unique<CloudStorageEngine>(EngineOptions {})); |
| 33 | + |
| 34 | + ClusterInfo cluster_info; |
| 35 | + cluster_info.master_fe_addr.__set_port(9030); |
| 36 | + |
| 37 | + Defer defer {[] { |
| 38 | + ExecEnv::GetInstance()->set_storage_engine(nullptr); |
| 39 | + }}; |
| 40 | + |
| 41 | + { |
| 42 | + // debug point is enabled |
| 43 | + DebugPoints::instance()->add("WorkPoolCloudReportTablet.report_tablet_callback.skip"); |
| 44 | + EXPECT_TRUE(DebugPoints::instance()->is_enable("WorkPoolCloudReportTablet.report_tablet_callback.skip")); |
| 45 | + report_tablet_callback(ExecEnv::GetInstance()->storage_engine().to_cloud(), &cluster_info); |
| 46 | + } |
| 47 | + |
| 48 | + { |
| 49 | + // debug point is removed |
| 50 | + DebugPoints::instance()->remove("WorkPoolCloudReportTablet.report_tablet_callback.skip"); |
| 51 | + EXPECT_FALSE(DebugPoints::instance()->is_enable("WorkPoolCloudReportTablet.report_tablet_callback.skip")); |
| 52 | + report_tablet_callback(ExecEnv::GetInstance()->storage_engine().to_cloud(), &cluster_info); |
| 53 | + } |
| 54 | + |
| 55 | + config::enable_debug_points = original_enable_debug_points; |
| 56 | +} |
| 57 | + |
| 58 | +} // namespace doris |
0 commit comments