-
Notifications
You must be signed in to change notification settings - Fork 906
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
[Plugins] update default url for installing plugins #1316
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,9 @@ import { parseMilliseconds, parse } from './settings'; | |
const SECOND = 1000; | ||
const MINUTE = SECOND * 60; | ||
|
||
const ORIGINAL_PLATFORM = process.platform; | ||
const ORIGINAL_ARCHITECTURE = process.arch; | ||
Comment on lines
+41
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This causes tests to be inconsistent depending on which platform/architecture you're running them from. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My snapshots were updated on my arm64 machine and then they failed in GitHub Actions: https://github.com/opensearch-project/OpenSearch-Dashboards/runs/5548019026?check_suite_focus=true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Going to submit a PR to fix this now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
expect.addSnapshotSerializer(createAbsolutePathSerializer()); | ||
|
||
describe('parseMilliseconds function', function () { | ||
|
@@ -62,6 +65,17 @@ describe('parse function', function () { | |
const defaultOptions = { pluginDir: fromRoot('plugins') }; | ||
const osdPackage = { version: 1234 }; | ||
|
||
afterAll(() => { | ||
Object.defineProperties(process, { | ||
platform: { | ||
value: ORIGINAL_PLATFORM, | ||
}, | ||
arch: { | ||
value: ORIGINAL_ARCHITECTURE, | ||
}, | ||
}); | ||
}); | ||
|
||
it('produces expected defaults', function () { | ||
expect(parse(command, { ...defaultOptions }, osdPackage)).toMatchInlineSnapshot(` | ||
Object { | ||
|
@@ -74,7 +88,7 @@ describe('parse function', function () { | |
"timeout": 0, | ||
"urls": Array [ | ||
"plugin name", | ||
"https://artifacts.opensearch.org/downloads/kibana-plugins/plugin name/plugin name-1234.zip", | ||
"https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1234/latest/linux/x64/builds/opensearch-dashboards/plugins/plugin name-1234.zip", | ||
], | ||
"version": 1234, | ||
"workingPath": <absolute path>/plugins/.plugin.installing, | ||
|
@@ -101,7 +115,49 @@ describe('parse function', function () { | |
"timeout": 0, | ||
"urls": Array [ | ||
"plugin name", | ||
"https://artifacts.opensearch.org/downloads/kibana-plugins/plugin name/plugin name-1234.zip", | ||
"https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1234/latest/linux/x64/builds/opensearch-dashboards/plugins/plugin name-1234.zip", | ||
], | ||
"version": 1234, | ||
"workingPath": <absolute path>/plugins/.plugin.installing, | ||
} | ||
`); | ||
}); | ||
|
||
it('should throw when on a non-Linux platform', function () { | ||
Object.defineProperties(process, { | ||
platform: { | ||
value: 'win32', | ||
}, | ||
arch: { | ||
value: ORIGINAL_ARCHITECTURE, | ||
}, | ||
}); | ||
expect(() => parse(command, { ...defaultOptions }, osdPackage)).toThrow( | ||
'Plugins are only available for Linux' | ||
); | ||
}); | ||
|
||
it('should not throw when on a non-x64 arch', function () { | ||
Object.defineProperties(process, { | ||
platform: { | ||
value: ORIGINAL_PLATFORM, | ||
}, | ||
arch: { | ||
value: 'arm64', | ||
}, | ||
}); | ||
expect(parse(command, { ...defaultOptions }, osdPackage)).toMatchInlineSnapshot(` | ||
Object { | ||
"config": "", | ||
"plugin": "plugin name", | ||
"pluginDir": <absolute path>/plugins, | ||
"quiet": false, | ||
"silent": false, | ||
"tempArchiveFile": <absolute path>/plugins/.plugin.installing/archive.part, | ||
"timeout": 0, | ||
"urls": Array [ | ||
"plugin name", | ||
"https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/1234/latest/linux/arm64/builds/opensearch-dashboards/plugins/plugin name-1234.zip", | ||
], | ||
"version": 1234, | ||
"workingPath": <absolute path>/plugins/.plugin.installing, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This could have just been in
generateUrls
since that function doesn't do anything anymore 😂There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is one called
generateUrls
(line 42) right?