Isolation failure in several tests

Bug #1351089 reported by John Weldon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
High
John Weldon

Bug Description

There are a handful of tests that fail on my machine because of leaking of my environment to the tests

For example the initial one reported is:

When running the environs/sshstorage tests
If the developers environment has `set -o noclobber`
Then the storageSuite.TestPut test fails with:

storage_test.go:213:
    c.Assert(err, gc.IsNil)
... value *os.PathError = &os.PathError{Op:"open", Path:"/tmp/gocheck-4037200794235010051/1/b", Err:0x2} ("open /tmp/gocheck-4037200794235010051/1/b: no such file or directory")

This is because SSHStorage.Put uses "cat > $TMPFILE", which errors if $TMPFILE exists.

One solution is to change SSHStorage.Put to use "cat >| $TMPFILE", which forces an overwrite if $TMPFILE exists, however this really masks another issue which is that the test is vulnerable to the vagaries of the users environment.

Other examples, all related to improper isolation of test environment, are:

FAIL: run_test.go:124: RunTestSuite.TestNoContextAsync

run_test.go:130:
    c.Assert(err, gc.IsNil)
... value *errors.errorString = &errors.errorString{s:"timeout"} ("timeout")

FAIL: run_test.go:134: RunTestSuite.TestNoContextWithLock

[LOG] 0:00.000 INFO juju.utils.fslock attempted lock failed "uniter-hook-execution", juju-run, currently held: juju-run test
run_test.go:150:
    c.Assert(err, gc.IsNil)
... value *errors.errorString = &errors.errorString{s:"timeout"} ("timeout")

FAIL: kvm_test.go:248: KVMSuite.TestIsKVMSupportedBinaryErrorsOut

kvm_test.go:260:
    c.Assert(err, gc.ErrorMatches, "exit status 127")
... error string = "" +
... "/usr/share/bash-completion/bash_completion: line 1978: ls: No such file or directory\n" +
... ": exit status 127"
... regex string = "exit status 127"

FAIL: storage_test.go:206: storageSuite.TestPut

[LOG] 0:00.000 DEBUG juju.utils.ssh running: ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" -o "ServerAliveInterval 30" example.com sudo -n />
[LOG] 0:00.153 DEBUG juju.utils.ssh running: ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" -o "ServerAliveInterval 30" example.com bash
[LOG] 0:00.340 DEBUG juju.environs.sshstorage putting "b" (len 7) to storage
storage_test.go:213:
    c.Assert(err, gc.IsNil)
... value *os.PathError = &os.PathError{Op:"open", Path:"/tmp/gocheck-894385949183117216/7/b", Err:0x2} ("open /tmp/gocheck-894385949183117216/7/b: no such fil>

FAIL: mongo_test.go:146: MongoSuite.TestEnsureServer

[LOG] 0:00.000 INFO juju.mongo Ensuring mongo server is running; data directory /tmp/gocheck-2775422040480279449/9; port 25252
[LOG] 0:00.000 INFO juju.mongo installing juju-mongodb
[LOG] 0:00.000 INFO juju.utils.apt Running: [apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet i>
[LOG] 0:00.031 DEBUG juju.mongo using mongod: /tmp/gocheck-2775422040480279449/7/mongod --version: "/usr/share/bash-completion/bash_completion: line 1978: ls: >
mongo_test.go:188:
    c.Assert(tlog, gc.Matches, start+`using mongod: .*/mongod --version: "db version v2\.4\.9`+tail)
... value string = "" +
... "[LOG] 0:00.000 INFO juju.mongo Ensuring mongo server is running; data directory /tmp/gocheck-2775422040480279449/9; port 25252\n" +
... "[LOG] 0:00.000 INFO juju.mongo installing juju-mongodb\n" +
... "[LOG] 0:00.000 INFO juju.utils.apt Running: [apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes >
... "[LOG] 0:00.031 DEBUG juju.mongo using mongod: /tmp/gocheck-2775422040480279449/7/mongod --version: \"/usr/share/bash-completion/bash_completion: line >
... regex string = "^(.|\\n)*using mongod: .*/mongod --version: \"db version v2\\.4\\.9(.|\\n)*$"

Changed in juju-core:
assignee: nobody → John Weldon (johnweldon4)
Changed in juju-core:
status: New → In Progress
description: updated
summary: - Isolation failure in sshstorage test
+ Isolation failure in several tests
Changed in juju-core:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju-core:
importance: Undecided → High
milestone: none → 1.21-alpha1
Curtis Hovey (sinzui)
Changed in juju-core:
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.