16 #include "tensorflow_serving/sources/storage_path/static_storage_path_source.h"
20 #include <gmock/gmock.h>
21 #include <gtest/gtest.h>
22 #include "tensorflow/core/lib/core/status_test_util.h"
23 #include "tensorflow/core/lib/core/stringpiece.h"
24 #include "tensorflow_serving/core/servable_data.h"
25 #include "tensorflow_serving/core/target.h"
26 #include "tensorflow_serving/core/test_util/mock_storage_path_target.h"
27 #include "tensorflow_serving/test_util/test_util.h"
29 using ::testing::ElementsAre;
31 using ::testing::StrictMock;
33 namespace tensorflow {
37 TEST(StaticStoragePathSourceTest, Basic) {
38 auto config = test_util::CreateProto<StaticStoragePathSourceConfig>(
39 "servable_name: 'test_servable_name' "
41 "version_path: 'test_version_path' ");
42 std::unique_ptr<StaticStoragePathSource> source;
43 TF_ASSERT_OK(StaticStoragePathSource::Create(config, &source));
45 std::unique_ptr<test_util::MockStoragePathTarget> target(
46 new StrictMock<test_util::MockStoragePathTarget>);
47 EXPECT_CALL(*target, SetAspiredVersions(Eq(
"test_servable_name"),
48 ElementsAre(ServableData<StoragePath>(
49 {
"test_servable_name", 42},
50 "test_version_path"))));
51 ConnectSourceToTarget(source.get(), target.get());