Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publisher #357

Merged
merged 1 commit into from
Jul 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions perfkitbenchmarker/publisher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014 Google Inc. All rights reserved.
# Copyright 2015 Google Inc. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK there's no need to update the copyright date in existing headers. My earlier change just changed the templates, so that people get the current year when they copy them into new files (as prompted by the presubmit check).

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -134,8 +134,12 @@ def AddMetadata(self, metadata, benchmark_spec):
metadata['cloud'] = benchmark_spec.cloud
# Get the unique zone names from the VMs.
metadata['zones'] = ','.join(set([vm.zone for vm in benchmark_spec.vms]))
metadata['machine_type'] = benchmark_spec.machine_type
metadata['image'] = benchmark_spec.image
# Get a representative VM so that we can publish the machine type and
# image. If we support different machine types/images in the same benchmark
# this will need to be updated.
vm = benchmark_spec.vms[0]
metadata['machine_type'] = vm.machine_type
metadata['image'] = vm.image

# Scratch disk is not defined when a benchmark config is provided.
if getattr(benchmark_spec, 'scratch_disk', None):
Expand Down
14 changes: 7 additions & 7 deletions tests/publisher_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014 Google Inc. All rights reserved.
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -239,17 +239,17 @@ def setUp(self):
p.start()
self.addCleanup(p.stop)

mock_vm = mock.MagicMock(zone='us-central1-a')
mock_vm = mock.MagicMock(zone='us-central1-a',
machine_type='n1-standard-1',
image='ubuntu-14-04')
self.mock_spec = mock.MagicMock(cloud='GCP',
vms=[mock_vm],
machine_type='n1-standard-1',
image='ubuntu-14-04')
vms=[mock_vm])

self.default_meta = {'perfkitbenchmarker_version': 'v1',
'cloud': self.mock_spec.cloud,
'zones': 'us-central1-a',
'machine_type': self.mock_spec.machine_type,
'image': self.mock_spec.image,
'machine_type': mock_vm.machine_type,
'image': mock_vm.image,
'num_striped_disks': 1}

def _RunTest(self, spec, expected, input_metadata=None):
Expand Down