From a2292eb6b00074e9556dda5b1325dd064f11ef5f Mon Sep 17 00:00:00 2001 From: Mitch Harding Date: Mon, 30 Jan 2023 14:59:40 -0500 Subject: [PATCH] CASMCMS-8399: Remove CRUS from CLI --- .version | 2 +- cray/modules/crus/.remote | 1 - cray/modules/crus/__init__.py | 0 cray/modules/crus/cli.py | 26 -- cray/modules/crus/swagger3.json | 603 -------------------------------- tests/test_modules/test_crus.py | 202 ----------- 6 files changed, 1 insertion(+), 833 deletions(-) delete mode 100644 cray/modules/crus/.remote delete mode 100644 cray/modules/crus/__init__.py delete mode 100644 cray/modules/crus/cli.py delete mode 100644 cray/modules/crus/swagger3.json delete mode 100644 tests/test_modules/test_crus.py diff --git a/.version b/.version index 106d4ac..534b316 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.69.0 +0.70.0 diff --git a/cray/modules/crus/.remote b/cray/modules/crus/.remote deleted file mode 100644 index f119d47..0000000 --- a/cray/modules/crus/.remote +++ /dev/null @@ -1 +0,0 @@ -https://stash.us.cray.com/projects/CLOUD/repos/cray-crus/browse/api/swagger.yaml?raw&at=refs%2Fheads%2Fmaster \ No newline at end of file diff --git a/cray/modules/crus/__init__.py b/cray/modules/crus/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/cray/modules/crus/cli.py b/cray/modules/crus/cli.py deleted file mode 100644 index f76b6ea..0000000 --- a/cray/modules/crus/cli.py +++ /dev/null @@ -1,26 +0,0 @@ -"""CRUS - Compute Rolling Upgrade Service - -MIT License - -(C) Copyright [2020] Hewlett Packard Enterprise Development LP - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -""" -from cray.generator import generate -cli = generate(__file__, condense=False) # pylint: disable=invalid-name diff --git a/cray/modules/crus/swagger3.json b/cray/modules/crus/swagger3.json deleted file mode 100644 index 831e811..0000000 --- a/cray/modules/crus/swagger3.json +++ /dev/null @@ -1,603 +0,0 @@ -{ - "components": { - "parameters": {}, - "schemas": { - "upgrade_session": { - "properties": { - "messages": { - "items": { - "description": "In conjunction with 'state' there may be messages that describe either an object's progress toward 'READY' or 'DELETED' states or reasons for reaching the 'PENDING' state. The 'messages' field provides these in a list of strings.", - "type": "string" - }, - "readOnly": true, - "type": "array" - }, - "upgrade_id": { - "description": "The (UUID) id of the upgrade session", - "readOnly": true, - "type": "string" - }, - "starting_label": { - "description": "The node label on the set of nodes to be upgraded.", - "example": "slurm-nodes", - "type": "string" - }, - "state": { - "description": "The state of an object vis-a-vis the configuration. Values are: 'READY', 'UPDATING', 'DELETING', 'DELETED', 'PENDING'. The 'READY' state means the configuration has been absorbed and propagated and the object is reconciled as configured. The 'UPDATING' state means the configuration has changed and the changes are still being absorbed and propagated. The 'DELETING' state means deletion of the object has been requested and is being processed but is not complete yet. The 'DELETED' state means all resources associated with the object configuration have been cleaned up and the object no longer exists. The configuration can safely be removed. The 'PENDING' state means some condition that requires manual intervention has prevented the object from reaching the 'READY' state from the 'UPDATING' or 'CREATED' state. A newly created object starts in the 'UPDATING' state.", - "readOnly": true, - "type": "string" - }, - "kind": { - "description": "The kind of object that the data here represent. Should always contain \"ComputeUpgradeSession\". Protects against stray data types.", - "example": "ComputeUpgradeSession", - "readOnly": true, - "type": "string" - }, - "completed": { - "description": "A boolean indicating whether processing on this Upgrade Session has completed or not. Internally set but externally visible for convenience.", - "example": false, - "readOnly": true, - "type": "boolean" - }, - "upgrade_step_size": { - "description": "A positive integer specifying the number of nodes to upgrade at a time.", - "example": 50, - "format": "int32", - "type": "integer" - }, - "upgrade_template_id": { - "description": "The Boot Orchestration Service (BOS) Boot Session Template ID (UUID) used to identify the Boot Session Template used to reboot and reconfigure nodes during this rolling upgrade. The single node group label configured in this Boot Session Template must exactly match the 'upgrading_label' in this Upgrade Session.", - "example": "a4cfe939-6057-4137-94b6-3de46157cb53", - "type": "string" - }, - "workload_manager_type": { - "description": "The name of the workload manager controlling the nodes with the starting label. Currently supported value: 'slurm'.", - "example": "slurm", - "type": "string" - }, - "failed_label": { - "description": "The node label to apply to nodes that fail to upgrade.", - "example": "failed-slurm-nodes", - "type": "string" - }, - "api_version": { - "description": "The API version corresponding to this upgrade session's data. Will always be equal to the API version under which the data were stored in ETCD. Protects against incompatible upgrade session.", - "example": "0.0.1", - "readOnly": true, - "type": "string" - }, - "upgrading_label": { - "description": "The node label used to identify the empty node group that will be used to boot and reconfigure each step of the rolling upgrade. This must exactly match the node label specified in the Boot Session Template configured for this upgrade.", - "example": "upgrading-slurm-nodes", - "type": "string" - } - }, - "required": [ - "failed_label", - "starting_label", - "upgrade_step_size", - "upgrade_template_id", - "upgrading_label", - "workload_manager_type" - ], - "type": "object" - } - } - }, - "info": { - "description": "Administrative Front End for Compute Rolling Upgrades", - "title": "Compute Rolling Upgrade Service", - "version": "0.0.3" - }, - "openapi": "3.0.2", - "paths": { - "/session": { - "get": { - "description": "Get the list of Upgrade Sessions", - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "items": { - "properties": { - "messages": { - "items": { - "description": "In conjunction with 'state' there may be messages that describe either an object's progress toward 'READY' or 'DELETED' states or reasons for reaching the 'PENDING' state. The 'messages' field provides these in a list of strings.", - "type": "string" - }, - "readOnly": true, - "type": "array" - }, - "upgrade_id": { - "description": "The (UUID) id of the upgrade session", - "readOnly": true, - "type": "string" - }, - "starting_label": { - "description": "The node label on the set of nodes to be upgraded.", - "example": "slurm-nodes", - "type": "string" - }, - "state": { - "description": "The state of an object vis-a-vis the configuration. Values are: 'READY', 'UPDATING', 'DELETING', 'DELETED', 'PENDING'. The 'READY' state means the configuration has been absorbed and propagated and the object is reconciled as configured. The 'UPDATING' state means the configuration has changed and the changes are still being absorbed and propagated. The 'DELETING' state means deletion of the object has been requested and is being processed but is not complete yet. The 'DELETED' state means all resources associated with the object configuration have been cleaned up and the object no longer exists. The configuration can safely be removed. The 'PENDING' state means some condition that requires manual intervention has prevented the object from reaching the 'READY' state from the 'UPDATING' or 'CREATED' state. A newly created object starts in the 'UPDATING' state.", - "readOnly": true, - "type": "string" - }, - "kind": { - "description": "The kind of object that the data here represent. Should always contain \"ComputeUpgradeSession\". Protects against stray data types.", - "example": "ComputeUpgradeSession", - "readOnly": true, - "type": "string" - }, - "completed": { - "description": "A boolean indicating whether processing on this Upgrade Session has completed or not. Internally set but externally visible for convenience.", - "example": false, - "readOnly": true, - "type": "boolean" - }, - "upgrade_step_size": { - "description": "A positive integer specifying the number of nodes to upgrade at a time.", - "example": 50, - "format": "int32", - "type": "integer" - }, - "upgrade_template_id": { - "description": "The Boot Orchestration Service (BOS) Boot Session Template ID (UUID) used to identify the Boot Session Template used to reboot and reconfigure nodes during this rolling upgrade. The single node group label configured in this Boot Session Template must exactly match the 'upgrading_label' in this Upgrade Session.", - "example": "a4cfe939-6057-4137-94b6-3de46157cb53", - "type": "string" - }, - "workload_manager_type": { - "description": "The name of the workload manager controlling the nodes with the starting label. Currently supported value: 'slurm'.", - "example": "slurm", - "type": "string" - }, - "failed_label": { - "description": "The node label to apply to nodes that fail to upgrade.", - "example": "failed-slurm-nodes", - "type": "string" - }, - "api_version": { - "description": "The API version corresponding to this upgrade session's data. Will always be equal to the API version under which the data were stored in ETCD. Protects against incompatible upgrade session.", - "example": "0.0.1", - "readOnly": true, - "type": "string" - }, - "upgrading_label": { - "description": "The node label used to identify the empty node group that will be used to boot and reconfigure each step of the rolling upgrade. This must exactly match the node label specified in the Boot Session Template configured for this upgrade.", - "example": "upgrading-slurm-nodes", - "type": "string" - } - }, - "required": [ - "failed_label", - "starting_label", - "upgrade_step_size", - "upgrade_template_id", - "upgrading_label", - "workload_manager_type" - ], - "type": "object" - }, - "type": "array" - } - } - }, - "description": "OK" - } - }, - "summary": "Get the list of Upgrade Sessions" - }, - "post": { - "description": "Create a new Upgrade Session", - "requestBody": { - "content": { - "application/json": { - "schema": { - "properties": { - "messages": { - "items": { - "description": "In conjunction with 'state' there may be messages that describe either an object's progress toward 'READY' or 'DELETED' states or reasons for reaching the 'PENDING' state. The 'messages' field provides these in a list of strings.", - "type": "string" - }, - "readOnly": true, - "type": "array" - }, - "upgrade_id": { - "description": "The (UUID) id of the upgrade session", - "readOnly": true, - "type": "string" - }, - "starting_label": { - "description": "The node label on the set of nodes to be upgraded.", - "example": "slurm-nodes", - "type": "string" - }, - "state": { - "description": "The state of an object vis-a-vis the configuration. Values are: 'READY', 'UPDATING', 'DELETING', 'DELETED', 'PENDING'. The 'READY' state means the configuration has been absorbed and propagated and the object is reconciled as configured. The 'UPDATING' state means the configuration has changed and the changes are still being absorbed and propagated. The 'DELETING' state means deletion of the object has been requested and is being processed but is not complete yet. The 'DELETED' state means all resources associated with the object configuration have been cleaned up and the object no longer exists. The configuration can safely be removed. The 'PENDING' state means some condition that requires manual intervention has prevented the object from reaching the 'READY' state from the 'UPDATING' or 'CREATED' state. A newly created object starts in the 'UPDATING' state.", - "readOnly": true, - "type": "string" - }, - "kind": { - "description": "The kind of object that the data here represent. Should always contain \"ComputeUpgradeSession\". Protects against stray data types.", - "example": "ComputeUpgradeSession", - "readOnly": true, - "type": "string" - }, - "completed": { - "description": "A boolean indicating whether processing on this Upgrade Session has completed or not. Internally set but externally visible for convenience.", - "example": false, - "readOnly": true, - "type": "boolean" - }, - "upgrade_step_size": { - "description": "A positive integer specifying the number of nodes to upgrade at a time.", - "example": 50, - "format": "int32", - "type": "integer" - }, - "upgrade_template_id": { - "description": "The Boot Orchestration Service (BOS) Boot Session Template ID (UUID) used to identify the Boot Session Template used to reboot and reconfigure nodes during this rolling upgrade. The single node group label configured in this Boot Session Template must exactly match the 'upgrading_label' in this Upgrade Session.", - "example": "a4cfe939-6057-4137-94b6-3de46157cb53", - "type": "string" - }, - "workload_manager_type": { - "description": "The name of the workload manager controlling the nodes with the starting label. Currently supported value: 'slurm'.", - "example": "slurm", - "type": "string" - }, - "failed_label": { - "description": "The node label to apply to nodes that fail to upgrade.", - "example": "failed-slurm-nodes", - "type": "string" - }, - "api_version": { - "description": "The API version corresponding to this upgrade session's data. Will always be equal to the API version under which the data were stored in ETCD. Protects against incompatible upgrade session.", - "example": "0.0.1", - "readOnly": true, - "type": "string" - }, - "upgrading_label": { - "description": "The node label used to identify the empty node group that will be used to boot and reconfigure each step of the rolling upgrade. This must exactly match the node label specified in the Boot Session Template configured for this upgrade.", - "example": "upgrading-slurm-nodes", - "type": "string" - } - }, - "required": [ - "failed_label", - "starting_label", - "upgrade_step_size", - "upgrade_template_id", - "upgrading_label", - "workload_manager_type" - ], - "type": "object" - } - } - } - }, - "responses": { - "201": { - "content": { - "application/json": { - "schema": { - "properties": { - "messages": { - "items": { - "description": "In conjunction with 'state' there may be messages that describe either an object's progress toward 'READY' or 'DELETED' states or reasons for reaching the 'PENDING' state. The 'messages' field provides these in a list of strings.", - "type": "string" - }, - "readOnly": true, - "type": "array" - }, - "upgrade_id": { - "description": "The (UUID) id of the upgrade session", - "readOnly": true, - "type": "string" - }, - "starting_label": { - "description": "The node label on the set of nodes to be upgraded.", - "example": "slurm-nodes", - "type": "string" - }, - "state": { - "description": "The state of an object vis-a-vis the configuration. Values are: 'READY', 'UPDATING', 'DELETING', 'DELETED', 'PENDING'. The 'READY' state means the configuration has been absorbed and propagated and the object is reconciled as configured. The 'UPDATING' state means the configuration has changed and the changes are still being absorbed and propagated. The 'DELETING' state means deletion of the object has been requested and is being processed but is not complete yet. The 'DELETED' state means all resources associated with the object configuration have been cleaned up and the object no longer exists. The configuration can safely be removed. The 'PENDING' state means some condition that requires manual intervention has prevented the object from reaching the 'READY' state from the 'UPDATING' or 'CREATED' state. A newly created object starts in the 'UPDATING' state.", - "readOnly": true, - "type": "string" - }, - "kind": { - "description": "The kind of object that the data here represent. Should always contain \"ComputeUpgradeSession\". Protects against stray data types.", - "example": "ComputeUpgradeSession", - "readOnly": true, - "type": "string" - }, - "completed": { - "description": "A boolean indicating whether processing on this Upgrade Session has completed or not. Internally set but externally visible for convenience.", - "example": false, - "readOnly": true, - "type": "boolean" - }, - "upgrade_step_size": { - "description": "A positive integer specifying the number of nodes to upgrade at a time.", - "example": 50, - "format": "int32", - "type": "integer" - }, - "upgrade_template_id": { - "description": "The Boot Orchestration Service (BOS) Boot Session Template ID (UUID) used to identify the Boot Session Template used to reboot and reconfigure nodes during this rolling upgrade. The single node group label configured in this Boot Session Template must exactly match the 'upgrading_label' in this Upgrade Session.", - "example": "a4cfe939-6057-4137-94b6-3de46157cb53", - "type": "string" - }, - "workload_manager_type": { - "description": "The name of the workload manager controlling the nodes with the starting label. Currently supported value: 'slurm'.", - "example": "slurm", - "type": "string" - }, - "failed_label": { - "description": "The node label to apply to nodes that fail to upgrade.", - "example": "failed-slurm-nodes", - "type": "string" - }, - "api_version": { - "description": "The API version corresponding to this upgrade session's data. Will always be equal to the API version under which the data were stored in ETCD. Protects against incompatible upgrade session.", - "example": "0.0.1", - "readOnly": true, - "type": "string" - }, - "upgrading_label": { - "description": "The node label used to identify the empty node group that will be used to boot and reconfigure each step of the rolling upgrade. This must exactly match the node label specified in the Boot Session Template configured for this upgrade.", - "example": "upgrading-slurm-nodes", - "type": "string" - } - }, - "required": [ - "failed_label", - "starting_label", - "upgrade_step_size", - "upgrade_template_id", - "upgrading_label", - "workload_manager_type" - ], - "type": "object" - } - } - }, - "description": "Created" - }, - "400": { - "description": "Bad Request" - }, - "422": { - "description": "Unprocessable Entity" - } - }, - "summary": "Create a new Upgrade Session" - } - }, - "/session/{upgrade_id}": { - "get": { - "description": "Get a specific Upgrade Session by its ID", - "parameters": [ - { - "in": "path", - "name": "upgrade_id", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "properties": { - "messages": { - "items": { - "description": "In conjunction with 'state' there may be messages that describe either an object's progress toward 'READY' or 'DELETED' states or reasons for reaching the 'PENDING' state. The 'messages' field provides these in a list of strings.", - "type": "string" - }, - "readOnly": true, - "type": "array" - }, - "upgrade_id": { - "description": "The (UUID) id of the upgrade session", - "readOnly": true, - "type": "string" - }, - "starting_label": { - "description": "The node label on the set of nodes to be upgraded.", - "example": "slurm-nodes", - "type": "string" - }, - "state": { - "description": "The state of an object vis-a-vis the configuration. Values are: 'READY', 'UPDATING', 'DELETING', 'DELETED', 'PENDING'. The 'READY' state means the configuration has been absorbed and propagated and the object is reconciled as configured. The 'UPDATING' state means the configuration has changed and the changes are still being absorbed and propagated. The 'DELETING' state means deletion of the object has been requested and is being processed but is not complete yet. The 'DELETED' state means all resources associated with the object configuration have been cleaned up and the object no longer exists. The configuration can safely be removed. The 'PENDING' state means some condition that requires manual intervention has prevented the object from reaching the 'READY' state from the 'UPDATING' or 'CREATED' state. A newly created object starts in the 'UPDATING' state.", - "readOnly": true, - "type": "string" - }, - "kind": { - "description": "The kind of object that the data here represent. Should always contain \"ComputeUpgradeSession\". Protects against stray data types.", - "example": "ComputeUpgradeSession", - "readOnly": true, - "type": "string" - }, - "completed": { - "description": "A boolean indicating whether processing on this Upgrade Session has completed or not. Internally set but externally visible for convenience.", - "example": false, - "readOnly": true, - "type": "boolean" - }, - "upgrade_step_size": { - "description": "A positive integer specifying the number of nodes to upgrade at a time.", - "example": 50, - "format": "int32", - "type": "integer" - }, - "upgrade_template_id": { - "description": "The Boot Orchestration Service (BOS) Boot Session Template ID (UUID) used to identify the Boot Session Template used to reboot and reconfigure nodes during this rolling upgrade. The single node group label configured in this Boot Session Template must exactly match the 'upgrading_label' in this Upgrade Session.", - "example": "a4cfe939-6057-4137-94b6-3de46157cb53", - "type": "string" - }, - "workload_manager_type": { - "description": "The name of the workload manager controlling the nodes with the starting label. Currently supported value: 'slurm'.", - "example": "slurm", - "type": "string" - }, - "failed_label": { - "description": "The node label to apply to nodes that fail to upgrade.", - "example": "failed-slurm-nodes", - "type": "string" - }, - "api_version": { - "description": "The API version corresponding to this upgrade session's data. Will always be equal to the API version under which the data were stored in ETCD. Protects against incompatible upgrade session.", - "example": "0.0.1", - "readOnly": true, - "type": "string" - }, - "upgrading_label": { - "description": "The node label used to identify the empty node group that will be used to boot and reconfigure each step of the rolling upgrade. This must exactly match the node label specified in the Boot Session Template configured for this upgrade.", - "example": "upgrading-slurm-nodes", - "type": "string" - } - }, - "required": [ - "failed_label", - "starting_label", - "upgrade_step_size", - "upgrade_template_id", - "upgrading_label", - "workload_manager_type" - ], - "type": "object" - } - } - }, - "description": "OK" - }, - "404": { - "description": "Not Found" - } - }, - "summary": "Get a specific Upgrade Session by its ID" - }, - "delete": { - "description": "Delete a specific Upgrade Session by its ID", - "parameters": [ - { - "in": "path", - "name": "upgrade_id", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "properties": { - "messages": { - "items": { - "description": "In conjunction with 'state' there may be messages that describe either an object's progress toward 'READY' or 'DELETED' states or reasons for reaching the 'PENDING' state. The 'messages' field provides these in a list of strings.", - "type": "string" - }, - "readOnly": true, - "type": "array" - }, - "upgrade_id": { - "description": "The (UUID) id of the upgrade session", - "readOnly": true, - "type": "string" - }, - "starting_label": { - "description": "The node label on the set of nodes to be upgraded.", - "example": "slurm-nodes", - "type": "string" - }, - "state": { - "description": "The state of an object vis-a-vis the configuration. Values are: 'READY', 'UPDATING', 'DELETING', 'DELETED', 'PENDING'. The 'READY' state means the configuration has been absorbed and propagated and the object is reconciled as configured. The 'UPDATING' state means the configuration has changed and the changes are still being absorbed and propagated. The 'DELETING' state means deletion of the object has been requested and is being processed but is not complete yet. The 'DELETED' state means all resources associated with the object configuration have been cleaned up and the object no longer exists. The configuration can safely be removed. The 'PENDING' state means some condition that requires manual intervention has prevented the object from reaching the 'READY' state from the 'UPDATING' or 'CREATED' state. A newly created object starts in the 'UPDATING' state.", - "readOnly": true, - "type": "string" - }, - "kind": { - "description": "The kind of object that the data here represent. Should always contain \"ComputeUpgradeSession\". Protects against stray data types.", - "example": "ComputeUpgradeSession", - "readOnly": true, - "type": "string" - }, - "completed": { - "description": "A boolean indicating whether processing on this Upgrade Session has completed or not. Internally set but externally visible for convenience.", - "example": false, - "readOnly": true, - "type": "boolean" - }, - "upgrade_step_size": { - "description": "A positive integer specifying the number of nodes to upgrade at a time.", - "example": 50, - "format": "int32", - "type": "integer" - }, - "upgrade_template_id": { - "description": "The Boot Orchestration Service (BOS) Boot Session Template ID (UUID) used to identify the Boot Session Template used to reboot and reconfigure nodes during this rolling upgrade. The single node group label configured in this Boot Session Template must exactly match the 'upgrading_label' in this Upgrade Session.", - "example": "a4cfe939-6057-4137-94b6-3de46157cb53", - "type": "string" - }, - "workload_manager_type": { - "description": "The name of the workload manager controlling the nodes with the starting label. Currently supported value: 'slurm'.", - "example": "slurm", - "type": "string" - }, - "failed_label": { - "description": "The node label to apply to nodes that fail to upgrade.", - "example": "failed-slurm-nodes", - "type": "string" - }, - "api_version": { - "description": "The API version corresponding to this upgrade session's data. Will always be equal to the API version under which the data were stored in ETCD. Protects against incompatible upgrade session.", - "example": "0.0.1", - "readOnly": true, - "type": "string" - }, - "upgrading_label": { - "description": "The node label used to identify the empty node group that will be used to boot and reconfigure each step of the rolling upgrade. This must exactly match the node label specified in the Boot Session Template configured for this upgrade.", - "example": "upgrading-slurm-nodes", - "type": "string" - } - }, - "required": [ - "failed_label", - "starting_label", - "upgrade_step_size", - "upgrade_template_id", - "upgrading_label", - "workload_manager_type" - ], - "type": "object" - } - } - }, - "description": "OK" - }, - "404": { - "description": "Not Found" - } - }, - "summary": "Delete a specific Upgrade Session by its ID" - } - } - }, - "servers": [ - { - "description": "Cluster External API access", - "url": "/apis/crus" - }, - { - "description": "Cluster Internal API access", - "url": "/" - } - ], - "tags": [] -} \ No newline at end of file diff --git a/tests/test_modules/test_crus.py b/tests/test_modules/test_crus.py deleted file mode 100644 index 5f4f55a..0000000 --- a/tests/test_modules/test_crus.py +++ /dev/null @@ -1,202 +0,0 @@ -""" Test the crus module. - -MIT License - -(C) Copyright [2020] Hewlett Packard Enterprise Development LP - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -""" -# pylint: disable=invalid-name -# pylint: disable=too-many-arguments, unused-argument -import json - -from ..utils.runner import cli_runner # pylint: disable=unused-import -from ..utils.rest import rest_mock # pylint: disable=unused-import - - -# pylint: disable=redefined-outer-name -def test_cray_crus_usage_info(cli_runner, rest_mock): - """ Test `cray crus` to make sure the expected commands are available """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['crus']) - - outputs = [ - "cli crus [OPTIONS] COMMAND [ARGS]...", - "Compute Rolling Upgrade Service", - "session", - ] - - for out in outputs: - assert out in result.output - assert result.exit_code == 0 - - -# pylint: disable=redefined-outer-name -def test_cray_crus_session_usage_info(cli_runner, rest_mock): - """ Test `cray crus` to make sure the expected commands are available """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['crus', 'session']) - - outputs = [ - "cli crus session [OPTIONS] COMMAND [ARGS]...", - "create", - "delete", - "describe", - "list" - ] - for out in outputs: - assert out in result.output - assert result.exit_code == 0 - - -# pylint: disable=redefined-outer-name -def test_cray_crus_session_create_usage_info(cli_runner, rest_mock): - """ Test `cray crus` to make sure the expected commands are available """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['crus', 'session', 'create', '--help']) - - outputs = [ - "cli crus session create [OPTIONS]", - "--upgrade-template-id", - "--failed-label", - "--upgrading-label", - "--starting-label", - "--upgrade-step-size", - "--workload-manager-type", - ] - for out in outputs: - assert out in result.output - assert result.exit_code == 0 - - -# pylint: disable=redefined-outer-name -def test_cray_crus_session_create(cli_runner, rest_mock): - """Test `cray crus session create` with all options to make sure the - right data are sent. - - """ - runner, cli, opts = cli_runner - url_template = '/apis/crus/session' - config = opts['default'] - hostname = config['hostname'] - result = runner.invoke( - cli, - ['crus', - 'session', - 'create', - '--starting-label', - 'starting-nodes', - '--failed-label', - 'failed-nodes', - '--upgrading-label', - 'upgrading-nodes', - '--workload-manager-type', - 'slurm', - '--upgrade-step-size', - '50', - '--upgrade-template-id', - 'some-string-that-stands-in-for-a-UUID' - ] - ) - print(result.output) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'].lower() == 'post' - assert data.get('body', None) - body = data.get('body') - assert body['starting_label'] == 'starting-nodes' - assert body['failed_label'] == 'failed-nodes' - assert body['upgrading_label'] == 'upgrading-nodes' - assert body['workload_manager_type'] == 'slurm' - assert body['upgrade_step_size'] == 50 - assert body['upgrade_template_id'] == 'some-string-that-stands-in-for-a-UUID' - uri = data['url'].split(hostname)[-1] - assert uri == url_template - - -# pylint: disable=redefined-outer-name -def test_cray_crus_session_list(cli_runner, rest_mock): - """Test `cray crus session list` to see that it sends the right - operation and data. - - """ - # pylint: disable=protected-access - runner, cli, opts = cli_runner - url_template = '/apis/crus/session' - config = opts['default'] - hostname = config['hostname'] - result = runner.invoke( - cli, - ['crus', 'session', 'list'] - ) - print(result.output) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'].lower() == 'get' - assert data.get('body') is None - uri = data['url'].split(hostname)[-1] - assert url_template in uri - - -# pylint: disable=redefined-outer-name -def test_cray_crus_session_describe(cli_runner, rest_mock): - """Test `cray crus session describe my-session-id` to see that it - sends the right operation and data. - - """ - # pylint: disable=protected-access - runner, cli, opts = cli_runner - url_template = '/apis/crus/session/my-session-id' - config = opts['default'] - hostname = config['hostname'] - result = runner.invoke( - cli, - ['crus', 'session', 'describe', 'my-session-id'] - ) - print(result.output) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'].lower() == 'get' - assert data.get('body') is None - uri = data['url'].split(hostname)[-1] - assert url_template in uri - - -# pylint: disable=redefined-outer-name -def test_cray_crus_session_delete(cli_runner, rest_mock): - """Test `cray crus session delete my-session-id` to see that it sends - the right operation and data. - - """ - # pylint: disable=protected-access - runner, cli, opts = cli_runner - url_template = '/apis/crus/session/my-session-id' - config = opts['default'] - hostname = config['hostname'] - result = runner.invoke( - cli, - ['crus', 'session', 'delete', 'my-session-id'] - ) - print(result.output) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'].lower() == 'delete' - assert data.get('body') is None - uri = data['url'].split(hostname)[-1] - assert url_template in uri