Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions alpha/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ func (c *Channel) validateReplacesChain() error {
if _, ok := chainFrom[cur.Name]; !ok {
chainFrom[cur.Name] = []string{cur.Name}
}
// if the replaces edge is known to be skipped, disregard it
if skippedBundles.Has(cur.Replaces) {
break
}
for k := range chainFrom {
chainFrom[k] = append(chainFrom[k], cur.Replaces)
}
Expand Down
10 changes: 9 additions & 1 deletion alpha/model/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,15 @@ func TestValidReplacesChain(t *testing.T) {
}},
assertion: hasError(`channel contains one or more stranded bundles: anakin.v0.0.1`),
},
}
{
name: "Error/SkippedReplacesStranded",
ch: Channel{Bundles: map[string]*Bundle{
"anakin.v0.0.1": {Name: "anakin.v0.0.1"},
"anakin.v0.0.2": {Name: "anakin.v0.0.2", Replaces: "anakin.v0.0.1"},
"anakin.v0.0.3": {Name: "anakin.v0.0.3", Replaces: "anakin.v0.0.2", Skips: []string{"anakin.v0.0.2"}},
}},
assertion: hasError(`channel contains one or more stranded bundles: anakin.v0.0.1`),
}}
for _, s := range specs {
t.Run(s.name, func(t *testing.T) {
err := s.ch.validateReplacesChain()
Expand Down
Loading