Skip to content

Commit

Permalink
Fix snapshot unit test when ES_SNAPSHOT_MANIFEST is present before te…
Browse files Browse the repository at this point in the history
…sts run
  • Loading branch information
brianseeders committed Jan 6, 2020
1 parent 97cd106 commit 6b7257b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/kbn-es/src/artifact.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ const createArchive = (params = {}) => {
const mockFetch = mock =>
fetch.mockReturnValue(Promise.resolve(new Response(JSON.stringify(mock))));

let previousSnapshotManifestValue = null;

beforeAll(() => {
if ('ES_SNAPSHOT_MANIFEST' in process.env) {
previousSnapshotManifestValue = process.env.ES_SNAPSHOT_MANIFEST;
delete process.env.ES_SNAPSHOT_MANIFEST;
}
});

afterAll(() => {
if (previousSnapshotManifestValue !== null) {
process.env.ES_SNAPSHOT_MANIFEST = previousSnapshotManifestValue;
} else {
delete process.env.ES_SNAPSHOT_MANIFEST;
}
});

beforeEach(() => {
jest.resetAllMocks();

Expand Down

0 comments on commit 6b7257b

Please sign in to comment.