Skip to content

Commit

Permalink
Default job properties to empty, not undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
mboldt committed Oct 27, 2016
1 parent 0ae5072 commit 39ba095
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tile_generator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
# ways depending on the package type. We normalize all these so that the rest of
# the code can rely on a single format
#
# Normalize Jobs - Ensure that job type and template are set for every job
# Normalize Jobs - Ensure that job type, template, and properties are set for
# every job

package_types = {
'app': { 'flags': [ 'is_cf', 'requires_cf_cli', 'is_app' ] },
Expand Down Expand Up @@ -145,7 +146,8 @@ def normalize_jobs(self):
for job in release.get('jobs', []):
job['type'] = job.get('type', job['name'])
job['template'] = job.get('template', job['type'])

job['properties'] = job.get('properties', {})

def release_for_package(self, package):
release_name = package['name'] if package.get('is_bosh_release', False) else self['name']
release = self.release_by_name(release_name)
Expand Down
11 changes: 11 additions & 0 deletions tile_generator/config_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,17 @@ def test_purge_service_broker_is_overridden(self):
config.add_defaults()
self.assertFalse(config['purge_service_brokers'])

def test_normalize_jobs_default_job_properties(self):
config = Config({
'releases': [{
'jobs': [{
'name': 'my-job'
}]
}]
})
config.normalize_jobs()
self.assertEqual(config['releases'][0]['jobs'][0]['properties'], {})

@mock.patch('os.path.getsize')
class TestVMDiskSize(unittest.TestCase):
def test_min_vm_disk_size(self, mock_getsize):
Expand Down

0 comments on commit 39ba095

Please sign in to comment.