Fix distbuild watch folders (squashed)
This commit is contained in:
parent
7b6a52c190
commit
a914bcd96c
4 changed files with 50 additions and 8 deletions
|
@ -25,15 +25,15 @@
|
|||
- task: tarstreamtest
|
||||
score: 100
|
||||
watch:
|
||||
- distbuild
|
||||
- distbuild/pkg/tarstream
|
||||
- task: filecachetest
|
||||
score: 100
|
||||
watch:
|
||||
- distbuild
|
||||
- distbuild/pkg/filecache
|
||||
- task: artifacttest
|
||||
score: 100
|
||||
watch:
|
||||
- distbuild
|
||||
- distbuild/pkg/artifact
|
||||
|
||||
- group: Generics
|
||||
start: 08-04-2022 21:00
|
||||
|
|
|
@ -97,7 +97,7 @@ func findChangedTasks(d Deadlines, files []string) []string {
|
|||
|
||||
for _, task := range d.Tasks() {
|
||||
for _, path := range task.Watch {
|
||||
if components[0] == path {
|
||||
if strings.HasPrefix(f, path) {
|
||||
tasks[task.Name] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,36 @@ func TestDeadlines(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDetectChange(t *testing.T) {
|
||||
d, err := loadDeadlines("../../../.deadlines.yml")
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
deadlines string
|
||||
changedFiles []string
|
||||
changedTasks []string
|
||||
}{
|
||||
{
|
||||
name: "sum", // Original deadlines file with sum task.
|
||||
deadlines: "../../../.deadlines.yml",
|
||||
changedFiles: []string{"sum/sum.go", "testtool/foo.go", "README.md"},
|
||||
changedTasks: []string{"sum"},
|
||||
},
|
||||
{
|
||||
name: "tarstreamtest", // Deadlines file with tarstreamtest task.
|
||||
deadlines: "../testdata/deadlines/.deadlines.yml",
|
||||
changedFiles: []string{
|
||||
"sum/sum.go",
|
||||
"testtool/foo.go",
|
||||
"distbuild/pkg/tarstream/stream.go",
|
||||
"README.md",
|
||||
},
|
||||
changedTasks: []string{"sum", "tarstreamtest"},
|
||||
},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
d, err := loadDeadlines(tc.deadlines)
|
||||
require.NoError(t, err)
|
||||
|
||||
changed := findChangedTasks(d, []string{"sum/sum.go", "testtool/foo.go", "README.md"})
|
||||
require.Equal(t, []string{"sum"}, changed)
|
||||
changed := findChangedTasks(d, tc.changedFiles)
|
||||
require.Equal(t, tc.changedTasks, changed)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
15
tools/testtool/testdata/deadlines/.deadlines.yml
vendored
Normal file
15
tools/testtool/testdata/deadlines/.deadlines.yml
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
- group: "[HW] Dist Build Blocks"
|
||||
start: 14-04-2022 17:59
|
||||
deadline: 28-04-2022 23:59
|
||||
tasks:
|
||||
- task: tarstreamtest
|
||||
score: 100
|
||||
watch:
|
||||
- distbuild/pkg/tarstream
|
||||
|
||||
- group: Hello World
|
||||
start: 10-02-2022 18:00
|
||||
deadline: 20-02-2022 23:59
|
||||
tasks:
|
||||
- task: sum
|
||||
score: 100
|
Loading…
Reference in a new issue