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

[Fleet] Edit package policy tests #125068

Merged
merged 3 commits into from
Feb 10, 2022
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
15 changes: 8 additions & 7 deletions x-pack/plugins/fleet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ Write stories by creating `.stories.tsx` files colocated with the components you

The projects below are dependent on Fleet, most using Fleet API as well. In case of breaking changes in Fleet functionality/API, the project owners have to be notified to make sure they can plan for the necessary changes on their end to avoid unexpected break in functionality.

* [Elastic Agent](https://github.com/elastic/beats/blob/master/x-pack/elastic-agent): uses Fleet API to enroll agents. [See here](https://github.com/elastic/beats/blob/master/x-pack/elastic-agent/pkg/agent/cmd/container.go)
* [Fleet Server](https://github.com/elastic/fleet-server): uses Fleet API to enroll fleet server [See here](https://github.com/elastic/fleet-server/blob/master/cmd/fleet/router.go)
* [elastic-package](https://github.com/elastic/elastic-package): command line tool, uses Fleet with docker compose and Fleet API [See here](https://github.com/elastic/elastic-package/tree/master/internal/kibana)
* [Azure VM extension](https://github.com/elastic/azure-vm-extension): automation tool for Azure VMs, uses Fleet API to enroll agents [See here](https://github.com/elastic/azure-vm-extension/blob/main/src/handler/windows/scripts/enable.ps1)
* [e2e-testing](https://github.com/elastic/e2e-testing): internal project that runs Fleet and tests Fleet API [See here](https://github.com/elastic/e2e-testing/tree/main/internal/kibana)
* [observability-test-environments](https://github.com/elastic/observability-test-environments): internal project, uses Fleet API [See here](https://github.com/elastic/observability-test-environments/blob/master/ansible/tasks-fleet-config.yml)
* [ECK](https://github.com/elastic/cloud-on-k8s): Elastic Cloud on Kubernetes, orchestrates Elastic Stack applications, including Kibana with Fleet (no direct dependency, has examples that include Fleet config) [See here](https://github.com/elastic/cloud-on-k8s/blob/main/docs/orchestrating-elastic-stack-applications/agent-fleet.asciidoc)
* [Elastic Agent](https://github.com/elastic/beats/blob/master/x-pack/elastic-agent): uses Fleet API to enroll agents. [Check here](https://github.com/elastic/beats/blob/master/x-pack/elastic-agent/pkg/agent/cmd/container.go)
* [Fleet Server](https://github.com/elastic/fleet-server): uses Fleet API to enroll fleet server [Check here](https://github.com/elastic/fleet-server/blob/master/cmd/fleet/router.go)
* [elastic-package](https://github.com/elastic/elastic-package): command line tool, uses Fleet with docker compose and Fleet API [Check here](https://github.com/elastic/elastic-package/tree/master/internal/kibana)
* [Azure VM extension](https://github.com/elastic/azure-vm-extension): automation tool for Azure VMs, uses Fleet API to enroll agents [Check here](https://github.com/elastic/azure-vm-extension/blob/main/src/handler/windows/scripts/enable.ps1)
* [e2e-testing](https://github.com/elastic/e2e-testing): internal project that runs Fleet and tests Fleet API [Check here](https://github.com/elastic/e2e-testing/tree/main/internal/kibana)
* [observability-test-environments](https://github.com/elastic/observability-test-environments): internal project, uses Fleet API [Check here](https://github.com/elastic/observability-test-environments/blob/master/ansible/tasks-fleet-config.yml)
* [ECK](https://github.com/elastic/cloud-on-k8s): Elastic Cloud on Kubernetes, orchestrates Elastic Stack applications, including Kibana with Fleet (no direct dependency, has examples that include Fleet config) [Check here](https://github.com/elastic/cloud-on-k8s/blob/main/docs/orchestrating-elastic-stack-applications/agent-fleet.asciidoc)
* [APM Server](https://github.com/elastic/apm-server) APM Server, receives data from Elastic APM agents. Using docker compose for testing. [Check here](https://github.com/elastic/apm-server/pull/7227/files)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added APM Server dependency to README

Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export const PackagePolicyInputConfig: React.FunctionComponent<{
<EuiFlexGroup direction="column" gutterSize="m">
{requiredVars.map((varDef) => {
const { name: varName, type: varType } = varDef;
const { value, frozen } = packagePolicyInput.vars![varName];
if (!packagePolicyInput.vars) return;
const { value, frozen } = packagePolicyInput.vars[varName];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added these nullchecks as I kept getting js undefined errors while testing locally the upgrade page of aws. There is a short time initially when those variables are undefined, making the form unusable.

image

return (
<EuiFlexItem key={varName}>
<PackagePolicyInputVarField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const PackagePolicyInputPanel: React.FunctionComponent<{
packageInputVars={packageInput.vars}
packagePolicyInput={packagePolicyInput}
updatePackagePolicyInput={updatePackagePolicyInput}
inputVarsValidationResults={{ vars: inputValidationResults.vars }}
inputVarsValidationResults={{ vars: inputValidationResults?.vars }}
forceShowErrors={forceShowErrors}
/>
{hasInputStreams ? <ShortenedHorizontalRule margin="m" /> : <EuiSpacer size="l" />}
Expand Down Expand Up @@ -238,7 +238,7 @@ export const PackagePolicyInputPanel: React.FunctionComponent<{
updatePackagePolicyInput(updatedInput);
}}
inputStreamValidationResults={
inputValidationResults.streams![packagePolicyInputStream!.data_stream!.dataset]
inputValidationResults?.streams![packagePolicyInputStream!.data_stream!.dataset]
}
forceShowErrors={forceShowErrors}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ export const PackagePolicyInputStreamConfig: React.FunctionComponent<{
const advancedVarsWithErrorsCount: number = useMemo(
() =>
advancedVars.filter(
({ name: varName }) => inputStreamValidationResults.vars?.[varName]?.length
({ name: varName }) => inputStreamValidationResults?.vars?.[varName]?.length
).length,
[advancedVars, inputStreamValidationResults.vars]
[advancedVars, inputStreamValidationResults?.vars]
);

return (
Expand Down Expand Up @@ -106,7 +106,7 @@ export const PackagePolicyInputStreamConfig: React.FunctionComponent<{
<FlexItemWithMaxWidth>
<EuiFlexGroup direction="column" gutterSize="m">
{requiredVars.map((varDef) => {
if (!packagePolicyInputStream.vars) return null;
if (!packagePolicyInputStream?.vars) return null;
const { name: varName, type: varType } = varDef;
const varConfigEntry = packagePolicyInputStream.vars?.[varName];
const value = varConfigEntry?.value;
Expand All @@ -129,7 +129,7 @@ export const PackagePolicyInputStreamConfig: React.FunctionComponent<{
},
});
}}
errors={inputStreamValidationResults.vars![varName]}
errors={inputStreamValidationResults?.vars![varName]}
forceShowErrors={forceShowErrors}
/>
</EuiFlexItem>
Expand Down Expand Up @@ -187,7 +187,7 @@ export const PackagePolicyInputStreamConfig: React.FunctionComponent<{
},
});
}}
errors={inputStreamValidationResults.vars![varName]}
errors={inputStreamValidationResults?.vars![varName]}
forceShowErrors={forceShowErrors}
/>
</EuiFlexItem>
Expand Down
Loading