~gandelman-a/ubuntu/precise/nova/UCA_2012.2.1

« back to all changes in this revision

Viewing changes to nova/tests/test_nova_rootwrap.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        p = subprocess.Popen(["/bin/sleep", "5"])
70
70
        f = filters.KillFilter("/bin/kill", "root",
71
71
                               ["-ALRM"],
72
 
                               ["/bin/sleep"])
 
72
                               ["/bin/sleep", "/usr/bin/sleep"])
73
73
        usercmd = ['kill', '-9', p.pid]
74
74
        # Incorrect signal should fail
75
75
        self.assertFalse(f.match(usercmd))
79
79
 
80
80
        f = filters.KillFilter("/bin/kill", "root",
81
81
                               ["-9", ""],
82
 
                               ["/bin/sleep"])
 
82
                               ["/bin/sleep", "/usr/bin/sleep"])
83
83
        usercmd = ['kill', '-9', os.getpid()]
84
84
        # Our own PID does not match /bin/sleep, so it should fail
85
85
        self.assertFalse(f.match(usercmd))
103
103
        usercmd = ['kill', 'notapid']
104
104
        self.assertFalse(f.match(usercmd))
105
105
 
 
106
    def test_KillFilter_deleted_exe(self):
 
107
        """Makes sure deleted exe's are killed correctly"""
 
108
        # See bug #967931.
 
109
        def fake_readlink(blah):
 
110
            return '/bin/commandddddd (deleted)'
 
111
 
 
112
        f = filters.KillFilter("/bin/kill", "root",
 
113
                               [""],
 
114
                               ["/bin/commandddddd"])
 
115
        usercmd = ['kill', 1234]
 
116
        # Providing no signal should work
 
117
        self.stubs.Set(os, 'readlink', fake_readlink)
 
118
        self.assertTrue(f.match(usercmd))
 
119
 
106
120
    def test_ReadFileFilter(self):
107
121
        goodfn = '/good/file.name'
108
122
        f = filters.ReadFileFilter(goodfn)