Skip to content

Commit

Permalink
Revert "changed splitKey to getCacheLocation"
Browse files Browse the repository at this point in the history
This reverts commit 6c22271.

Conflicts:
	lib/features/docker_save.js
	lib/volume_cache.js
  • Loading branch information
EggyLv999 committed Aug 4, 2015
1 parent ddb2715 commit 84f28be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
5 changes: 4 additions & 1 deletion lib/features/docker_save.js
Expand Up @@ -11,6 +11,9 @@ import zlib from 'zlib';

let debug = Debug('docker-worker:features:docker-save');

//must be changed if the delimiter in lib/volume_cache.js is changed
let KEY_DELIMITER = '::';

export default class DockerSave {
//commits and uploads the docker image as an artifact
async uploadContainer(task) {
Expand Down Expand Up @@ -54,7 +57,7 @@ export default class DockerSave {
//uploading a cache folder as an artifact
async uploadCache(task, cacheStr) {
let cache = task.runtime.volumeCache.splitKey(cacheStr);
let loc = task.runtime.volumeCache.getCacheLocation(cacheStr);
let loc = path.join(task.runtime.cache.volumeCachePath, cache.cacheName, cache.instanceId + '/');

//temporary path for saved file
let pathname = path.join(task.runtime.dockerVolume, slugid.v4() + '.tar');
Expand Down
14 changes: 6 additions & 8 deletions lib/volume_cache.js
Expand Up @@ -235,13 +235,11 @@ export default class VolumeCache {
}
}

/**
Get the location of a cache on disk.
@param {String} Cache key in the format of <cache name>::<instance id>
*/
getCacheLocation(cacheKey) {
var {cacheName, instanceId} = this.splitKey(cacheKey);
return path.join(this.rootCachePath, cacheName, instanceId + '/');
splitKey(cacheKey) {
var cacheSplit = cacheKey.split(KEY_DELIMITER);
return({
cacheName: cacheSplit[0],
instanceId: cacheSplit[1]
});
}
}
2 changes: 1 addition & 1 deletion test/integration/docker_save_test.js
Expand Up @@ -78,7 +78,7 @@ suite('use docker-save', () => {
0x74,0x65,0x73,0x74,0x53,0x74,0x72,0x69,0x6e,0x67,0x0a))); //testString\n
finished = true;
});
await base.testing.sleep(7000);
await base.testing.sleep(5000);
assert(finished, 'did not receive any data back');
await Promise.all([container.remove(), fs.unlink('/tmp/dockerload.tar')]);
await docker.getImage(imageName).remove();
Expand Down

0 comments on commit 84f28be

Please sign in to comment.