Precise unit test failure discoverySuite.TestDiscoverInitSystemScript
Bug #1433566 reported by
Curtis Hovey
on 2015-03-18
This bug affects 2 people
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | juju-core |
Critical
|
Eric Snow | ||
| | 1.23 |
Critical
|
Eric Snow | ||
Bug Description
Both run-unit-
FAIL: discovery_
FAIL: discoverySuite.
| Curtis Hovey (sinzui) wrote : | #1 |
Eric Snow (ericsnowcurrently)
on 2015-03-18
| Changed in juju-core: | |
| assignee: | nobody → Eric Snow (ericsnowcurrently) |
| status: | Triaged → In Progress |
| Eric Snow (ericsnowcurrently) wrote : | #2 |
It's odd to me that these tests are not failing on master (from what I can tell). Regardless, I'm looking into it.
| Eric Snow (ericsnowcurrently) wrote : | #3 |
Apparently older versions of awk cannot handle \0 as a record separator. The alternative is to use the ps command.
Eric Snow (ericsnowcurrently)
on 2015-03-18
| Changed in juju-core: | |
| status: | In Progress → Fix Committed |
Ian Booth (wallyworld)
on 2015-03-18
| Changed in juju-core: | |
| status: | Fix Committed → In Progress |
| milestone: | 1.23-beta1 → 1.24-alpha1 |
Eric Snow (ericsnowcurrently)
on 2015-03-18
| Changed in juju-core: | |
| status: | In Progress → Fix Committed |
Tim Penhey (thumper)
on 2015-03-19
| Changed in juju-core: | |
| status: | Fix Committed → Fix Released |
To post a comment you must log in.


------- ------- ------- ------- ------- ------- ------- ------- ------- ------- test.go: 333: discoverySuite. TestDiscoverIni tSystemScript
FAIL: discovery_
[LOG] 0:00.056 INFO juju.util.exec run result: exit status 1 test.go: 347: response. Code, gc.Equals, 0)
[LOG] 0:00.075 DEBUG juju.service discovered init system "upstart" from executable "/sbin/init"
discovery_
c.Check(
... obtained int = 1
... expected int = 0
discovery_ test.go: 348: string( response. Stdout) , gc.Equals, initSystem)
c.Check(
... obtained string = ""
... expected string = "upstart"
discovery_ test.go: 349: string( response. Stderr) , gc.Equals, "") 1597969999/ 1/discover_ init_system. sh: line 34: /: Is a directory\n"
c.Check(
... obtained string = "/tmp/check-
... expected string = ""
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- test.go: 359: discoverySuite. TestNewShellSel ectCommand
FAIL: discovery_
cat > /tmp/check- 1597969999/ 7/discover_ init_system. sh << 'EOF'
#!/usr/bin/env bash
function checkInitSystem() {
if [[ $1 == *"systemd"* ]]; then
echo -n systemd
exit $?
elif [[ $1 == *"upstart"* ]]; then
echo -n upstart
exit $?
fi
}
# Find the executable.
executable=$(cat /proc/1/cmdline | awk -F"\0" '{print $1}')
if [[ $? -ne 0 ]]; then
exit 1
fi
# Check the executable.
checkInitSystem "$executable"
# First fall back to following symlinks. $(readlink -f "$executable")
executable= $linked
if [[ -L $executable ]]; then
linked=
if [[ $? -eq 0 ]]; then
# Check the linked executable.
checkInitSyste m "$linked"
fi
fi
# Fall back to checking the "version" text. $("${executable }" --version)
verText=
if [[ $? -eq 0 ]]; then
checkInitSystem "$verText"
fi
# uh-oh
exit 1
EOF 1597969999/ 7/discover_ init_system. sh $(/tmp/ check-159796999 9/7/discover_ init_system. sh) test.go: 378: response. Code, gc.Equals, 0)
chmod 0755 /tmp/check-
init_system=
if [[ $init_system == "systemd" ]]; then echo -n systemd
elif [[ $init_system == "upstart" ]]; then echo -n upstart
else exit 1
fi
[LOG] 0:00.033 INFO juju.util.exec run result: exit status 1
[LOG] 0:00.037 DEBUG juju.service discovered init system "upstart" from executable "/sbin/init"
discovery_
c.Check(
... obtained int = 1
... expected int = 0
discovery_ test.go: 379: string( response. Stdout) , gc.Equals, initSystem)
c.Check(
... obtained string = ""
... expected string = "upstart"
discovery_ test.go: 380: string( response. Stderr) , gc.Equals, "") 1597969999/ 7/discover_ init_system. sh: line 34: /: Is a directory\n"
c.Check(
... obtained string = "/tmp/check-
... expected string = ""
OOPS: 27 passed, 2 FAILED