15 #include "tensorflow_serving/core/aspired_version_policy.h"
19 #include <gtest/gtest.h>
20 #include "absl/types/optional.h"
21 #include "tensorflow_serving/core/loader_harness.h"
22 #include "tensorflow_serving/core/servable_id.h"
24 namespace tensorflow {
31 absl::optional<ServableId> GetHighestAspiredNewServableId(
32 const std::vector<AspiredServableStateSnapshot>& all_versions) {
39 std::vector<AspiredServableStateSnapshot> versions;
42 absl::optional<ServableId> highest_aspired_new =
43 GetHighestAspiredNewServableId(versions);
44 ASSERT_FALSE(highest_aspired_new);
47 TEST_F(AspiredVersionPolicyTest, HighestAspiredNewServableId) {
49 std::vector<AspiredServableStateSnapshot> versions;
56 absl::optional<ServableId> highest_aspired_new =
57 GetHighestAspiredNewServableId(versions);
58 ASSERT_TRUE(highest_aspired_new);
59 EXPECT_EQ(
"test", highest_aspired_new.value().name);
60 EXPECT_EQ(5, highest_aspired_new.value().version);
static absl::optional< ServableId > GetHighestAspiredNewServableId(const std::vector< AspiredServableStateSnapshot > &all_versions)
@ kUnloading
'loader_->Unload()' has been called.