mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-03 09:22:30 +08:00
* add TracerUtil * Interceptor ok * add handler * add context * minor update * keep span in trace context * add span in search okay * Update Context.cpp * refactor * refactor * refactor * format * add context in SearchJob * trace search okay * add back finish span in interceptor * add namespace * add tracing config in server config * add random id * debug mode okay * update CMakeLists * add opentracing to cmake * update unittest * add tracing namespace * remove std::run_time error * add lock when erasing context_map * update tracing config * lint * update CHANGELOG * small fix * fix server unit test * fix scheduler unit test * fix db unit test * lint * fix db unit test gpu version * rename to tracing_config * fix * update * trigger ci
49 lines
1.9 KiB
C++
49 lines
1.9 KiB
C++
// Licensed to the Apache Software Foundation (ASF) under one
|
|
// or more contributor license agreements. See the NOTICE file
|
|
// distributed with this work for additional information
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
// to you under the Apache License, Version 2.0 (the
|
|
// "License"); you may not use this file except in compliance
|
|
// with the License. You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing,
|
|
// software distributed under the License is distributed on an
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations
|
|
// under the License.
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <opentracing/mocktracer/tracer.h>
|
|
|
|
#include "scheduler/task/BuildIndexTask.h"
|
|
#include "scheduler/task/SearchTask.h"
|
|
|
|
namespace milvus {
|
|
namespace scheduler {
|
|
|
|
TEST(TaskTest, INVALID_INDEX) {
|
|
auto dummy_context = std::make_shared<milvus::server::Context>("dummy_request_id");
|
|
opentracing::mocktracer::MockTracerOptions tracer_options;
|
|
auto mock_tracer =
|
|
std::shared_ptr<opentracing::Tracer>{new opentracing::mocktracer::MockTracer{std::move(tracer_options)}};
|
|
auto mock_span = mock_tracer->StartSpan("mock_span");
|
|
auto trace_context = std::make_shared<milvus::tracing::TraceContext>(mock_span);
|
|
dummy_context->SetTraceContext(trace_context);
|
|
|
|
TableFileSchemaPtr dummy_file = std::make_shared<engine::meta::TableFileSchema>();
|
|
auto search_task =
|
|
std::make_shared<XSearchTask>(dummy_context, dummy_file, nullptr);
|
|
search_task->Load(LoadType::TEST, 10);
|
|
|
|
auto build_task = std::make_shared<XBuildIndexTask>(nullptr, nullptr);
|
|
build_task->Load(LoadType::TEST, 10);
|
|
|
|
build_task->Execute();
|
|
}
|
|
|
|
} // namespace scheduler
|
|
} // namespace milvus
|