@@ -50,16 +50,34 @@ func testIndividualPlan(t *testing.T, testPath string) {
50
50
assert .NoError (err , "plan.json should parse correctly" )
51
51
expected .Errors = nil
52
52
53
- // For now we only compare the DevPackages and RuntimePackages fields:
54
53
assert .ElementsMatch (expected .DevPackages , plan .DevPackages , "DevPackages should match" )
55
54
assert .ElementsMatch (expected .RuntimePackages , plan .RuntimePackages , "RuntimePackages should match" )
56
55
assert .Equal (expected .InstallStage .GetCommand (), plan .InstallStage .GetCommand (), "Install stage should match" )
57
56
assert .Equal (expected .BuildStage .GetCommand (), plan .BuildStage .GetCommand (), "Build stage should match" )
58
57
assert .Equal (expected .StartStage .GetCommand (), plan .StartStage .GetCommand (), "Start stage should match" )
58
+ // Check that input files are the same for all stages.
59
+ // Depending on where the test command is invoked, the input file paths can be different.
60
+ // We will compare the file name only.
61
+ assert .ElementsMatch (expected .InstallStage .GetInputFiles (), getFileNames (plan .InstallStage .GetInputFiles ()), "InstallStage.InputFiles should match" )
62
+ assert .ElementsMatch (expected .BuildStage .GetInputFiles (), getFileNames (plan .BuildStage .GetInputFiles ()), "BuildStage.InputFiles should match" )
63
+ assert .ElementsMatch (expected .StartStage .GetInputFiles (), getFileNames (plan .StartStage .GetInputFiles ()), "StartStage.InputFiles should match" )
59
64
})
60
65
}
61
66
62
67
func fileExists (path string ) bool {
63
68
_ , err := os .Stat (path )
64
69
return err == nil
65
70
}
71
+
72
+ func getFileNames (paths []string ) []string {
73
+ names := []string {}
74
+ for _ , path := range paths {
75
+ if path == "." {
76
+ names = append (names , path )
77
+ } else {
78
+ names = append (names , filepath .Base (path ))
79
+ }
80
+ }
81
+
82
+ return names
83
+ }
0 commit comments