Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] configurable skip checksum verification #1207

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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