Skip to content

bundle validate - unexpected return code after test failure #6247

@nmars

Description

@nmars

Bug Report

What did you do?

We have a bundle used in CI testing where we expect bundle validate to fail, and for operator-sdk to return non-zero. But the latest operator-sdk does not return a non-zero value when bundle validate tests fail.

What did you expect to see?

Here's how an older operator-sdk version would return 1 with test failures:

$ operator-sdk-v1.16 version
operator-sdk version: "v1.16.0", commit: "560044140c4f3d88677e4ef2872931f5bb97f255", kubernetes version: "1.21", go version: "go1.16.13", GOOS: "linux", GOARCH: "amd64"

$ operator-sdk-v1.16 bundle validate ./my-expected-to-fail-bundle
ERRO[0000] Error: Value image.openshift.io/v1, Kind=ImageStream: unsupported media type registry+v1 for bundle object 

$ echo $?
1

What did you see instead? Under which circumstances?

But the latest version (v1.26.0) returns 0:

$ operator-sdk bundle validate ./my-expected-to-fail-bundle
ERRO[0000] Error: Value image.openshift.io/v1, Kind=ImageStream: unsupported media type registry+v1 for bundle object 
ERRO[0000] Error: Field spec.preserveUnknownFields, Value 0xc00090fcd8: spec.preserveUnknownFields: Invalid value: true: cannot set to true, set x-kubernetes-preserve-unknown-fields to true in spec.versions[*].schema instead 

$ echo $?
0

Environment

Operator type:

/language go

Kubernetes cluster type:

OpenShift

$ operator-sdk version

$ operator-sdk version
operator-sdk version: "v1.26.0", commit: "cbeec475e4612e19f1047ff7014342afe93f60d2", kubernetes version: "1.25.0", go version: "go1.19.3", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

$ go version
go version go1.19.3 linux/amd64

$ kubectl version

$ oc version
Client Version: 4.11.1
Kustomize Version: v4.5.4
Server Version: 4.10.40
Kubernetes Version: v1.23.12+7566c4d

Possible Solution

Additional context

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.language/goIssue is related to a Go operator project

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions