Skip to content

Commit b432468

Browse files
committed
Update output of integration:breakdown.
1 parent 43d49bc commit b432468

File tree

1 file changed

+44
-10
lines changed

1 file changed

+44
-10
lines changed

magefile.go

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,24 +2593,58 @@ func getSupportedBatches(matrix bool) ([]tcommon.OSBatch, tcommon.Config, error)
25932593
return osBatches, cfg, nil
25942594
}
25952595

2596+
type groupSummary struct {
2597+
Name string `yaml:"name"`
2598+
OS []tcommon.SupportedOS `yaml:"os"`
2599+
RequireSudo bool `yaml:"require_sudo"`
2600+
Tests []string `yaml:"tests"`
2601+
}
2602+
25962603
func writeBreakdown(matrix bool) error {
2597-
batches, cfg, err := getSupportedBatches(matrix)
2604+
batches, _, err := getSupportedBatches(matrix)
25982605
if err != nil {
25992606
return err
26002607
}
26012608

2602-
// cleanup OS duplicate information no longer needed as it
2603-
// was used to create the OSBatch, but no longer needed in this
2604-
// representation
2605-
for i, batch := range batches {
2606-
batch.Batch.OS = define.OS{}
2607-
if batch.Batch.Stack != nil {
2608-
batch.Batch.Stack.Version = cfg.StackVersion
2609+
groupsByName := make(map[string]groupSummary)
2610+
for _, batch := range batches {
2611+
if len(batch.Batch.SudoTests) > 0 {
2612+
groupName := fmt.Sprintf("%s-sudo", batch.Batch.Group)
2613+
group, _ := groupsByName[groupName]
2614+
group.Name = groupName
2615+
group.RequireSudo = true
2616+
group.OS = append(group.OS, batch.OS)
2617+
for _, pack := range batch.Batch.SudoTests {
2618+
for _, packTest := range pack.Tests {
2619+
if !slices.Contains(group.Tests, packTest.Name) {
2620+
group.Tests = append(group.Tests, packTest.Name)
2621+
}
2622+
}
2623+
}
2624+
groupsByName[groupName] = group
2625+
}
2626+
if len(batch.Batch.Tests) > 0 {
2627+
groupName := batch.Batch.Group
2628+
group, _ := groupsByName[groupName]
2629+
group.Name = groupName
2630+
group.OS = append(group.OS, batch.OS)
2631+
for _, pack := range batch.Batch.SudoTests {
2632+
for _, packTest := range pack.Tests {
2633+
if !slices.Contains(group.Tests, packTest.Name) {
2634+
group.Tests = append(group.Tests, packTest.Name)
2635+
}
2636+
}
2637+
}
2638+
groupsByName[groupName] = group
26092639
}
2610-
batches[i] = batch
26112640
}
26122641

2613-
data, err := yaml.Marshal(batches)
2642+
groups := make([]groupSummary, 0, len(groupsByName))
2643+
for _, group := range groupsByName {
2644+
groups = append(groups, group)
2645+
}
2646+
2647+
data, err := yaml.Marshal(groups)
26142648
if err != nil {
26152649
return err
26162650
}

0 commit comments

Comments
 (0)