Skip to content

Commit

Permalink
CSI-5718: removed unneeded UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
kasserater committed Aug 1, 2024
1 parent 752ff01 commit 2b15a95
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-controllers.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# This Dockerfile.test is for running the csi controller local tests inside a container.
# Its similar to the Dockerfile, but with additional requirements-tests.txt and ENTRYPOINT to run the local tests.

FROM registry.access.redhat.com/ubi8/python-38:1-131 as builder
FROM registry.access.redhat.com/ubi8/python-38:1-131 AS builder
USER root
RUN if [[ "$(uname -m)" != "x86"* ]]; then yum install -y rust-toolset; fi
USER default
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-csi-controller
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM registry.access.redhat.com/ubi8/python-38:1-131 as builder
FROM registry.access.redhat.com/ubi8/python-38:1-131 AS builder

USER root
RUN if [[ "$(uname -m)" != "x86"* ]]; then yum install -y rust-toolset; fi
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-csi-host-definer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi8/python-38:1-131 as builder
FROM registry.access.redhat.com/ubi8/python-38:1-131 AS builder

USER root
RUN yum update -y
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-csi-node
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Build stage
FROM golang:1.20 as builder
FROM golang:1.20 AS builder

WORKDIR /go/src/github.com/ibm/ibm-block-csi-driver
ENV GO111MODULE=on
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-csi-node.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Build stage
FROM golang:1.20 as builder
FROM golang:1.20 AS builder

WORKDIR /go/src/github.com/ibm/ibm-block-csi-driver
ENV GO111MODULE=on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import controllers.array_action.errors as array_errors
import controllers.tests.array_action.test_settings as array_settings
import controllers.tests.common.test_settings as common_settings
from controllers.array_action.array_action_types import Host
from controllers.array_action.array_mediator_abstract import ArrayMediatorAbstract
from controllers.common.node_info import Initiators
from controllers.tests import utils
Expand Down Expand Up @@ -40,8 +39,6 @@ class BaseMediatorAbstractSetUp(unittest.TestCase):
def setUp(self):
self.mediator = _get_array_mediator_abstract_class()

self.mediator.get_volume_mappings.return_value = {}

self.fc_ports = [array_settings.DUMMY_FC_WWN1, array_settings.DUMMY_FC_WWN2]
self.lun_id = array_settings.DUMMY_LUN_ID
self.connectivity_type = array_settings.FC_CONNECTIVITY_TYPE
Expand Down Expand Up @@ -89,33 +86,6 @@ def test_map_volume_by_initiators_get_iscsi_targets_by_iqn_excpetions(self):
with self.assertRaises(array_errors.NoIscsiTargetsFoundError):
self.mediator.map_volume_by_initiators('', self.initiators)

def test_map_volume_by_initiators_get_volume_mappings_more_then_one_mapping(self):
self.mediator.get_volume_mappings.return_value = {array_settings.DUMMY_HOST_ID1: array_settings.DUMMY_HOST_ID1,
array_settings.DUMMY_HOST_ID2: array_settings.DUMMY_HOST_ID2}

with self.assertRaises(array_errors.VolumeAlreadyMappedToDifferentHostsError):
self.mediator.map_volume_by_initiators('', self.initiators)

def test_map_volume_by_initiators_get_volume_mappings_one_mapping(self):
self.mediator.get_volume_mappings.return_value = {array_settings.DUMMY_HOST_ID1: array_settings.DUMMY_HOST_ID1}
self.mediator.get_host_by_name.return_value = Host(name=self.hostname,
connectivity_types=[array_settings.ISCSI_CONNECTIVITY_TYPE],
iscsi_iqns=[self.iqn])

with self.assertRaises(array_errors.VolumeAlreadyMappedToDifferentHostsError):
self.mediator.map_volume_by_initiators('', self.initiators)

def test_map_volume_by_initiators_get_volume_mappings_one_map_for_existing_host(self):
self.mediator.get_volume_mappings = Mock()
self.mediator.get_volume_mappings.return_value = {self.hostname: self.lun_id}
self.mediator.get_host_by_name.return_value = Host(name=self.hostname,
connectivity_types=[array_settings.ISCSI_CONNECTIVITY_TYPE],
iscsi_iqns=[self.iqn])

self.initiators.iscsi_iqns = [self.iqn]
response = self.mediator.map_volume_by_initiators('', self.initiators)
self.assertEqual((self.lun_id, array_settings.ISCSI_CONNECTIVITY_TYPE, self.iscsi_targets_by_iqn), response)

def test_map_volume_by_initiators_map_volume_excpetions(self):
self.mediator.map_volume.side_effect = [array_errors.PermissionDeniedError('')]

Expand Down

0 comments on commit 2b15a95

Please # to comment.