-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
Copy pathrevision.go
58 lines (48 loc) · 1.76 KB
/
revision.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package builds
import (
"context"
"fmt"
g "github.com/onsi/ginkgo/v2"
o "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
admissionapi "k8s.io/pod-security-admission/api"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[sig-builds][Feature:Builds] build have source revision metadata", func() {
defer g.GinkgoRecover()
var (
buildFixture = exutil.FixturePath("testdata", "builds", "test-build-revision.json")
oc = exutil.NewCLIWithPodSecurityLevel("cli-build-revision", admissionapi.LevelBaseline)
)
g.Context("", func() {
g.BeforeEach(func() {
exutil.PreTestDump()
})
g.JustBeforeEach(func() {
oc.Run("create").Args("-f", buildFixture).Execute()
})
g.AfterEach(func() {
if g.CurrentSpecReport().Failed() {
exutil.DumpPodStates(oc)
exutil.DumpConfigMapStates(oc)
exutil.DumpPodLogsStartingWith("", oc)
}
})
g.Describe("started build", func() {
g.It("should contain source revision information [apigroup:build.openshift.io]", func() {
g.By("starting the build")
br, _ := exutil.StartBuildAndWait(oc, "sample-build")
br.AssertSuccess()
g.By(fmt.Sprintf("verifying the status of %q", br.BuildPath))
build, err := oc.BuildClient().BuildV1().Builds(oc.Namespace()).Get(context.Background(), br.Build.Name, metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(build.Spec.Revision).NotTo(o.BeNil())
o.Expect(build.Spec.Revision.Git).NotTo(o.BeNil())
o.Expect(build.Spec.Revision.Git.Commit).NotTo(o.BeEmpty())
o.Expect(build.Spec.Revision.Git.Author.Name).NotTo(o.BeEmpty())
o.Expect(build.Spec.Revision.Git.Committer.Name).NotTo(o.BeEmpty())
o.Expect(build.Spec.Revision.Git.Message).NotTo(o.BeEmpty())
})
})
})
})