16 #include "tensorflow_serving/session_bundle/session_bundle_util.h"
18 #include <gmock/gmock.h>
19 #include <gtest/gtest.h>
20 #include "tensorflow/core/protobuf/meta_graph.pb.h"
21 #include "tensorflow_serving/test_util/test_util.h"
23 namespace tensorflow {
25 namespace session_bundle {
28 using ::testing::HasSubstr;
30 const char kTestSavedModelPath[] =
31 "cc/saved_model/testdata/half_plus_two/00000123";
33 const char kTestSessionBundleExportPath[] =
34 "session_bundle/testdata/half_plus_two/00000123";
36 TEST(SessionBundleTest, ConvertSignaturesToSignatureDefsTest) {
37 MetaGraphDef meta_graph_def;
38 Status status = ConvertSignaturesToSignatureDefs(&meta_graph_def);
39 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
42 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
45 TEST(SessionBundleTest, ConvertSessionBundleToSavedModelBundleTest) {
46 SessionBundle session_bundle;
47 SavedModelBundle saved_model_bundle;
48 Status status = session_bundle::ConvertSessionBundleToSavedModelBundle(
49 session_bundle, &saved_model_bundle);
50 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
53 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
56 TEST(SessionBundleTest, LoadSessionBundleOrSavedModelBundleTest) {
57 SessionOptions session_options;
58 RunOptions run_options;
59 SavedModelBundle bundle;
60 bool is_session_bundle;
61 const std::unordered_set<string> tags = {
"serve"};
62 const string export_dir =
63 test_util::TensorflowTestSrcDirPath(kTestSavedModelPath);
65 Status status = session_bundle::LoadSessionBundleOrSavedModelBundle(
66 session_options, run_options, export_dir, tags, &bundle,
68 EXPECT_TRUE(status.ok());
71 TEST(SessionBundleTest, LoadSessionBundleOrSavedModelBundleFailureTest) {
72 SessionOptions session_options;
73 RunOptions run_options;
74 SavedModelBundle bundle;
75 bool is_session_bundle;
76 const std::unordered_set<string> tags = {
"serve"};
77 const string export_dir =
78 test_util::TestSrcDirPath(kTestSessionBundleExportPath);
80 Status status = session_bundle::LoadSessionBundleOrSavedModelBundle(
81 session_options, run_options, export_dir, tags, &bundle,
83 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
86 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
89 TEST(SessionBundleTest, LoadSessionBundleFromPathUsingRunOptionsTest) {
90 SessionOptions session_options;
91 RunOptions run_options;
92 string export_dir =
"/exort_dir";
94 Status status = session_bundle::LoadSessionBundleFromPathUsingRunOptions(
95 session_options, run_options, export_dir, &bundle);
96 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
99 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
102 TEST(SessionBundleTest, SetSignaturesTest) {
103 Signatures signatures;
104 tensorflow::MetaGraphDef meta_graph_def;
105 Status status = session_bundle::SetSignatures(signatures, &meta_graph_def);
106 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
109 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
112 TEST(SessionBundleTest, GetClassificationSignatureTest) {
113 ClassificationSignature signature;
114 tensorflow::MetaGraphDef meta_graph_def;
116 session_bundle::GetClassificationSignature(meta_graph_def, &signature);
117 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
120 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
123 TEST(SessionBundleTest, GetRegressionSignatureTest) {
124 RegressionSignature signature;
125 tensorflow::MetaGraphDef meta_graph_def;
127 session_bundle::GetRegressionSignature(meta_graph_def, &signature);
128 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
131 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
134 TEST(SessionBundleTest, RunClassificationTest) {
135 ClassificationSignature signature;
137 Session* session =
nullptr;
140 Status status = session_bundle::RunClassification(signature, input, session,
142 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
145 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
148 TEST(SessionBundleTest, RunRegressionTest) {
149 RegressionSignature signature;
150 Tensor input, output;
151 Session* session =
nullptr;
153 session_bundle::RunRegression(signature, input, session, &output);
154 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
157 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));
160 TEST(SessionBundleTest, GetNamedSignature) {
161 const string name =
"name";
162 const tensorflow::MetaGraphDef meta_graph_def;
163 Signature default_signature;
164 Status status = session_bundle::GetNamedSignature(name, meta_graph_def,
166 EXPECT_EQ(::tensorflow::error::UNIMPLEMENTED, status.code());
169 ::testing::HasSubstr(
"Session Bundle is deprecated and removed."));