aboutsummaryrefslogtreecommitdiffstats
path: root/src/dcm/test/dcm_call_api.sh
diff options
context:
space:
mode:
authorIgor D.C <igor.duarte.cardoso@intel.com>2020-08-07 17:27:36 +0000
committerRitu Sood <Ritu.Sood@intel.com>2020-08-07 22:31:45 +0000
commit05622dec0df228abad862799385e71631073acc2 (patch)
tree66438231f70e5f6d3891fcc5ed57f9f14cc656c0 /src/dcm/test/dcm_call_api.sh
parent210d802c189bfdc399f3b11d3227a92acfa7d6a6 (diff)
Make dcm_call_api.sh test sufficient for apply
dcm_call_api.sh test script for DCM API is now enough to get /apply to work correctly out-of-the-box (i.e., all resource quotas are now in the correct format and apiGroups has been set to "" by default). Issue-ID: MULTICLOUD-1143 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com> Change-Id: Ia44ec3006409542ddd9e50d2345d2f9eaaad3ad5
Diffstat (limited to 'src/dcm/test/dcm_call_api.sh')
-rwxr-xr-xsrc/dcm/test/dcm_call_api.sh61
1 files changed, 19 insertions, 42 deletions
diff --git a/src/dcm/test/dcm_call_api.sh b/src/dcm/test/dcm_call_api.sh
index 966bc3d6..33fbf314 100755
--- a/src/dcm/test/dcm_call_api.sh
+++ b/src/dcm/test/dcm_call_api.sh
@@ -14,7 +14,6 @@
# * limitations under the License.
# */
-
dcm_addr="http://localhost:9077"
# parameters
@@ -22,6 +21,7 @@ project="test-project"
description="test-description"
logical_cloud_name="lc1"
namespace="ns1"
+api_groups=""
user="user-1"
permission="permission-1"
cluster_provider_name="cp-1"
@@ -52,7 +52,7 @@ logical_cloud_data="$(cat << EOF
"type" : "certificate",
"user-permissions" : [
{ "permission-name" : "${permission}",
- "apiGroups" : ["stable.example.com"],
+ "apiGroups" : ["${api_groups}"],
"resources" : ["secrets", "pods"],
"verbs" : ["get", "watch", "list", "create"]
}
@@ -99,8 +99,6 @@ cluster_2_data="$(cat << EOF
EOF
)"
-# removed all special chars from quota spec keys
-# due to loss of data when unmarshalling from json
quota_data="$(cat << EOF
{
"metadata" : {
@@ -108,54 +106,34 @@ quota_data="$(cat << EOF
"description": "${description}"
},
"spec" : {
- "persistentvolumeclaims" : "10",
- "pods": "500",
- "configmaps" : "10",
- "replicationcontrollers": "10",
- "resourcequotas" : "10",
- "services": "10",
- "secrets" : "10"
- }
-}
-EOF
-)"
-
-quota_data_original="$(cat << EOF
-{
- "metadata" : {
- "name" : "${quota_name}",
- "description": "${description}"
- },
- "spec" : {
"limits.cpu": "400",
"limits.memory": "1000Gi",
"requests.cpu": "300",
"requests.memory": "900Gi",
"requests.storage" : "500Gi",
- "requests.ephemeral-storage": "",
- "limits.ephemeral-storage": "",
- "persistentvolumeclaims" : " ",
+ "requests.ephemeral-storage": "500",
+ "limits.ephemeral-storage": "500",
+ "persistentvolumeclaims" : "500",
"pods": "500",
- "configmaps" : "",
- "replicationcontrollers": "",
- "resourcequotas" : "",
- "services": "",
- "services.loadbalancers" : "",
- "services.nodeports" : "",
- "secrets" : "",
- "count/replicationcontrollers" : "",
- "count/deployments.apps" : "",
- "count/replicasets.apps" : "",
- "count/statefulsets.apps" : "",
- "count/jobs.batch" : "",
- "count/cronjobs.batch" : "",
- "count/deployments.extensions" : ""
+ "configmaps" : "1000",
+ "replicationcontrollers": "500",
+ "resourcequotas" : "500",
+ "services": "500",
+ "services.loadbalancers" : "500",
+ "services.nodeports" : "500",
+ "secrets" : "500",
+ "count/replicationcontrollers" : "500",
+ "count/deployments.apps" : "500",
+ "count/replicasets.apps" : "500",
+ "count/statefulsets.apps" : "500",
+ "count/jobs.batch" : "500",
+ "count/cronjobs.batch" : "500",
+ "count/deployments.extensions" : "500"
}
}
EOF
)"
-
# Create logical cloud
printf "\n\nCreating logical cloud data\n\n"
curl -d "${logical_cloud_data}" -X POST ${logical_cloud_url}
@@ -169,7 +147,6 @@ curl -d "${cluster_2_data}" -X POST ${cluster_url}
printf "\n\nAdding resource quota for the logical cloud\n\n"
curl -d "${quota_data}" -X POST ${quota_url}
-
# Get logical cloud data
printf "\n\nGetting logical cloud\n\n"
curl -X GET "${logical_cloud_url}/${logical_cloud_name}"