@@ -11,7 +11,6 @@ import (
1111 "github.com/stretchr/testify/require"
1212
1313 "cdr.dev/slog"
14- "github.com/coder/coder/v2/provisionersdk"
1514 "github.com/coder/coder/v2/provisionersdk/tfpath"
1615 "github.com/coder/coder/v2/testutil"
1716)
@@ -47,9 +46,11 @@ func TestStaleSessions(t *testing.T) {
4746 addSessionFolder (t , fs , second , now .Add (- 8 * 24 * time .Hour ))
4847 third := tfpath .Session (workDirectory , uuid .NewString ())
4948 addSessionFolder (t , fs , third , now .Add (- 9 * 24 * time .Hour ))
49+ tfDir := tfpath .FromWorkingDirectory (workDirectory )
5050
5151 // when
52- provisionersdk .CleanStaleSessions (ctx , workDirectory , fs , now , logger )
52+ err := tfDir .CleanStaleSessions (ctx , logger , fs , now )
53+ require .NoError (t , err )
5354
5455 // then
5556 entries , err := afero .ReadDir (fs , workDirectory )
@@ -70,9 +71,11 @@ func TestStaleSessions(t *testing.T) {
7071 addSessionFolder (t , fs , first , now .Add (- 7 * 24 * time .Hour ))
7172 second := tfpath .Session (workDirectory , uuid .NewString ())
7273 addSessionFolder (t , fs , second , now .Add (- 6 * 24 * time .Hour ))
74+ tfDir := tfpath .FromWorkingDirectory (workDirectory )
7375
7476 // when
75- provisionersdk .CleanStaleSessions (ctx , workDirectory , fs , now , logger )
77+ err := tfDir .CleanStaleSessions (ctx , logger , fs , now )
78+ require .NoError (t , err )
7679
7780 // then
7881 entries , err := afero .ReadDir (fs , workDirectory )
@@ -94,9 +97,11 @@ func TestStaleSessions(t *testing.T) {
9497 addSessionFolder (t , fs , first , now .Add (- 6 * 24 * time .Hour ))
9598 second := tfpath .Session (workDirectory , uuid .NewString ())
9699 addSessionFolder (t , fs , second , now .Add (- 5 * 24 * time .Hour ))
100+ tfDir := tfpath .FromWorkingDirectory (workDirectory )
97101
98102 // when
99- provisionersdk .CleanStaleSessions (ctx , workDirectory , fs , now , logger )
103+ err := tfDir .CleanStaleSessions (ctx , logger , fs , now )
104+ require .NoError (t , err )
100105
101106 // then
102107 entries , err := afero .ReadDir (fs , workDirectory )
0 commit comments