@@ -19,10 +19,11 @@ import (
19
19
)
20
20
21
21
func setupParser (t * testing.T , options ... * ParserOptions ) * Parser {
22
- os .Setenv ("SHIPYARD_CONFIG" , "/User/yamcha/.shipyard" )
22
+ home := os .Getenv ("HOME" )
23
+ os .Setenv ("HOME" , t .TempDir ())
23
24
24
25
t .Cleanup (func () {
25
- os .Unsetenv ( "SHIPYARD_CONFIG" )
26
+ os .Setenv ( "HOME" , home )
26
27
})
27
28
28
29
o := DefaultOptions ()
@@ -385,6 +386,25 @@ func TestParseModuleCreatesResources(t *testing.T) {
385
386
386
387
}
387
388
389
+ func TestParseModuleDoesNotCacheLocalFiles (t * testing.T ) {
390
+ absoluteFolderPath , err := filepath .Abs ("./test_fixtures/modules/modules.hcl" )
391
+ if err != nil {
392
+ t .Fatal (err )
393
+ }
394
+
395
+ p := setupParser (t )
396
+
397
+ c , err := p .ParseFile (absoluteFolderPath )
398
+ require .NoError (t , err )
399
+ require .NotNil (t , c )
400
+
401
+ // the remote module should be cached
402
+ require .DirExists (t , filepath .Join (p .options .ModuleCache , "github.com_jumppad-labs_hclconfig_test_fixtures_single" ))
403
+
404
+ // the local module should not be cached
405
+ require .NoDirExists (t , filepath .Join (p .options .ModuleCache , "single" ))
406
+ }
407
+
388
408
func TestParseModuleCreatesOutputs (t * testing.T ) {
389
409
absoluteFolderPath , err := filepath .Abs ("./test_fixtures/modules/modules.hcl" )
390
410
if err != nil {
0 commit comments