LCOV - code coverage report
Current view: top level - lcov - github-pr.diff Coverage Total Hit
Test: cockpit Lines: 0.0 % 46 0
Test Date: 2026-07-06 08:56:22

            Line data    Source code
       1              : diff --git a/pkg/kdump/kdump-view.jsx b/pkg/kdump/kdump-view.jsx
       2              : index 0910bc45a..82f3e91ae 100644
       3              : --- a/pkg/kdump/kdump-view.jsx
       4              : +++ b/pkg/kdump/kdump-view.jsx
       5              : @@ -31,7 +31,6 @@ import { Tooltip } from "@patternfly/react-core/dist/esm/components/Tooltip/inde
       6              :  import { useDialogs, DialogsContext } from "dialogs.jsx";
       7              :  import { read_os_release } from "os-release.js";
       8              :  import { fmt_to_fragments } from 'utils.jsx';
       9              : -import { show_modal_dialog } from "cockpit-components-dialog.jsx";
      10              :  import { FormHelper } from "cockpit-components-form-helper";
      11              :  import { ModalError } from 'cockpit-components-inline-notification.jsx';
      12              :  import { PrivilegedButton } from "cockpit-components-privileged";
      13              : @@ -316,6 +315,52 @@ const KdumpSettingsModal = ({ settings, initialTarget, handleSave }) => {
      14              :          </Modal>);
      15              :  };
      16              :  
      17            0 : +const KdumpTestDialog = ({ verifyMessage, onCrashKernel }) => {
      18            0 : +    const Dialogs = useDialogs();
      19            0 : +    const [task, setTask] = useState(null);
      20            0 : +    const [error, setError] = useState(null);
      21              : +
      22            0 : +    function crash() {
      23            0 : +        setError(null);
      24            0 : +        setTask(onCrashKernel()
      25            0 : +                .then(Dialogs.close)
      26            0 : +                .catch(error => {
      27            0 : +                    setTask(null);
      28            0 : +                    setError(error);
      29            0 : +                }));
      30            0 : +    }
      31              : +
      32            0 : +    return (
      33            0 : +        <Modal position="top" variant="small" id="kdump-test-dialog" isOpen
      34            0 : +               onClose={Dialogs.close}>
      35            0 : +            <ModalHeader title={_("Test kdump settings")} titleIconVariant="warning" />
      36            0 : +            <ModalBody>
      37            0 : +                {error && <ModalError dialogError={error.message || error} />}
      38            0 : +                <Content>
      39            0 : +                    <Content component={ContentVariants.p}>
      40            0 : +                        {_("Test kdump settings by crashing the kernel. This may take a while and the system might not automatically reboot. Do not purposefully crash the system while any important task is running.")}
      41            0 : +                    </Content>
      42            0 : +                    {verifyMessage && <Content component={ContentVariants.p}>
      43            0 : +                        {verifyMessage}
      44            0 : +                    </Content>}
      45            0 : +                </Content>
      46            0 : +            </ModalBody>
      47            0 : +            <ModalFooter>
      48            0 : +                <Button variant="danger"
      49            0 : +                        isLoading={!!task}
      50            0 : +                        isDisabled={!!task}
      51            0 : +                        onClick={crash}>
      52            0 : +                    {_("Crash system")}
      53            0 : +                </Button>
      54            0 : +                <Button variant="link"
      55            0 : +                        isDisabled={!!task}
      56            0 : +                        onClick={Dialogs.close}>
      57            0 : +                    {_("Cancel")}
      58            0 : +                </Button>
      59            0 : +            </ModalFooter>
      60            0 : +        </Modal>);
      61            0 : +};
      62              : +
      63              :  /* Show kdump status of the system and offer options to change or test the state
      64              :   * Expected properties:
      65              :   * kdumpActive       kdump service status
      66              : @@ -340,6 +385,7 @@ export class KdumpPage extends React.Component {
      67              :      }
      68              :  
      69              :      handleTestSettingsClick() {
      70            0 : +        const Dialogs = this.context;
      71              :          // if we have multiple targets defined, the config is invalid
      72              :          const target = this.props.kdumpStatus.target;
      73              :          let verifyMessage;
      74              : @@ -359,30 +405,8 @@ export class KdumpPage extends React.Component {
      75              :              }
      76              :          }
      77              :  
      78              : -        // open a dialog to confirm crashing the kernel to test the settings - then do it
      79              : -        const dialogProps = {
      80              : -            title: _("Test kdump settings"),
      81              : -            body: (<Content>
      82              : -                <Content component={ContentVariants.p}>
      83              : -                    {_("Test kdump settings by crashing the kernel. This may take a while and the system might not automatically reboot. Do not purposefully crash the system while any important task is running.")}
      84              : -                </Content>
      85              : -                {verifyMessage && <Content component={ContentVariants.p}>
      86              : -                    {verifyMessage}
      87              : -                </Content>}
      88              : -            </Content>),
      89              : -            titleIconVariant: "warning",
      90              : -        };
      91              : -        // also test modifying properties in subsequent render calls
      92              : -        const footerProps = {
      93              : -            actions: [
      94              : -                {
      95              : -                    clicked: this.props.onCrashKernel.bind(this),
      96              : -                    caption: _("Crash system"),
      97              : -                    style: 'danger',
      98              : -                }
      99              : -            ],
     100              : -        };
     101              : -        show_modal_dialog(dialogProps, footerProps);
     102            0 : +        Dialogs.show(<KdumpTestDialog verifyMessage={verifyMessage}
     103            0 : +                                      onCrashKernel={this.props.onCrashKernel} />);
     104              :      }
     105              :  
     106              :      handleServiceDetailsClick() {
     107              : diff --git a/test/verify/check-kdump b/test/verify/check-kdump
     108              : index b150520a7..c79f648ab 100755
     109              : --- a/test/verify/check-kdump
     110              : +++ b/test/verify/check-kdump
     111              : @@ -46,7 +46,7 @@ class KdumpHelpers(testlib.MachineCase):
     112              :              # we should get a warning dialog, confirm
     113              :              browser.click(f".pf-v6-c-modal-box button{self.danger_btn_class}")
     114              :              # wait until we've actually triggered a crash
     115              : -            browser.wait_visible(".apply.pf-m-in-progress")
     116              : +            browser.wait_visible("button.pf-m-in-progress")
     117              :  
     118              :              # wait for disconnect and then try connecting again
     119              :              browser.switch_to_top()
        

Generated by: LCOV version 2.0-1