Skip to content

Commit

Permalink
Merge pull request #22 from projectdiscovery/21-suffix-props-test-sleep
Browse files Browse the repository at this point in the history
suffix props tests sleep time
  • Loading branch information
Mzack9999 authored Nov 14, 2022
2 parents ba8c203 + 60bdac0 commit 42820e6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestDeleteFilesOlderThan(t *testing.T) {
fo, err := os.MkdirTemp("", "")
require.Nil(t, err, "couldn't create folder: %s", err)
ttl := time.Duration(5 * time.Second)
sleepTime := time.Duration(10 * time.Second)

// defer temporary folder removal
defer os.RemoveAll(fo)
Expand All @@ -62,7 +63,7 @@ func TestDeleteFilesOlderThan(t *testing.T) {
fName := createFile()
fileInfo, _ := os.Stat(fName)
// sleep for 5 seconds
time.Sleep(5 * time.Second)
time.Sleep(sleepTime)
// delete files older than 5 seconds
filter := FileFilters{
OlderThan: ttl,
Expand All @@ -76,7 +77,7 @@ func TestDeleteFilesOlderThan(t *testing.T) {
fName := createFile()
fileInfo, _ := os.Stat(fName)
// sleep for 5 seconds
time.Sleep(5 * time.Second)
time.Sleep(sleepTime)
// delete files older than 5 seconds
filter := FileFilters{
OlderThan: ttl,
Expand All @@ -91,7 +92,7 @@ func TestDeleteFilesOlderThan(t *testing.T) {
fName1 := createFile()

// sleep for 5 seconds
time.Sleep(5 * time.Second)
time.Sleep(sleepTime)
// delete files older than 5 seconds
filter := FileFilters{
OlderThan: ttl,
Expand All @@ -107,7 +108,7 @@ func TestDeleteFilesOlderThan(t *testing.T) {
fName1 := createFile()

// sleep for 5 seconds
time.Sleep(5 * time.Second)
time.Sleep(sleepTime)
// delete files older than 5 seconds
filter := FileFilters{
OlderThan: ttl,
Expand All @@ -123,7 +124,7 @@ func TestDeleteFilesOlderThan(t *testing.T) {
t.Run("custom check props negative test", func(t *testing.T) {
fName := createFile()
// sleep for 5 seconds
time.Sleep(5 * time.Second)
time.Sleep(sleepTime)
// delete files older than 5 seconds
filter := FileFilters{
OlderThan: ttl,
Expand All @@ -140,7 +141,7 @@ func TestDeleteFilesOlderThan(t *testing.T) {
fName1 := createFile()

// sleep for 5 seconds
time.Sleep(5 * time.Second)
time.Sleep(sleepTime)
// delete files older than 5 seconds
filter := FileFilters{
OlderThan: ttl,
Expand Down

0 comments on commit 42820e6

Please sign in to comment.