| 579 | } |
| 580 | |
| 581 | static void VersionTest(const VersionDef& versions, const string& error) { |
| 582 | const string path = io::JoinPath(testing::TmpDir(), "checkpoint"); |
| 583 | |
| 584 | { |
| 585 | // Prepare an empty checkpoint with some version information |
| 586 | SavedTensorSlices sts; |
| 587 | *sts.mutable_meta()->mutable_versions() = versions; |
| 588 | string contents; |
| 589 | EXPECT_TRUE(sts.SerializeToString(&contents)); |
| 590 | |
| 591 | // Write it to disk |
| 592 | TensorSliceWriter::Builder* builder; |
| 593 | TF_ASSERT_OK(CreateTableTensorSliceBuilder(path, &builder)); |
| 594 | builder->Add(kSavedTensorSlicesKey, contents); |
| 595 | int64 file_size; |
| 596 | TF_EXPECT_OK(builder->Finish(&file_size)); |
| 597 | delete builder; |
| 598 | } |
| 599 | |
| 600 | // Read it back in and verify that we get the expected error |
| 601 | TensorSliceReader reader(path, OpenTableTensorSliceReader); |
| 602 | EXPECT_TRUE(reader.status().code() == error::INVALID_ARGUMENT && |
| 603 | absl::StartsWith(reader.status().error_message(), error)) |
| 604 | << "Expected error starting with '" << errors::InvalidArgument(error) |
| 605 | << "', got '" << reader.status() << "'"; |
| 606 | } |
| 607 | |
| 608 | TEST(CheckpointVersionTest, MinConsumer) { |
| 609 | VersionDef versions; |
no test coverage detected