'``VolumeScript._create_volume_service`` raises ``SystemExit`` with a
non-zero code if ``VolumeService.startService`` raises
``CreateConfigurationError``.'

@skip_on_broken_permissions
def test_exit(self):

    directory = FilePath(self.mktemp())
    directory.makedirs()
    directory.chmod(0)
    self.addCleanup(directory.chmod, 511)
    config = directory.child('config.yml')
    stderr = StringIO()
    reactor = object()
    options = VolumeOptions()
    options.parseOptions(['--config', config.path])
    with attempt_effective_uid('nobody', suppress_errors=True):
        exc = self.assertRaises(SystemExit, VolumeScript._create_volume_service, stderr, reactor, options)
    self.assertEqual(1, exc.code)
