[
https://issues.apache.org/jira/browse/MESOS-3848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15143001#comment-15143001
]
haosdent commented on MESOS-3848:
---------------------------------
{quote}
Move the temporary directory logic from Environment::mkdtemp to
TemporaryDirectoryTest.
{quote}
+1 And does this mean we could call multiple times mkdtemp in
{{TemporaryDirectoryTest}} and destroy them in
{{TemporaryDirectoryTest::TearDown}}. Just as what we do now in
{{Environment::TearDown}}?
And I saw
* process_tests.cpp
* subprocess_tests.cpp
* zookeeper_test_server.cpp
still use os::mkdtemp. I think it would be better change them use the dir
created by {{TemporaryDirectoryTest}}.
> Refactor Environment::mkdtemp into TemporaryDirectoryTest.
> ----------------------------------------------------------
>
> Key: MESOS-3848
> URL: https://issues.apache.org/jira/browse/MESOS-3848
> Project: Mesos
> Issue Type: Task
> Components: test
> Reporter: Joseph Wu
> Assignee: Joseph Wu
> Priority: Minor
> Labels: mesosphere
>
> As part of [MESOS-3762], many tests were changed from one
> {{TemporaryDirectoryTest}} to another {{TemporaryDirectoryTest}}. One subtle
> difference is that the name of the temporary directory no longer contains the
> name of the test. In [MESOS-3847], the duplicate {{TemporaryDirectoryTest}}
> was removed.
> The original {{TemporaryDirectoryTest}} called
> [{{environment->mkdtemp}}|https://github.com/apache/mesos/blob/master/src/tests/environment.cpp#L494].
> We would like the naming, which is valuable for debugging, to be available
> for a majority of tests. (A majority of tests inherit from
> {{TemporaryDirectoryTest}} in some way.)
> Note:
> * Any additional directories created via {{environment->mkdtemp}} are cleaned
> up after the test.
> * We don't want mesos-specific logic in Stout, like the {{umount}} shell
> command in {{Environment::TearDown}}.
> *Proposed change:*
> Move the temporary directory logic from {{Environment::mkdtemp}} to
> {{TemporaryDirectoryTest}}.
> *Tests that need to change*
> | {{log_tests.cpp}} | {{LogZooKeeperTest}} | We can change {{ZooKeeperTest}}
> to inherit from {{TemporaryDirectoryTest}} to get rid of code duplication |
> | {{tests/mesos.cpp}} | {{MesosTest::CreateSlaveFlags}} | {{MesosTest}}
> already inherits from {{TemporaryDirectoryTest}}. |
> | {{tests/script.hpp}} | {{TEST_SCRIPT}} | This is used for the
> {{ExampleTests}}. We can define a test class that inherits appropriately. |
> | {{docker_tests.cpp}} | {{*}} | Already inherits from {{MesosTest}}. |
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)