Skip to content

Commit

Permalink
ES snapshot changes required for 6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders committed Jan 7, 2020
1 parent 12418c0 commit 3166031
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/kbn-es/src/artifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ async function getArtifactSpecForSnapshot(urlVersion, license, log) {

const manifest = JSON.parse(json);

const platform = process.platform === 'win32' ? 'windows' : process.platform;
const ext = process.platform === 'win32' ? 'zip' : 'tar.gz';
const archive = manifest.archives.find(
archive =>
archive.version === desiredVersion &&
archive.platform === platform &&
archive.filename.endsWith(ext) &&
archive.license === desiredLicense
);

if (!archive) {
throw createCliError(
`Snapshots for ${desiredVersion} are available, but couldn't find an artifact in the manifest for [${desiredVersion}, ${desiredLicense}, ${platform}]`
`Snapshots for ${desiredVersion} are available, but couldn't find an artifact in the manifest for [${desiredVersion}, ${desiredLicense}, ${ext}]`
);
}

Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-es/src/artifact.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Artifact } from './artifact';
const log = new ToolingLog();
let MOCKS;

const PLATFORM = process.platform === 'win32' ? 'windows' : process.platform;
const EXT = process.platform === 'win32' ? 'zip' : 'tar.gz';
const MOCK_VERSION = 'test-version';
const MOCK_URL = 'http://127.0.0.1:12345';
const MOCK_FILENAME = 'test-filename';
Expand All @@ -43,8 +43,8 @@ const createArchive = (params = {}) => {
license: 'default',
version: MOCK_VERSION,
url: MOCK_URL + `/${license}`,
platform: PLATFORM,
filename: MOCK_FILENAME + `.${license}`,
platform: 'no-jdk',
filename: `${MOCK_FILENAME}.${license}.${EXT}`,
...params,
};
};
Expand Down Expand Up @@ -94,7 +94,7 @@ const artifactTest = (requestedLicense, expectedLicense, fetchTimesCalled = 1) =
expect(artifact.getUrl()).toEqual(MOCK_URL + `/${expectedLicense}`);
expect(artifact.getChecksumUrl()).toEqual(MOCK_URL + `/${expectedLicense}.sha512`);
expect(artifact.getChecksumType()).toEqual('sha512');
expect(artifact.getFilename()).toEqual(MOCK_FILENAME + `.${expectedLicense}`);
expect(artifact.getFilename()).toEqual(`${MOCK_FILENAME}.${expectedLicense}.${EXT}`);
};
};

Expand Down

0 comments on commit 3166031

Please sign in to comment.