Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Update run_example.sh to genearte new project name
Browse files Browse the repository at this point in the history
Since project-name should be unique, the run_example.sh script should
produce a unique name for each test.

Signed-off-by: Moti Asayag <masayag@redhat.com>
  • Loading branch information
masayag committed May 2, 2023
1 parent 1699ff2 commit a626a65
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions workflow-examples/run_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ run_simple_flow() {

echo_blue "******** Create Project ********"
echo " "
# generate random project name
PROJECT_NAME="project-$RANDOM"
PROJECT_ID=$(curl -X 'POST' -s \
"${TARGET_URL}/api/v1/projects" \
-H 'accept: */*' \
Expand All @@ -147,7 +149,7 @@ run_simple_flow() {
-H "X-XSRF-TOKEN: ${TOKEN}" \
-b $COOKIEFP \
-d '{
"name": "project-1",
"name": "'"${PROJECT_NAME}"'",
"description": "an example project"
}' | jq -r '.id')
[ ${#PROJECT_ID} -eq "36" ] || @fail "Project ID ${PROJECT_ID} is not present"
Expand Down Expand Up @@ -201,6 +203,7 @@ run_complex_flow() {
echo " "
echo_blue "******** Create Project ********"
echo " "
PROJECT_NAME="project-$RANDOM"
PROJECT_ID=$(curl -X 'POST' -s \
"${TARGET_URL}/api/v1/projects" \
-H 'accept: */*' \
Expand All @@ -209,7 +212,7 @@ run_complex_flow() {
-b $COOKIEFP \
-H 'Content-Type: application/json' \
-d '{
"name": "project-1",
"name": "'"${PROJECT_NAME}"'",
"description": "an example project"
}' | jq -r '.id')
[ ${#PROJECT_ID} -eq "36" ] || @fail "Project ID ${PROJECT_ID} is not present"
Expand Down Expand Up @@ -301,16 +304,16 @@ run_escalation_flow() {
echo " "

wait_project_start

PROJECT_ID=$(curl -X 'POST' -s \
PROJECT_NAME="project-$RANDOM"
PROJECT_ID=$(curl -X 'POST' -s \
"${TARGET_URL}/api/v1/projects" \
-H 'accept: */*' \
-H 'Authorization: Basic dGVzdDp0ZXN0' \
-H "X-XSRF-TOKEN: ${TOKEN}" \
-b $COOKIEFP \
-H 'Content-Type: application/json' \
-d '{
"name": "project-1",
"name": "'"${PROJECT_NAME}"'",
"description": "an example project"
}' | jq -r '.id')
echo "Project id is " $(echo_green $PROJECT_ID)
Expand Down

0 comments on commit a626a65

Please sign in to comment.