-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update timing data keys, not overwrite it entirely.
This will be necessary when we implement overridden atoms from build requests. In such a build request, we will not have ran all the atoms, and if we were to keep the existing behavior, we would wipe out all of the atom timing data except for the select few that were manually specified in the build request. This method also leaves the door open in the future if we want to always update the timing data, regardless of overall build success/failure, but only for successful atoms.
- Loading branch information
TJ Lee
committed
Aug 20, 2015
1 parent
2a25f5a
commit 7ce8313
Showing
4 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from genty import genty, genty_dataset | ||
import json | ||
import os | ||
from tempfile import mkstemp | ||
|
||
import app.util.fs | ||
from app.master.build_artifact import BuildArtifact | ||
from test.framework.base_integration_test_case import BaseIntegrationTestCase | ||
|
||
|
||
@genty | ||
class TestBuildArtifact(BaseIntegrationTestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
cls._timing_file_fd, cls._timing_file_path = mkstemp() | ||
with open(cls._timing_file_path, 'w') as f: | ||
f.write('') | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
os.close(cls._timing_file_fd) | ||
os.remove(cls._timing_file_path) | ||
|
||
@genty_dataset( | ||
mutually_exclusive=({'1': 1, '2': 2}, {'3': 3}, {'1': 1, '2': 2, '3': 3}), | ||
entire_overlap=({'1': 1, '2': 2}, {'1': 3, '2': 4}, {'1': 3, '2': 4}), | ||
some_overlap=({'1': 1, '2': 2}, {'2': 4, '3': 5}, {'1': 1, '2': 4, '3': 5}), | ||
) | ||
def test_update_timing_file(self, existing_timing_data, new_timing_data, expected_final_timing_data): | ||
app.util.fs.write_file(json.dumps(existing_timing_data), self._timing_file_path) | ||
build_artifact = BuildArtifact('/some/dir/doesnt/matter') | ||
build_artifact._update_timing_file(self._timing_file_path, new_timing_data) | ||
|
||
with open(self._timing_file_path, 'r') as timing_file: | ||
updated_timing_data = json.load(timing_file) | ||
|
||
self.assertDictEqual(updated_timing_data, expected_final_timing_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters