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

Add upgrade agents global action #6501

Merged

Conversation

lucianogorza
Copy link
Contributor

@lucianogorza lucianogorza commented Mar 12, 2024

Description

Add new functionality to the agent table so the user can select agents and trigger a bulk upgrade.

Issues Resolved

#6496

Evidence

image
image
image
image
image
image
image
image

Test

Test with real manager and agents

Command to create outdated agent with docker:

docker run --name os-dev-2120-agent-$(date +%s) --network os-dev-2.12.0 --label com.docker.compose.project=os-dev-2120 --env WAZUH_AGENT_VERSION=4.6.0 -d ubuntu:20.04 bash -c '
  apt update -y
  apt install -y curl lsb-release
  curl -so \wazuh-agent-${WAZUH_AGENT_VERSION}.deb \
    https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${WAZUH_AGENT_VERSION}-1_amd64.deb \
    && WAZUH_MANAGER='wazuh.manager' WAZUH_AGENT_GROUP='default' dpkg -i ./wazuh-agent-${WAZUH_AGENT_VERSION}.deb

  /etc/init.d/wazuh-agent start
  tail -f /var/ossec/logs/ossec.log
'

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

General

Test Chrome Firefox Safari
Click More button: It must show global actions: Add groups to agents, Remove groups from agents, Upgrade agents, Upgrade task details
Click More button and select the Upgrade task details option. A modal with upgrade tasks must show
Without select agents, the global action Upgrade agents must be disabled
Select agents, the global action Upgrade agents must be enabled
With read-only user: Select agents, the global action Upgrade agents must be disabled

Details

⚫ Click `More` button: It must show global actions: Add groups to agents, Remove groups from agents, Upgrade agents, Upgrade task details

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Click `More` button and select the ` Upgrade task details` option. A modal with upgrade tasks must show

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Without select agents, the global action `Upgrade agents` must be disabled

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Select agents, the global action `Upgrade agents` must be enabled

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ With read-only user: Select agents, the global action `Upgrade agents` must be disabled

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Upgrade agents

Test Chrome Firefox Safari
Select two online and outdated agents and a disconnected agent, and click More -> Upgrade agents. Stop one outdated agent and confirm the upgrade. It must create two upgrade tasks and show one error
Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped)
Check the final alters, it has to be one failed and one success upgrade task
On the upgrade tasks modal, check different filters

Details

⚫ Select two online and outdated agents and a disconnected agent, and click `More` -> `Upgrade agents`. Stop one outdated agent and confirm the upgrade. It must create two upgrade tasks and show one error

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped)

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check the final alters, it has to be one failed and one success upgrade task

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ On the upgrade tasks modal, check different filters

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@lucianogorza lucianogorza self-assigned this Mar 13, 2024
@lucianogorza lucianogorza linked an issue Mar 13, 2024 that may be closed by this pull request
7 tasks
@yenienserrano
Copy link
Member

yenienserrano commented Mar 14, 2024

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

General

Test Chrome Firefox Safari
Click More button: It must show global actions: Add groups to agents, Remove groups from agents, Upgrade agents, Upgrade task details 🟢
Click More button and select the Upgrade task details option. A modal with upgrade tasks must show 🟢
Without select agents, the global action Upgrade agents must be disabled 🟢
Select agents, the global action Upgrade agents must be enabled 🟢
With read-only user: Select agents, the global action Upgrade agents must be disabled 🔴

Details

🟢 Click `More` button: It must show global actions: Add groups to agents, Remove groups from agents, Upgrade agents, Upgrade task details

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image
🟢 Click `More` button and select the ` Upgrade task details` option. A modal with upgrade tasks must show

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image image
🟢 Without select agents, the global action `Upgrade agents` must be disabled

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image
🟢 Select agents, the global action `Upgrade agents` must be enabled

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image
🔴 With read-only user: Select agents, the global action `Upgrade agents` must be disabled

Chrome - ⚫

Firefox - ⚫

Safari - 🔴

image

with a read only user, permissions errors appear
image

Upgrade agents

Test Chrome Firefox Safari
Select two online and outdated agents and a disconnected agent, and click More -> Upgrade agents. Stop one outdated agent and confirm the upgrade. It must create two upgrade tasks and show one error 🟢
Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped) 🟢
Check the final alters, it has to be one failed and one success upgrade task 🟡
On the upgrade tasks modal, check different filters 🟢

Details

🟢 Select two online and outdated agents and a disconnected agent, and click `More` -> `Upgrade agents`. Stop one outdated agent and confirm the upgrade. It must create two upgrade tasks and show one error

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image image
🟢 Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped)

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image image
🟡 Check the final alters, it has to be one failed and one success upgrade task

Chrome - ⚫

Firefox - ⚫

Safari - 🟡

2 error but I have updated the agent.
image

🟢 On the upgrade tasks modal, check different filters

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

image

@lucianogorza lucianogorza force-pushed the enhancement/6496-allow-select-agents-and-trigger-bulk-upgrade branch from 91e1cbb to 01e8307 Compare March 15, 2024 14:56
Copy link
Member

@yenienserrano yenienserrano left a comment

Choose a reason for hiding this comment

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

LGTM

@asteriscos
Copy link
Member

asteriscos commented Mar 19, 2024

UI

Suggestions

  • This field says its not a searchable field, but in the search bar, there's clearly a query using it. This can be confusing.
    image

  • Whenever something is disable it would be useful to know why. This can be improved by adding a tooltip with the reason of it being disabled or instructions to perform that action.
    Screenshot from 2024-03-19 12-47-43

General

Test Chrome Firefox Safari
Click More button: It must show global actions: Add groups to agents, Remove groups from agents, Upgrade agents, Upgrade task details 🟢
Click More button and select the Upgrade task details option. A modal with upgrade tasks must show 🟢
Without select agents, the global action Upgrade agents must be disabled 🟢
Select agents, the global action Upgrade agents must be enabled 🟢
With read-only user: Select agents, the global action Upgrade agents must be disabled 🟢

Details

🟢 Click `More` button: It must show global actions: Add groups to agents, Remove groups from agents, Upgrade agents, Upgrade task details

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Click `More` button and select the ` Upgrade task details` option. A modal with upgrade tasks must show

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Without select agents, the global action `Upgrade agents` must be disabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Select agents, the global action `Upgrade agents` must be enabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 With read-only user: Select agents, the global action `Upgrade agents` must be disabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

Upgrade agents

Test Chrome Firefox Safari
Select two online and outdated agents and a disconnected agent, and click More -> Upgrade agents. Stop one outdated agent and confirm the upgrade. It must create two upgrade tasks and show one error 🟢
Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped) 🟢
Check the final alters, it has to be one failed and one success upgrade task 🟢
On the upgrade tasks modal, check different filters 🟢

Details

🟢 Select two online and outdated agents and a disconnected agent, and click `More` -> `Upgrade agents`. Stop one outdated agent and confirm the upgrade. It must create two upgrade tasks and show one error

Chrome - 🟢

Screenshot from 2024-03-19 15-49-36

image

Firefox - ⚫

Safari - ⚫

🟢 Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped)

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Check the final alerts, it has to be one failed and one success upgrade task

Chrome - 🟢

The result is not what the test case describes because of how the environment a the test was setup, but the results are correct.

image

Firefox - ⚫

Safari - ⚫

🟢 On the upgrade tasks modal, check different filters

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

@lucianogorza lucianogorza force-pushed the enhancement/6496-allow-select-agents-and-trigger-bulk-upgrade branch from e1ddf49 to fd6584e Compare March 19, 2024 15:07
Copy link
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 28.94% ( 286 / 988 )
Branches 26.22% ( 107 / 408 )
Functions 26.87% ( 86 / 320 )
Lines 28.68% ( 278 / 969 )

Copy link
Contributor

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 76.44% ( 172 / 225 )
Branches 58.65% ( 61 / 104 )
Functions 61.7% ( 29 / 47 )
Lines 76.44% ( 172 / 225 )

Copy link
Contributor

Main plugin code coverage (Jest) test % values
Statements 11.89% ( 4124 / 34664 )
Branches 7.58% ( 1721 / 22699 )
Functions 10.54% ( 868 / 8230 )
Lines 12.08% ( 4015 / 33225 )

@asteriscos asteriscos merged commit 0760cdd into 4.9.0 Mar 19, 2024
4 checks passed
@asteriscos asteriscos deleted the enhancement/6496-allow-select-agents-and-trigger-bulk-upgrade branch March 19, 2024 15:19
@lucianogorza lucianogorza mentioned this pull request Apr 25, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow select agents and trigger a bulk upgrade
3 participants