-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Revamp core environment class to support upcoming core<-->legacy bootstrap inversion. #21885
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
be9aa6c
Revamp core environement class to support upcoming core<-->legacy boo…
azasypkin 67a1f43
Do not use `Object.entries` in `env` tests.
azasypkin 557b3ac
Remove missing test assertion.
azasypkin 6a2a072
Merge branch 'master' into issue-xxx-core-env
azasypkin 9699d03
Remove special handling of `error` even in legacy platform proxifier.
azasypkin 32c73ce
Use `utils/deep_freeze` instead of `Object.freeze` for env props that…
azasypkin f555fe2
Revert: Use `utils/deep_freeze` instead of `Object.freeze` for env pr…
azasypkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
src/core/server/config/__tests__/__snapshots__/env.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`correctly creates default environment in dev mode.: env properties 1`] = ` | ||
Env { | ||
"binDir": "/test/cwd/bin", | ||
"cliArgs": Object { | ||
"dev": true, | ||
"someArg": 1, | ||
"someOtherArg": "2", | ||
}, | ||
"configDir": "/test/cwd/config", | ||
"configs": Array [ | ||
"/test/cwd/config/kibana.yml", | ||
], | ||
"corePluginsDir": "/test/cwd/core_plugins", | ||
"homeDir": "/test/cwd", | ||
"isDevClusterMaster": true, | ||
"legacy": EventEmitter { | ||
"_events": Object {}, | ||
"_eventsCount": 0, | ||
"_maxListeners": undefined, | ||
"domain": null, | ||
}, | ||
"logDir": "/test/cwd/log", | ||
"mode": Object { | ||
"dev": true, | ||
"name": "development", | ||
"prod": false, | ||
}, | ||
"packageInfo": Object { | ||
"branch": "some-branch", | ||
"buildNum": 9007199254740991, | ||
"buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | ||
"version": "some-version", | ||
}, | ||
"staticFilesDir": "/test/cwd/ui", | ||
} | ||
`; | ||
|
||
exports[`correctly creates default environment in prod distributable mode.: env properties 1`] = ` | ||
Env { | ||
"binDir": "/test/cwd/bin", | ||
"cliArgs": Object { | ||
"dev": false, | ||
"someArg": 1, | ||
"someOtherArg": "2", | ||
}, | ||
"configDir": "/test/cwd/config", | ||
"configs": Array [ | ||
"/some/other/path/some-kibana.yml", | ||
], | ||
"corePluginsDir": "/test/cwd/core_plugins", | ||
"homeDir": "/test/cwd", | ||
"isDevClusterMaster": false, | ||
"legacy": EventEmitter { | ||
"_events": Object {}, | ||
"_eventsCount": 0, | ||
"_maxListeners": undefined, | ||
"domain": null, | ||
}, | ||
"logDir": "/test/cwd/log", | ||
"mode": Object { | ||
"dev": false, | ||
"name": "production", | ||
"prod": true, | ||
}, | ||
"packageInfo": Object { | ||
"branch": "feature-v1", | ||
"buildNum": 100, | ||
"buildSha": "feature-v1-build-sha", | ||
"version": "v1", | ||
}, | ||
"staticFilesDir": "/test/cwd/ui", | ||
} | ||
`; | ||
|
||
exports[`correctly creates default environment in prod non-distributable mode.: env properties 1`] = ` | ||
Env { | ||
"binDir": "/test/cwd/bin", | ||
"cliArgs": Object { | ||
"dev": false, | ||
"someArg": 1, | ||
"someOtherArg": "2", | ||
}, | ||
"configDir": "/test/cwd/config", | ||
"configs": Array [ | ||
"/some/other/path/some-kibana.yml", | ||
], | ||
"corePluginsDir": "/test/cwd/core_plugins", | ||
"homeDir": "/test/cwd", | ||
"isDevClusterMaster": false, | ||
"legacy": EventEmitter { | ||
"_events": Object {}, | ||
"_eventsCount": 0, | ||
"_maxListeners": undefined, | ||
"domain": null, | ||
}, | ||
"logDir": "/test/cwd/log", | ||
"mode": Object { | ||
"dev": false, | ||
"name": "production", | ||
"prod": true, | ||
}, | ||
"packageInfo": Object { | ||
"branch": "feature-v1", | ||
"buildNum": 9007199254740991, | ||
"buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | ||
"version": "v1", | ||
}, | ||
"staticFilesDir": "/test/cwd/ui", | ||
} | ||
`; | ||
|
||
exports[`correctly creates environment with constructor.: env properties 1`] = ` | ||
Env { | ||
"binDir": "/some/home/dir/bin", | ||
"cliArgs": Object { | ||
"dev": false, | ||
"someArg": 1, | ||
"someOtherArg": "2", | ||
}, | ||
"configDir": "/some/home/dir/config", | ||
"configs": Array [ | ||
"/some/other/path/some-kibana.yml", | ||
], | ||
"corePluginsDir": "/some/home/dir/core_plugins", | ||
"homeDir": "/some/home/dir", | ||
"isDevClusterMaster": false, | ||
"legacy": EventEmitter { | ||
"_events": Object {}, | ||
"_eventsCount": 0, | ||
"_maxListeners": undefined, | ||
"domain": null, | ||
}, | ||
"logDir": "/some/home/dir/log", | ||
"mode": Object { | ||
"dev": false, | ||
"name": "production", | ||
"prod": true, | ||
}, | ||
"packageInfo": Object { | ||
"branch": "feature-v1", | ||
"buildNum": 100, | ||
"buildSha": "feature-v1-build-sha", | ||
"version": "v1", | ||
}, | ||
"staticFilesDir": "/some/home/dir/ui", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
While you're in here, would you mind moving these test files out of the
__tests__
directory? These should be right next to the files they are testing right?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.
Correct,
__tests__
are still used everywhere insrc/core/server
as it was innew-platform
branch. I was planning to get rid of all__tests__
fromsrc/core/server
in a dedicated PR, but can do it gradually in every PR that touches tests, like here. Will remove all__tests__
that I touch in this PR.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.
Oh, no, I realized it will be a rebase nightmare for me since I have 3 more PRs based on this one that change these tests :/ Would you mind I prepare a dedicated PR to get rid of all
__tests__
insrc/core/server
right after #22190?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.
works for me!