Skip to content
Closed
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
41 changes: 41 additions & 0 deletions test/extended/operators/olm.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package operators

import (
"context"
"fmt"
"github.com/google/go-github/github"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bparees I import a new package here, do you know how to just update its vendor? I used the make update-deps command before, but it updated all vendor versions. It causes many package dependency issues.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not possible as far as i know.

updating vendor versions of things should not break things, if it does then our deps are not properly pinned.

g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"

exutil "github.com/openshift/origin/test/extended/util"
"k8s.io/apimachinery/pkg/util/wait"
e2e "k8s.io/kubernetes/test/e2e/framework"
Expand Down Expand Up @@ -106,6 +109,44 @@ var _ = g.Describe("[Feature:Platform] OLM should", func() {
}
})

// OCP-20981, [BZ 1626434]The olm/catalog binary should output the exact version info
// author: jiazha@redhat.com
g.It("[Serial] olm version should contain the source commit id", func() {
sameCommit := ""
subPods := []string{"catalog-operator", "olm-operator", "packageserver"}

for _, v := range subPods {
podName, err := oc.AsAdmin().Run("get").Args("-n", "openshift-operator-lifecycle-manager", "pods", "-l", fmt.Sprintf("app=%s", v), "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("get pod name:%s", podName)

g.By(fmt.Sprintf("get olm version from the %s pod", v))
oc.SetNamespace("openshift-operator-lifecycle-manager")
commands := []string{"exec", podName, "--", "olm", "--version"}
olmVersion, err := oc.AsAdmin().Run(commands...).Args().Output()
o.Expect(err).NotTo(o.HaveOccurred())
idSlice := strings.Split(olmVersion, ":")
gitCommitID := strings.TrimSpace(idSlice[len(idSlice)-1])
e2e.Logf("olm source git commit ID:%s", gitCommitID)
if len(gitCommitID) != 40 {
e2e.Failf(fmt.Sprintf("the length of the git commit id is %d, != 40", len(gitCommitID)))
}

if sameCommit == "" {
sameCommit = gitCommitID
g.By("checking this commitID in the operator-lifecycle-manager repo")
client := github.NewClient(nil)
_, _, err := client.Git.GetCommit(context.Background(), "operator-framework", "operator-lifecycle-manager", gitCommitID)
if err != nil {
e2e.Failf("Git.GetCommit returned error: %v", err)
}
o.Expect(err).NotTo(o.HaveOccurred())

} else if gitCommitID != sameCommit {
e2e.Failf("These commitIDs inconformity!!!")
}
}
})
})

// This context will cover test case: OCP-23440, author: jiazha@redhat.com
Expand Down