From ac79e7ebb9b5f0868c82a6c36b99fbaefc99d762 Mon Sep 17 00:00:00 2001 From: yasun Date: Thu, 25 Apr 2024 16:26:27 +0800 Subject: [PATCH] OCM-7614 | fix: Get the merged commit but not the pull request commit update update update --- images/Dockerfile.e2e | 2 +- tests/e2e/e2e_pre_check_test.go | 6 ++++-- tests/utils/exec/rosacli/pr_check.go | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/images/Dockerfile.e2e b/images/Dockerfile.e2e index 2ffad46e2c..fd6923edd2 100644 --- a/images/Dockerfile.e2e +++ b/images/Dockerfile.e2e @@ -5,7 +5,7 @@ COPY . . RUN go install ./cmd/rosa RUN go test -c -o /go/bin/rosatest ./tests/e2e RUN rosa verify openshift-client -RUN rosatest --ginkgo.label-filter "e2e-commit" +RUN rosatest --ginkgo.no-color --ginkgo.label-filter "e2e-commit" FROM registry.ci.openshift.org/ci/cli-ocm:latest as ocmcli diff --git a/tests/e2e/e2e_pre_check_test.go b/tests/e2e/e2e_pre_check_test.go index 6c3ef92d81..77177e9ab1 100644 --- a/tests/e2e/e2e_pre_check_test.go +++ b/tests/e2e/e2e_pre_check_test.go @@ -12,11 +12,13 @@ import ( var _ = Describe("PreCheck", func() { It("commits-focus", labels.E2ECommit, func() { - author, err := rosacli.GetCommitAuthor() + _, err := rosacli.GetCommitAuthor() Expect(err).ToNot(HaveOccurred()) focus, err := rosacli.GetCommitFoucs() Expect(err).ToNot(HaveOccurred()) - fmt.Printf("[%s] Focus: %v\n", author, focus) + if focus != "" { + fmt.Printf("The latest commit updates the test: %s\n", focus) + } }) }) diff --git a/tests/utils/exec/rosacli/pr_check.go b/tests/utils/exec/rosacli/pr_check.go index 93930448f2..48aa0649d4 100644 --- a/tests/utils/exec/rosacli/pr_check.go +++ b/tests/utils/exec/rosacli/pr_check.go @@ -9,7 +9,7 @@ import ( ) func GetCommitAuthor() (string, error) { - command := "git log -n 1 --pretty=format:%an" + command := "git log -n 1 --no-merges --pretty=format:%an" runner := NewRunner() output, err := runner.RunCMD(strings.Split(command, " ")) @@ -21,7 +21,7 @@ func GetCommitAuthor() (string, error) { } func GetCommitFoucs() (string, error) { - command := "git log -n 1 --pretty=format:%s" + command := "git log -n 1 --no-merges --pretty=format:%s" runner := NewRunner() output, err := runner.RunCMD(strings.Split(command, " "))