honeytrap icon indicating copy to clipboard operation
honeytrap copied to clipboard

Do not generate test garbage in the repository

Open athos-ribeiro opened this issue 8 years ago • 5 comments

Both services/smtp/smtp_test.go and services/ftp/ftp_test.go generate use SetDataDir before the tests. While the FTP version of the tests save the data in the /tmp directory, the FTP one does so in the repository path, leaving garbage behind. This commit sets the SMTP tests to behave like the FTP tests.

athos-ribeiro avatar Mar 13 '18 01:03 athos-ribeiro

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Mar 13 '18 01:03 CLAassistant

Note that this approach is not portable, but does not change the whole test suite portability since it just follows the model in the FTP tests.

athos-ribeiro avatar Mar 13 '18 01:03 athos-ribeiro

this approach is not portable

You can use os.TmpDir to get a temporary directory consistently.

CapacitorSet avatar Mar 13 '18 13:03 CapacitorSet

Using ioutil to generate a random directory under /tmp (and cleaning up after tests). This way we can use the approach on both smtp and ftp tests without concurrency issues.

athos-ribeiro avatar Mar 15 '18 00:03 athos-ribeiro

That's a good solution.

On March 15, 2018 1:52:27 AM GMT+01:00, Athos Ribeiro [email protected] wrote:

Using ioutil to generate a random directory under /tmp (and cleaning up after tests). This way we can use the approach on both smtp and ftp tests without concurrency issues.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/honeytrap/honeytrap/pull/247#issuecomment-373223911

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

CapacitorSet avatar Mar 15 '18 01:03 CapacitorSet