intermittent unit failure: DebugHooksServerSuite.TestRunHook

Bug #1749320 reported by Anastasia
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
John A Meinel
2.3
Fix Released
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

Revision history for this message
John A Meinel (jameinel) wrote :
Changed in juju:
assignee: nobody → John A Meinel (jameinel)
Revision history for this message
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.

Revision history for this message
John A Meinel (jameinel) wrote :
Revision history for this message
John A Meinel (jameinel) wrote :
Changed in juju:
milestone: none → 2.4-beta1
status: Triaged → In Progress
John A Meinel (jameinel)
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.