This test verifies if we can retrieve the file listing for a directory in the master.
| 1045 | // This test verifies if we can retrieve the file listing for a directory |
| 1046 | // in the master. |
| 1047 | TEST_P_TEMP_DISABLED_ON_WINDOWS(MasterAPITest, ListFiles) |
| 1048 | { |
| 1049 | Files files; |
| 1050 | |
| 1051 | ASSERT_SOME(os::mkdir("1/2")); |
| 1052 | ASSERT_SOME(os::mkdir("1/3")); |
| 1053 | ASSERT_SOME(os::write("1/two", "two")); |
| 1054 | |
| 1055 | AWAIT_EXPECT_READY(files.attach("1", "one")); |
| 1056 | |
| 1057 | // Get the `FileInfo` for "1/two" file. |
| 1058 | struct stat s; |
| 1059 | ASSERT_EQ(0, stat("1/two", &s)); |
| 1060 | FileInfo file = protobuf::createFileInfo("one/two", s); |
| 1061 | |
| 1062 | Try<Owned<cluster::Master>> master = StartMaster(); |
| 1063 | ASSERT_SOME(master); |
| 1064 | |
| 1065 | v1::master::Call v1Call; |
| 1066 | v1Call.set_type(v1::master::Call::LIST_FILES); |
| 1067 | v1Call.mutable_list_files()->set_path("one/"); |
| 1068 | |
| 1069 | ContentType contentType = GetParam(); |
| 1070 | |
| 1071 | Future<v1::master::Response> v1Response = |
| 1072 | post(master.get()->pid, v1Call, contentType); |
| 1073 | |
| 1074 | AWAIT_READY(v1Response); |
| 1075 | ASSERT_TRUE(v1Response->IsInitialized()); |
| 1076 | ASSERT_EQ(v1::master::Response::LIST_FILES, v1Response->type()); |
| 1077 | ASSERT_EQ(3, v1Response->list_files().file_infos().size()); |
| 1078 | ASSERT_EQ(evolve(file), v1Response->list_files().file_infos(2)); |
| 1079 | } |
| 1080 | |
| 1081 | |
| 1082 | // This test verifies that the client will receive a `NotFound` response when it |
nothing calls this directly
no test coverage detected