summaryrefslogtreecommitdiffstats
path: root/tests/nvme_ctrl_reset_test.py
blob: b8b3c3b9376ebeeaef39b8251ee8363f26b9120f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This file is part of nvme-cli
#
# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved.
#
# Author: Arunpandian J <arun.j@samsung.com>

"""
NVMe controller reset Testcase:-

    1. Execute nvme controller reset.

"""

from nvme_test import TestNVMe


class TestNVMeCtrlReset(TestNVMe):

    """
    Represents NVMe Controller reset testcase.
        - Attributes:
              - test_log_dir :  directory for logs, temp files.
    """

    def setUp(self):
        """ Pre Section for TestNVMeCtrlReset """
        super().setUp()
        self.setup_log_dir(self.__class__.__name__)

    def tearDown(self):
        """ Post Section for TestNVMeCtrlReset """
        super().tearDown()

    def ctrl_reset(self):
        """ Wrapper for nvme controller reset
            - Args:
                - None
            - Returns:
                - return code for nvme controller reset.
        """
        ctrl_reset_cmd = "nvme reset " + self.ctrl
        return self.exec_cmd(ctrl_reset_cmd)

    def test_ctrl_reset(self):
        """ Testcase main """
        self.assertEqual(self.ctrl_reset(), 0)