Skip to content

Commit

Permalink
CSI-5774: UT for new error code
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomit Neufeld <[email protected]>
  • Loading branch information
shlomitn committed Jan 12, 2025
1 parent 127df08 commit 4f9cd44
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile-controllers.test
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RUN pip3 install -r ./csi_requirements.txt -r ./host_definer_requirements.txt

USER root
COPY controllers/scripts/csi_general .
RUN chmod +x csi_pb2.sh
RUN ./csi_pb2.sh
RUN pip3 install .

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ def test_unmap_volume_by_initiators_unmap_volume_object_not_found_error(self):
def test_unmap_volume_by_initiators_unmap_volume_volume_already_unmapped_error(self):
self._test_unpublish_volume_unmap_volume_with_error(array_errors.VolumeAlreadyUnmappedError(''))

def test_unmap_volume_by_initiators_unmap_volume_volume_not_mapped_to_host_error(self):
self._test_unpublish_volume_unmap_volume_with_error(array_errors.VolumeNotMappedToHostError('volume', 'host'))

def test_unmap_volume_by_initiators_unmap_volume_permission_denied_error(self):
self._test_unpublish_volume_unmap_volume_with_error(array_errors.PermissionDeniedError(''))

Expand Down
2 changes: 2 additions & 0 deletions controllers/tests/array_action/svc/array_mediator_svc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,8 @@ def test_unmap_volume_rmvdiskhostmap_errors(self):
array_errors.HostNotFoundError)
self._test_unmap_volume_rmvdiskhostmap_error(svc_errors.CommandExecutionError("CMMVC5842E"),
array_errors.VolumeAlreadyUnmappedError)
self._test_unmap_volume_rmvdiskhostmap_error(svc_errors.CommandExecutionError("CMMVC5804E"),
array_errors.VolumeNotMappedToHostError)
self._test_unmap_volume_rmvdiskhostmap_error(svc_errors.CommandExecutionError(
array_settings.DUMMY_ERROR_MESSAGE),
array_errors.UnmappingError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,10 @@ def test_unpublish_volume_unmap_volume_by_initiators_volume_already_unmapped_err
self._test_unpublish_volume_unmap_volume_by_initiators_with_error(array_errors.VolumeAlreadyUnmappedError(""),
grpc.StatusCode.OK)

def test_unpublish_volume_unmap_volume_by_initiators_volume_not_mapped_to_host_error(self):
self._test_unpublish_volume_unmap_volume_by_initiators_with_error(array_errors.VolumeNotMappedToHostError("volume", "host"),
grpc.StatusCode.OK)

def test_unpublish_volume_unmap_volume_by_initiators_permission_denied_error(self):
self._test_unpublish_volume_unmap_volume_by_initiators_with_error(array_errors.PermissionDeniedError("msg"),
grpc.StatusCode.PERMISSION_DENIED)
Expand Down
4 changes: 2 additions & 2 deletions scripts/run_unitests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -x
[ -n "$1" ] && coverage="-v $1:/driver/coverage:z"
docker build -f Dockerfile-controllers.test -t csi-controller-tests . && \
docker run --entrypoint ./controllers/scripts/unitests.sh --rm -t $coverage csi-controller-tests
podman build -f Dockerfile-controllers.test -t csi-controller-tests . && \
podman run --entrypoint ./controllers/scripts/unitests.sh --rm -t $coverage csi-controller-tests

0 comments on commit 4f9cd44

Please sign in to comment.