Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions cfn-resources/flex-cluster/test/cfn-test-create-inputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ set -o nounset
set -o pipefail

function usage {
echo "usage:$0 <project_id>"
echo "Adjust flex cluster test input files"
echo "usage:$0 <project_name>"
echo "Generates test input files for flex cluster"
exit 0
}

Expand All @@ -27,7 +27,15 @@ if [ ${MONGODB_ATLAS_PROFILE+x} ]; then
profile=${MONGODB_ATLAS_PROFILE}
fi

projectId="${1}"
projectName="${1}"
projectId=$(atlas projects list --output json | jq --arg NAME "${projectName}" -r '.results[] | select(.name==$NAME) | .id')
if [ -z "$projectId" ]; then
projectId=$(atlas projects create "${projectName}" --output=json | jq -r '.id')
echo -e "Created project \"${projectName}\" with id: ${projectId}\n"
else
echo -e "FOUND project \"${projectName}\" with id: ${projectId}\n"
fi

clusterName="cfn-test-bot-$((1 + RANDOM % 10000))"
echo "clusterName: $clusterName"

Expand Down
4 changes: 4 additions & 0 deletions cfn-resources/flex-cluster/test/cfn-test-delete-inputs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# cfn-test-delete-inputs.sh
#
# Needs to exist to be called in Publish, but no cleanup is needed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ projectId=$(atlas projects create "${projectName}" --output=json | jq -r '.id')
echo "projectId: $projectId"
echo "projectName: $projectName"

./test/cfn-test-create-inputs.sh "$projectId"
./test/cfn-test-create-inputs.sh "$projectName"
Loading