@@ -55,7 +55,7 @@ func TestSnapshotSaveDefaultDestination(t *testing.T) {
5555 dir := t .TempDir ()
5656
5757 stdout , stderr , err := runLstk (t , ctx , dir ,
58- env .With (env .LocalStackHost , lsHost (srv )),
58+ env .Environ ( testEnvWithHome ( t . TempDir (), "" )). With (env .LocalStackHost , lsHost (srv )),
5959 "--non-interactive" , "snapshot" , "save" ,
6060 )
6161 require .NoError (t , err , "lstk snapshot save failed: %s" , stderr )
@@ -85,7 +85,7 @@ func TestSnapshotSaveCustomPath(t *testing.T) {
8585 outPath := filepath .Join (dir , "my-snap.zip" )
8686
8787 stdout , stderr , err := runLstk (t , ctx , dir ,
88- env .With (env .LocalStackHost , lsHost (srv )),
88+ env .Environ ( testEnvWithHome ( t . TempDir (), "" )). With (env .LocalStackHost , lsHost (srv )),
8989 "--non-interactive" , "snapshot" , "save" , outPath ,
9090 )
9191 require .NoError (t , err , "lstk snapshot save failed: %s" , stderr )
@@ -112,7 +112,7 @@ func TestSnapshotSaveRelativePath(t *testing.T) {
112112 dir := t .TempDir ()
113113
114114 stdout , stderr , err := runLstk (t , ctx , dir ,
115- env .With (env .LocalStackHost , lsHost (srv )),
115+ env .Environ ( testEnvWithHome ( t . TempDir (), "" )). With (env .LocalStackHost , lsHost (srv )),
116116 "--non-interactive" , "snapshot" , "save" , "./my-state" ,
117117 )
118118 require .NoError (t , err , "lstk snapshot save failed: %s" , stderr )
@@ -135,7 +135,7 @@ func TestSnapshotSaveOverwritesExistingFile(t *testing.T) {
135135 require .NoError (t , os .WriteFile (outPath , []byte ("OLD" ), 0600 ))
136136
137137 _ , stderr , err := runLstk (t , ctx , dir ,
138- env .With (env .LocalStackHost , lsHost (srv )),
138+ env .Environ ( testEnvWithHome ( t . TempDir (), "" )). With (env .LocalStackHost , lsHost (srv )),
139139 "--non-interactive" , "snapshot" , "save" , outPath ,
140140 )
141141 require .NoError (t , err , "lstk snapshot save should overwrite: %s" , stderr )
@@ -188,7 +188,7 @@ func TestSnapshotSaveInvalidParentDir(t *testing.T) {
188188 srv := mockStateServer (t )
189189
190190 _ , stderr , err := runLstk (t , ctx , t .TempDir (),
191- env .With (env .LocalStackHost , lsHost (srv )),
191+ env .Environ ( testEnvWithHome ( t . TempDir (), "" )). With (env .LocalStackHost , lsHost (srv )),
192192 "--non-interactive" , "snapshot" , "save" , "/no/such/dir/state" ,
193193 )
194194 requireExitCode (t , 1 , err )
@@ -206,7 +206,7 @@ func TestSnapshotSaveTelemetryEmitted(t *testing.T) {
206206
207207 analyticsSrv , events := mockAnalyticsServer (t )
208208 _ , stderr , err := runLstk (t , ctx , t .TempDir (),
209- env .With (env .LocalStackHost , lsHost (srv )).With (env .AnalyticsEndpoint , analyticsSrv .URL ),
209+ env .Environ ( testEnvWithHome ( t . TempDir (), "" )). With (env .LocalStackHost , lsHost (srv )).With (env .AnalyticsEndpoint , analyticsSrv .URL ),
210210 "--non-interactive" , "snapshot" , "save" ,
211211 )
212212 require .NoError (t , err , "lstk snapshot save failed: %s" , stderr )
@@ -223,7 +223,7 @@ func TestSnapshotSaveTelemetryOnFailure(t *testing.T) {
223223
224224 analyticsSrv , events := mockAnalyticsServer (t )
225225 _ , _ , err := runLstk (t , ctx , t .TempDir (),
226- env .With (env .AnalyticsEndpoint , analyticsSrv .URL ),
226+ env .Environ ( testEnvWithHome ( t . TempDir (), "" )). With (env .AnalyticsEndpoint , analyticsSrv .URL ),
227227 "--non-interactive" , "snapshot" , "save" ,
228228 )
229229 requireExitCode (t , 1 , err )
@@ -241,7 +241,7 @@ func TestSnapshotSaveInteractive(t *testing.T) {
241241 dir := t .TempDir ()
242242
243243 out , err := runLstkInPTY (t , ctx ,
244- env .With (env .LocalStackHost , lsHost (srv )),
244+ env .Environ ( testEnvWithHome ( t . TempDir (), "" )). With (env .LocalStackHost , lsHost (srv )),
245245 "snapshot" , "save" , filepath .Join (dir , "snap" ),
246246 )
247247 require .NoError (t , err , "interactive lstk snapshot save failed" )
0 commit comments