intermittent unit failure: DebugHooksServerSuite.TestRunHook

Bug #1749320 reported by Anastasia on 2018-02-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju
Medium
John A Meinel
2.3
Medium
John A Meinel

Bug Description

As per http://ci.jujucharms.com/blue/organizations/jenkins/github-merge-juju/detail/github-merge-juju/47/pipeline:

FAIL: server_test.go:150: DebugHooksServerSuite.TestRunHook

server_test.go:214:

    s.verifyEnvshFile(c, envsh, hookName)

server_test.go:235:

    c.Assert(contents, jc.Contains, fmt.Sprintf("JUJU_UNIT_NAME=%q", s.ctx.Unit))

... obtained string = ""

... expected string = "JUJU_UNIT_NAME=\"foo/8\""

OOPS: 4 passed, 1 FAILED

--- FAIL: TestPackage (0.04s)

FAIL

FAIL github.com/juju/juju/worker/uniter/runner/debug 1.235s

John A Meinel (jameinel) wrote :
Changed in juju:
assignee: nobody → John A Meinel (jameinel)
John A Meinel (jameinel) wrote :

I'm able to reproduce this with this patch:
+(/bin/sleep 2 ; export) | grep -v $FILTER > $JUJU_DEBUG/env.sh

for some reason I don't understand:
(sleep 2; export)

*doesn't* trigger this, but /bin/sleep does.

I think the underlying race condition is that

blah > target

will create 'target' as soon as that line starts, but nothing actually gets written until 'blah' exits.

However, the test as written assumes that as soon as "stat env.sh" succeeds, that it can then read the contents of env.sh.
We either want a loop that checks to see if env.sh is empty, or write to a temp file and rename into place.

John A Meinel (jameinel) wrote :
John A Meinel (jameinel) wrote :
Changed in juju:
milestone: none → 2.4-beta1
status: Triaged → In Progress
John A Meinel (jameinel) on 2018-02-28
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers