@@ -20,7 +20,7 @@ package pipeline
20
20
import (
21
21
"context"
22
22
"fmt"
23
- "path/filepath "
23
+ "path"
24
24
"testing"
25
25
"time"
26
26
@@ -90,17 +90,17 @@ func TestCleanupService_shouldDeleteDirectory(t *testing.T) {
90
90
newDirName := fmt .Sprintf ("%s-%s" , shard .Name , now .Add (- 1 * time .Hour ).Format ("20060102-150405" ))
91
91
92
92
// Create old directory with uploaded files
93
- oldUploadedPath := filepath .Join (oldDirName , "uploaded" )
93
+ oldUploadedPath := path .Join (oldDirName , "uploaded" )
94
94
err = storage .MkdirAll (oldUploadedPath )
95
95
require .NoError (t , err )
96
- err = storage .WriteFile (filepath .Join (oldUploadedPath , "test.ach" ), []byte ("test content" ))
96
+ err = storage .WriteFile (path .Join (oldUploadedPath , "test.ach" ), []byte ("test content" ))
97
97
require .NoError (t , err )
98
98
99
99
// Create new directory with uploaded files
100
- newUploadedPath := filepath .Join (newDirName , "uploaded" )
100
+ newUploadedPath := path .Join (newDirName , "uploaded" )
101
101
err = storage .MkdirAll (newUploadedPath )
102
102
require .NoError (t , err )
103
- err = storage .WriteFile (filepath .Join (newUploadedPath , "test.ach" ), []byte ("test content" ))
103
+ err = storage .WriteFile (path .Join (newUploadedPath , "test.ach" ), []byte ("test content" ))
104
104
require .NoError (t , err )
105
105
106
106
// Create directory without uploaded subdirectory (use different timestamp to avoid conflict)
@@ -154,26 +154,26 @@ func TestCleanupService_runCleanup(t *testing.T) {
154
154
// Create directories to test
155
155
// 1. Old directory with uploaded files (should be deleted)
156
156
oldDir1 := fmt .Sprintf ("%s-%s" , shard .Name , now .Add (- 48 * time .Hour ).Format ("20060102-150405" ))
157
- oldUploadedPath1 := filepath .Join (oldDir1 , "uploaded" )
157
+ oldUploadedPath1 := path .Join (oldDir1 , "uploaded" )
158
158
err = storage .MkdirAll (oldUploadedPath1 )
159
159
require .NoError (t , err )
160
- err = storage .WriteFile (filepath .Join (oldUploadedPath1 , "test1.ach" ), []byte ("test content 1" ))
160
+ err = storage .WriteFile (path .Join (oldUploadedPath1 , "test1.ach" ), []byte ("test content 1" ))
161
161
require .NoError (t , err )
162
162
163
163
// 2. Another old directory with uploaded files (should be deleted)
164
164
oldDir2 := fmt .Sprintf ("%s-%s" , shard .Name , now .Add (- 72 * time .Hour ).Format ("20060102-150405" ))
165
- oldUploadedPath2 := filepath .Join (oldDir2 , "uploaded" )
165
+ oldUploadedPath2 := path .Join (oldDir2 , "uploaded" )
166
166
err = storage .MkdirAll (oldUploadedPath2 )
167
167
require .NoError (t , err )
168
- err = storage .WriteFile (filepath .Join (oldUploadedPath2 , "test2.ach" ), []byte ("test content 2" ))
168
+ err = storage .WriteFile (path .Join (oldUploadedPath2 , "test2.ach" ), []byte ("test content 2" ))
169
169
require .NoError (t , err )
170
170
171
171
// 3. New directory (should not be deleted)
172
172
newDir := fmt .Sprintf ("%s-%s" , shard .Name , now .Add (- 1 * time .Hour ).Format ("20060102-150405" ))
173
- newUploadedPath := filepath .Join (newDir , "uploaded" )
173
+ newUploadedPath := path .Join (newDir , "uploaded" )
174
174
err = storage .MkdirAll (newUploadedPath )
175
175
require .NoError (t , err )
176
- err = storage .WriteFile (filepath .Join (newUploadedPath , "test3.ach" ), []byte ("test content 3" ))
176
+ err = storage .WriteFile (path .Join (newUploadedPath , "test3.ach" ), []byte ("test content 3" ))
177
177
require .NoError (t , err )
178
178
179
179
// 4. Old directory without uploaded files (should not be deleted)
@@ -237,10 +237,10 @@ func TestCleanupService_GetStats(t *testing.T) {
237
237
// Create test directories
238
238
// Old directory eligible for deletion
239
239
oldDir := fmt .Sprintf ("%s-%s" , shard .Name , now .Add (- 48 * time .Hour ).Format ("20060102-150405" ))
240
- oldUploadedPath := filepath .Join (oldDir , "uploaded" )
240
+ oldUploadedPath := path .Join (oldDir , "uploaded" )
241
241
err = storage .MkdirAll (oldUploadedPath )
242
242
require .NoError (t , err )
243
- err = storage .WriteFile (filepath .Join (oldUploadedPath , "test.ach" ), []byte ("test content" ))
243
+ err = storage .WriteFile (path .Join (oldUploadedPath , "test.ach" ), []byte ("test content" ))
244
244
require .NoError (t , err )
245
245
246
246
// New directory not eligible
0 commit comments