Skip to content

Commit dd24ace

Browse files
Merge pull request #702 from joelanford/reapply-691
declcfg: validation should allow non-existent replaces value (re-apply #691)
2 parents 4335a01 + f7a7bb4 commit dd24ace

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

internal/model/model.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,6 @@ func (b *Bundle) Validate() error {
232232
if b.Channel != nil && b.Package != nil && b.Package != b.Channel.Package {
233233
result.subErrors = append(result.subErrors, errors.New("package does not match channel's package"))
234234
}
235-
if b.Replaces != "" {
236-
if b.Channel != nil && b.Channel.Bundles != nil {
237-
if _, ok := b.Channel.Bundles[b.Replaces]; !ok {
238-
result.subErrors = append(result.subErrors, fmt.Errorf("replaces %q not found in channel", b.Replaces))
239-
}
240-
}
241-
}
242235
props, err := property.Parse(b.Properties)
243236
if err != nil {
244237
result.subErrors = append(result.subErrors, err)

internal/model/model_test.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,20 @@ func TestValidators(t *testing.T) {
378378
},
379379
assertion: require.NoError,
380380
},
381+
{
382+
name: "Bundle/Success/ReplacesNotInChannel",
383+
v: &Bundle{
384+
Package: pkg,
385+
Channel: ch,
386+
Name: "anakin.v0.1.0",
387+
Image: "registry.io/image",
388+
Replaces: "anakin.v0.0.0",
389+
Properties: []property.Property{
390+
property.MustBuildPackage("anakin", "0.1.0"),
391+
},
392+
},
393+
assertion: require.NoError,
394+
},
381395
{
382396
name: "Bundle/Success/NoBundleImage/HaveBundleData",
383397
v: &Bundle{
@@ -440,16 +454,6 @@ func TestValidators(t *testing.T) {
440454
},
441455
assertion: require.Error,
442456
},
443-
{
444-
name: "Bundle/Error/ReplacesNotInChannel",
445-
v: &Bundle{
446-
Package: pkg,
447-
Channel: ch,
448-
Name: "anakin.v0.1.0",
449-
Replaces: "anakin.v0.0.0",
450-
},
451-
assertion: require.Error,
452-
},
453457
{
454458
name: "Bundle/Error/InvalidProperty",
455459
v: &Bundle{

0 commit comments

Comments
 (0)