Commit graph

105 commits

Author SHA1 Message Date
regexowl
8597929ff3 test: test: Remove act() warnings
This removes `Warning: An update to <component> inside a test was not wrapped inact(...)` warnings.
2024-07-16 16:55:31 +02:00
regexowl
2a48966bba test: Update test files to work with Vitest
This updates the files to be compatible with Vitest. Changes include:
- adding `@testing-library/jest-dom` import to enable custom jest matchers
- renaming `jest.` to `vi.`
- setting flags to false as default where needed
2024-07-16 16:55:31 +02:00
regexowl
32ec1a6d27 jest: Increase test timeout
This increases default test timeout from 10000 to 20000 and timeout for "image name invalid for more than 100 chars and description for 250" to 50000.

This should eliminate test flakes caused by timing out, later it will be "reverted" when the Vitest migration gets merged.
2024-07-16 10:47:54 +02:00
regexowl
989671ba95 test: Update tests
A custom repo needs to be selected for the correct mocked response.
2024-07-14 22:13:46 +02:00
Ondrej Ezr
4044b9eba1 Wizard: enable nav items properly in Edit mode 2024-07-11 09:37:36 +02:00
Ondrej Ezr
facb71ceae Wizard: validate uniqueness of Blueprint name 2024-06-26 15:41:48 +02:00
regexowl
73848c9ed0 Wizard: Add Lightspeed to package recommendations
This adds "Powered by RHEL Lightspeed" text and popover to the recommended packages expandable.
2024-06-25 11:15:07 +02:00
regexowl
916596d5cb test: Cleanup TargetEnvironment tests
This cleans up structure of `src/test/Components/CreateImageWizardV2/steps/TargetEnvironment`, removing the subfolders and surfacing Aws and Azure test files.

We also had two `TargetEnvironment.test.tsx` files, both testing functionality of the Image Output step. For now those were merged into one file under `ImageOutput` step and can be later renamed to `ImageOutput.test.tsx` for consistency.
2024-06-21 16:49:24 +02:00
Ondrej Ezr
4692eae454 Wizard: validate wizard with Redux Hook
Use redux hook to validate the form.
This gives us single point of contact for "is the data valid?"
while not requiring every redux action touching form data to perform validation.

It's not perfect and might be improved when using external library solving the problems we're having.
2024-06-21 14:40:41 +02:00
Sanne Raymaekers
737074eb49 CreateImageWizardV2: test included packages in group popover 2024-06-21 10:12:39 +02:00
Sanne Raymaekers
d0f52bb1d6 CreateImageWizardV2: fix pagination when search is empty 2024-06-21 10:12:39 +02:00
Sanne Raymaekers
e37782ebf6 CreateImageWizardV2: add tests for package groups 2024-06-21 10:12:39 +02:00
regexowl
da1d76ad94 test: Add edit mode tests
This adds basic edit mode tests for the remaining steps.
2024-06-20 00:05:41 +02:00
Ondrej Ezr
5fcc80d2db Wizard: Drop the WizardV1 2024-06-19 09:10:22 +02:00
regexowl
3b699f99ce test: Update tests to reflect name changes
The target acronyms on the Review step were replaced by full names of the targets. This reflects the change in the unit tests.
2024-06-18 09:19:45 +02:00
regexowl
a2ad644fb9 test: Edit mode tests for repositories
This adds a new 'repositories' fixture to the blueprints as was done for 'oscap'.

Newly added unit tests check that repositories get parsed from and back to request correctly and that when removing previously used repositories an 'Are you sure?' modal pops up.
2024-06-12 16:05:30 +02:00
Ondřej Budai
642cb10036 drop centos stream 8
CentOS Stream 8 is EOL, thus we should no longer offer it in the
service, because it can pose a security risk.

See https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/
2024-06-12 10:07:33 +02:00
regexowl
a23cc9321b test: Update tests after adding SaveAndBuild modal
This updates tests with a `openAndDismissSaveAndBuildModal` function that handles closing the SaveAndBuild modal after clicking on Create blueprint for the first time.
2024-06-06 16:58:59 +02:00
regexowl
45a42ce549 src: Migrate remaining files to TypeScript
This migrates remaining JavaScript files to TypeScript and updates imports.
2024-06-06 08:38:41 +02:00
regexowl
67138ad99a V2Wizard: Add tests for WSL/OpenSCAP behaviour
This adds two new tests:
- test that alert is rendered and OpenSCAP dropdown is disabled for WSL target only
- test that alert is rendered, but OpenSCAP dropdown is still enabled for target list that includes WSL
2024-06-05 17:04:14 +02:00
Andrew Dewar
5dc4ecb63f HMS-4024: Update repositories step 2024-06-04 14:05:44 +02:00
Amir
913a7d6406 WizardV2: fix google account typo 2024-05-27 09:42:13 +02:00
regexowl
12fc6b9841 V2Wizard: Set pkg recommendations expandable to open by default
This makes the pkg recommendations expandable open by default and updates the tests accordingly.
2024-05-22 16:48:11 +02:00
regexowl
f37bd91a9a test: Update tests after TypeScript migration
This resolves problems caused by TypeScript migration.
2024-05-03 16:36:26 +02:00
regexowl
6415664620 test: Replace 'rhel-94' with a constant
This replaces 'rhel-94' with a RHEL_9 constant in the tests.
2024-05-03 08:48:00 +02:00
regexowl
034843a708 src: Add rhel-94
This adds rhel94.
2024-05-02 16:44:33 +02:00
Amir
6f9c4f3864 feat(HMS-3582): add first boot step to wizard 2024-05-02 16:35:26 +02:00
Andrew Dewar
f9aae48dd1 Wizard V2: Packages refactor, recommendations fix. 2024-05-02 15:17:08 +03:00
regexowl
df9ec1499d V2Wizard: Fix FSC units on Edit
This updates the logic of parsing bytesize into size/unit pair.

Currently 'GiB' is set as a default which causes problem with smaller partitions on Edit.

A validation for the min_size is in place and the rule is that the size cannot be smaller than 0 of a given unit. If there was a partition with smaller size in KiB it will break the rule when converted to GiB.
2024-05-01 19:47:41 +02:00
lucasgarfield
61b23216f4 V2 Wizard: OpenSCAP edit tests
Edit mode is now fully tested and working for OpenSCAP profiles. A
handler for the PUT request was added and the fixtures were updated to
support this.

`EditImageWizard.tsx`: Previously we dispatched `initializeWizard()`
while waiting for the blueprintDetails to load. This meant that the
state was incorrect (empty) while the blueprintDetails request was
in flight.

`requestMapper.tsx`: Correctly populate state in edit mode if the
blueprint contains a custom file system – previously custom mountpoints
were dropped and automatic mode was selected.

`spyOnRequest()`: Differentiate between request types (e.g. GET, PUT)
for the same endpoint.
2024-04-30 15:13:50 +02:00
regexowl
0c1af145c1 test: Add tests to check reseting public cloud states
This adds happy path tests that check whether the public cloud states get reset after the public cloud was removed from targets.
2024-04-29 15:35:59 +02:00
regexowl
6494070a40 test: Replace image installer with guest image in happy path tests
This replaces 'image-installer' target with 'guest-image' in happy path tests which allows proper testing of FSC functionality. File system customisations are not applied to bare metal - installer images.
2024-04-29 11:57:30 +02:00
regexowl
ec8cf1c8b9 test: Add test for checking ISO only / more targets FSC options
This adds two tests that check whether the "Manually configure partitions" options is hidden on ISO only target and shown when combined with another target.
2024-04-29 11:57:30 +02:00
lucasgarfield
bb91840eef V2 Wizard: Fix snapshot_date field
The snapshot_date in the image_request must be a date. snapshot_date is
an optional field and if no snapshot is used, the field should be
undefined. Previously it was an empty string and this caused image
builder to return a code 400 with message "Snapshot date is not in
DateOnly (yyyy-mm-dd) format".
2024-04-26 15:03:17 +02:00
Ondrej Ezr
7246cfbd16 WizardV2: pass module_hotfixes to the request 2024-04-26 13:59:20 +02:00
Andrew Dewar
3231b324f0 HMS-3796: Add snapshot date selection to wizard 2024-04-25 14:45:50 +02:00
regexowl
b6041d2022 V2Wizard: Add masked services to the "Disabled services" code block
Fixes #1985

This concatenates masked service to the disabled services so both get rendered in the "Disabled service" code block.

Test to check this was also added.
2024-04-25 11:40:17 +02:00
regexowl
45be93db11 test: Add debounce to tests
Extra await with longer time out was added to a test to accomodate searchTerm debounce.
2024-04-25 11:32:47 +02:00
regexowl
3b7a1338ec test: Add unleash flag mocking to the tests
The functionality is currently gated behind an unleash flag. This adds the mocked flag to the tests.
2024-04-25 11:22:08 +02:00
regexowl
6f6784df2d test: Add package recommendations to the happy path test
This adds unit tests for package recommendations to the `Packages.test.tsx`, testing the happy path for:
- adding single recommendation
- adding all recommendations
- removing a recommendation
2024-04-25 11:22:08 +02:00
regexowl
371588e9a2 test: Add tests for package recommendations
This updates the handlers and fixtures and adds a simple unit test testing that recommendations get rendered correctly and it's possible to add them to the blueprint.
2024-04-25 11:22:08 +02:00
lucasgarfield
1607fda162 V2 Wizard: Add Azure tests (HMS-2781)
Adds tests to verify that building an Azure image using either sources
or manually entering the required info results in a correctly generated
request.
2024-04-23 11:58:42 +02:00
lucasgarfield
1367de0684 V2 Wizard: Add AWS tests (HMS-2781)
Adds tests to verify that building an AWS image using either sources or
an account id results in a correctly generated request.
2024-04-23 10:40:31 +02:00
lucasgarfield
a1bdcaa54f V2 Wizard: Fix OpenSCAP step
OpenSCAP profile info is now correctly loaded into the state and
verified to be in the final request with tests.

I modified the fixtures for the OpenSCAP profiles. My changes ensure we
have a Venn-diagram like overlap when changing from one profile to
another where one package is the same, one package is removed, and one
package is added. The same is true for the services and partitions. For
kernel args it is not so important as that is just a string (as opposed
to an array), so it is enough to be different.

I was able to eliminate a useEffect by replacing it with a lazy query
trigger function. Setting the second arg `preferCacheValue` to `true`
means that a request is only made if cached data is not available.

I modified the Redux reducers a bit to add some additional safety.

`changeFileSystemPartitionMode` is now responsible for initializing the
partitions field in the state by adding the root partition – previously
this was done in the components themselves by dispatching
`addPartition`. This reducer can always be safely dispatched – if the
mode is ‘manual’, dispatching it with a payload of ‘manual’ will not
result in any changes to the state.

`addPackage` is also safer now. When a package is added, the list of
packages is checked. If there is a package with an identical name, the
new package overwrites the previous package. This is useful because the
description may be different for the same package – for instance, when
adding an OpenSCAP package, we use a custom description (‘this package
required by OpenSCAP’).
2024-04-23 10:02:03 +02:00
Amir
bac8e1e57f V2Wizard: add GCP target full test coverage 2024-04-18 18:51:40 +02:00
regexowl
dbeee5d066 V2Wizard: Differentiate between Create and Edit mode on Review step
This renames actions on the primary button on Review step for the Create mode so it's clear whether you're creating a blueprint from a scratch or saving changes to an already existing blueprint.
2024-04-17 18:46:49 +03:00
lucasgarfield
782a8eba7e V2 Wizard: Add custom file system to request customizations (HMS-3690)
The blueprint request now contains a field for the filesystem in its
customizations.
2024-04-16 10:02:19 +02:00
regexowl
43cb43dac8 V2Wizard: Add tally to the "Selected" toggle
This adds a tally of selected packages to the "Selected" toggle.
2024-04-11 11:41:46 +02:00
regexowl
a8270fd228 test: Re-enable FSC alert test and clean up
This re-enables test of FSC alert and cleans up previously commented lines of the tests.
2024-04-11 11:21:19 +02:00
regexowl
972190ecaf V2Wizard: Update create/edit button copy
This updates copy on the Save changes button as per recent mocks.
2024-04-10 13:44:22 +03:00