Skip to content

Commit

Permalink
[Tests] configurable skip checksum verification (#1207)
Browse files Browse the repository at this point in the history
This enables configuring the skipping of checksum verification for
integration and functional tests. The out-of-box experience enables
tests to pull down an artifact of OpenSearch to run frontend tests
against. However, if there was an issue with the publishing of the
checksum, for example:
opensearch-project/opensearch-build#1497

Then any CI for OpenSearch Dashboards is severely blocked.

This lets the out-of-box experience get around this. This shouldn't
be used permenantly and should be toggled off when no longer blocked.

Issue resolved:
#1205

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla authored Feb 3, 2022
1 parent 8777eb3 commit fc96cc3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/pr_check_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
TEST_OPENSEARCH_DASHBOARDS_PORT: 6610
TEST_OPENSEARCH_TRANSPORT_PORT: 9403
TEST_OPENSEARCH_PORT: 9400
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true

jobs:
build-lint-test:
Expand Down
9 changes: 8 additions & 1 deletion packages/osd-opensearch/src/artifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ function shouldUseUnverifiedSnapshot() {
return !!process.env.OSD_OPENSEARCH_SNAPSHOT_USE_UNVERIFIED;
}

// Setting this flag provides an easy way to skip comparing the checksum
function skipVerifyChecksum() {
return !!process.env.OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM;
}

async function fetchSnapshotManifest(url, log) {
log.info('Downloading snapshot manifest from %s', chalk.bold(url));

Expand Down Expand Up @@ -327,7 +332,9 @@ exports.Artifact = class Artifact {
return;
}

await this._verifyChecksum(artifactResp);
if (!skipVerifyChecksum()) {
await this._verifyChecksum(artifactResp);
}

// cache the etag for future downloads
cache.writeMeta(dest, { etag: artifactResp.etag });
Expand Down
1 change: 1 addition & 0 deletions packages/osd-opensearch/src/artifact.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const previousEnvVars = {};
const ENV_VARS_TO_RESET = [
'OPENSEARCH_SNAPSHOT_MANIFEST',
'OSD_OPENSEARCH_SNAPSHOT_USE_UNVERIFIED',
'OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM',
];

beforeAll(() => {
Expand Down

0 comments on commit fc96cc3

Please sign in to comment.