Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add junit recording in e2e runner #28133

Merged
merged 2 commits into from
Jul 9, 2016
Merged

Conversation

freehan
Copy link
Contributor

@freehan freehan commented Jun 27, 2016

2nd part of #27825

Injected junit recorder at a few places.

@freehan freehan added the release-note-none Denotes a PR that doesn't merit a release note. label Jun 27, 2016
@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 27, 2016
@@ -21,8 +21,53 @@ set -o nounset
set -o pipefail
set -o xtrace

# include shell2junit library
source <(curl -fsS --retry 3 'https://raw.githubusercontent.com/kubernetes/kubernetes/master/third_party/forked/shell2junit/sh2ju.sh')
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need to curl this? Shouldn't this file be included in whatever PR is getting tested?

Copy link
Member

Choose a reason for hiding this comment

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

IMO it's not good to get it from master-- if it breaks at head it breaks everywhere...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason we need to curl it is because e2e-runner is running as standalone script on jenkins. It does not come with the whole repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

How is this running standalone? Don't you need to clone this repo to get access to the script in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. e2e-runner will pull k8s binary from gcs.
@ixdy

Copy link
Contributor

Choose a reason for hiding this comment

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

@freehan is correct. We curl down e2e-runner.sh which downloads the kubernetes tar from GCS.

echo "${difference}"
echo "!!! FAIL: Google Cloud Platform resources leaked while running tests!"
exit 1
Copy link
Member

Choose a reason for hiding this comment

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

Does the presence of the junit file cause a failure now? Or is an exit 1 still needed somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we do not need to exit here because the record_command will exit upon failure. false is treated as failure.

Copy link
Contributor

Choose a reason for hiding this comment

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

I typically like to return control to main and exit from there, but it's a style choice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

errexit is set, hence e2e runner may exit anywhere.

@k8s-bot
Copy link

k8s-bot commented Jun 27, 2016

GCE e2e build/test passed for commit 5753d0b13a875fafbd808319f46d0b2667d1d283.

@k8s-bot
Copy link

k8s-bot commented Jun 27, 2016

GCE e2e build/test passed for commit 0b2922834a2adc130539f915f2ffb23f8e404f71.

@k8s-bot
Copy link

k8s-bot commented Jun 27, 2016

GCE e2e build/test passed for commit cb9f966e0a34f7650edfcbb32ef8087cf9d99e0a.

@freehan
Copy link
Contributor Author

freehan commented Jun 27, 2016

FYI, the junit result showed up.

See TEST-CLEANUP.xml at here

function record_command() {
set +o xtrace
set +o nounset
set +o errexit
Copy link
Contributor

Choose a reason for hiding this comment

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

Why set + here and then re-set - below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for xtrace, if we leave it on, it will trace all commands in juLog, which is way too noisy.

juLog made the assumption that nounset and errexit were not set. I want to ensure it won't exit accidentally.

@ixdy
Copy link
Member

ixdy commented Jun 28, 2016

I think our tooling looks for junit files named junit*.xml, so maybe we want to change the names?

@freehan
Copy link
Contributor Author

freehan commented Jun 28, 2016

Oh yes. Will change that.

: ${KUBE_GCS_RELEASE_BUCKET:="kubernetes-release"}

# record_command records the command output and error message in junit format
Copy link
Member

Choose a reason for hiding this comment

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

it's not super clear to me from the name/comments that this actually runs the command too,

local -r found=$(echo "${ret}" | grep -c "+++ exit code: 0")
if [[ ${found} -le 0 ]]; then
echo "Last command failed, exiting..."
exit 1
Copy link
Member

Choose a reason for hiding this comment

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

The goal here is to get a build marked "unstable" instead of "failed" which I understand means, now that I unfortunately learned about jenkins, that we shouldn't exit at all (we want to run all the commands) and should print "Test Suite Failed" so that jenkins will mark it unstable (@ixdy is about to turn that plugin on). @ixdy, sound correct?

Copy link
Member

Choose a reason for hiding this comment

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

Hold on that. @fejta is trying to convince us that we shouldn't care about
the difference and that it's perfectly valid to fail like this.

On Tue, Jun 28, 2016 at 3:23 PM, Daniel Smith notifications@github.com
wrote:

In hack/jenkins/e2e-runner.sh
#28133 (comment)
:

  • shift
  • local name=$1
  • shift
  • echo "Recording: ${class} ${name}"
  • echo "Running command: $@"
  • local -r ret=$(juLog -output="${ARTIFACTS}" -class="${class}" -name="${name}" "$@")
  • set -o nounset
  • set -o errexit
  • set -o xtrace
  • since record_command disable errexit, exit script on failure.

  • local -r found=$(echo "${ret}" | grep -c "+++ exit code: 0")
  • if [[ ${found} -le 0 ]]; then
  •    echo "Last command failed, exiting..."
    
  •    exit 1
    

The goal here is to get a build marked "unstable" instead of "failed"
which I understand means, now that I unfortunately learned about jenkins,
that we shouldn't exit at all (we want to run all the commands) and should
print "Test Suite Failed" so that jenkins will mark it unstable (@ixdy
https://github.com/ixdy is about to turn that plugin on). @ixdy
https://github.com/ixdy, sound correct?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/28133/files/498735ea3364f419c967944e9188dba4268b6ca4#r68855336,
or mute the thread
https://github.com/notifications/unsubscribe/AAnglgA-mudyhnqfiFTu9cPQ0RlIcgr5ks5qQZ7_gaJpZM4I_jtj
.

@k8s-bot
Copy link

k8s-bot commented Jun 28, 2016

GCE e2e build/test passed for commit 498735ea3364f419c967944e9188dba4268b6ca4.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 29, 2016
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 29, 2016
@k8s-bot
Copy link

k8s-bot commented Jun 30, 2016

GCE e2e build/test passed for commit 586bb1f.

@freehan
Copy link
Contributor Author

freehan commented Jun 30, 2016

ping

@lavalamp
Copy link
Member

lavalamp commented Jul 8, 2016

Whoops, sorry, didn't realize this was waiting on me. LGTM

@lavalamp lavalamp added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2016
@k8s-bot
Copy link

k8s-bot commented Jul 9, 2016

GCE e2e build/test passed for commit 586bb1f.

@spxtr
Copy link
Contributor

spxtr commented Jul 9, 2016

    <testsuite failures="0" assertions="" name="CLEANUP" tests="1" errors="0" time="">

    <testcase assertions="1" name="gcp_resource_leak_check" time="" classname="CLEANUP">

    <system-out>
<![CDATA[

+++ Running case: CLEANUP.gcp_resource_leak_check 
+++ working dir: /var/lib/jenkins/workspace/kubernetes-pull-build-test-e2e-gce/kubernetes
+++ command: true
+++ exit code: 0
]]>
    </system-out>
    <system-err>
<![CDATA[

]]>
    </system-err>
    </testcase>

    </testsuite>

That's pretty strange looking. I suppose it's valid.

@k8s-bot
Copy link

k8s-bot commented Jul 9, 2016

GCE e2e build/test passed for commit 586bb1f.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jul 9, 2016

GCE e2e build/test passed for commit 586bb1f.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 6eae13e into kubernetes:master Jul 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants