Skip to content

Commit ccee0f5

Browse files
committed
test: Update test inputs
1 parent cc94294 commit ccee0f5

File tree

5 files changed

+52
-45
lines changed

5 files changed

+52
-45
lines changed

cfn-resources/database-user/test/cfn-test-create-inputs.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ rm -rf inputs
1818
mkdir inputs
1919

2020
projectName="${1}"
21+
MONGODB_ATLAS_PROFILE=${MONGODB_ATLAS_PROFILE:-"default"}
2122
projectId=$(atlas projects list --output json | jq --arg NAME "${projectName}" -r '.results[] | select(.name==$NAME) | .id')
2223
if [ -z "$projectId" ]; then
2324
projectId=$(atlas projects create "${projectName}" --output=json | jq -r '.id')
@@ -32,8 +33,8 @@ echo "Check if a project is created $projectId"
3233
cd "$(dirname "$0")" || exit
3334
for inputFile in inputs_*; do
3435
outputFile=${inputFile//$WORDTOREMOVE/}
35-
jq --arg ProjectId "$projectId" \
36-
'.ProjectId?|=$ProjectId' \
36+
jq --arg ProjectId "$projectId" --arg Profile "${MONGODB_ATLAS_PROFILE}" \
37+
'.ProjectId?|=$ProjectId | .Profile?|=$Profile' \
3738
"$inputFile" >"../inputs/$outputFile"
3839
done
3940
cd ..
Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
{
2-
"Username" : "DataUser1",
3-
"Password" : "MongoDB12345%",
4-
"ProjectId" : "ProjectId",
5-
"Profile" : "default",
6-
"DatabaseName": "admin",
7-
"Roles": [
8-
{ "RoleName": "readWrite",
9-
"DatabaseName": "testdb",
10-
"CollectionName": "col1"
11-
}
12-
],
13-
"Scopes": [
14-
{ "Type": "CLUSTER",
15-
"Name": "testdb"
16-
}
17-
]
18-
19-
20-
}
2+
"Username": "DataUser1",
3+
"Password": "MongoDB12345%",
4+
"ProjectId": "${MONGODB_ATLAS_PROJECT_ID}",
5+
"Profile": "${MONGODB_ATLAS_PROFILE}",
6+
"DatabaseName": "admin",
7+
"Description": "Desc 1",
8+
"Roles": [
9+
{
10+
"RoleName": "readWrite",
11+
"DatabaseName": "testdb",
12+
"CollectionName": "col1"
13+
}
14+
],
15+
"Scopes": [
16+
{
17+
"Type": "CLUSTER",
18+
"Name": "testdb"
19+
}
20+
]
21+
}
Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
{
2-
"Username" : "DataUser1",
3-
"Password" : "MongoDB12345%",
4-
"ProjectId" : "ProjectId",
5-
"Profile" : "default",
2+
"Username": "DataUser1",
3+
"Password": "MongoDB12345%",
4+
"ProjectId": "${MONGODB_ATLAS_PROJECT_ID}",
5+
"Description": "Desc 2",
6+
"Profile": "${MONGODB_ATLAS_PROFILE}",
67
"DatabaseName": "admin",
7-
"Roles": [
8-
{ "RoleName": "readWrite",
9-
"DatabaseName": "testdb",
10-
"CollectionName": "col1"
11-
},
12-
{ "RoleName": "read",
13-
"DatabaseName": "proddb",
14-
"CollectionName": "col1"
15-
}
16-
],
17-
"Scopes": [
18-
{ "Type": "CLUSTER",
19-
"Name": "testdb"
20-
}
21-
]
22-
}
8+
"Roles": [
9+
{
10+
"RoleName": "readWrite",
11+
"DatabaseName": "testdb",
12+
"CollectionName": "col1"
13+
},
14+
{
15+
"RoleName": "read",
16+
"DatabaseName": "proddb",
17+
"CollectionName": "col1"
18+
}
19+
],
20+
"Scopes": [
21+
{
22+
"Type": "CLUSTER",
23+
"Name": "testdb"
24+
}
25+
]
26+
}

cfn-resources/database-user/test/inputs_2_create.template.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"Username": "arn:aws:iam::111111967292:role/cfn-admin",
33
"AWSIAMType": "ROLE",
4-
"ProjectId": "ProjectId",
5-
"Profile": "default",
4+
"ProjectId": "${MONGODB_ATLAS_PROJECT_ID}",
5+
"Profile": "${MONGODB_ATLAS_PROFILE}",
66
"DatabaseName": "$external",
7+
"Description": "Desc 1",
78
"Roles": [
89
{
910
"RoleName": "readWrite",

cfn-resources/database-user/test/inputs_2_update.template.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"Username": "arn:aws:iam::111111967292:role/cfn-admin",
33
"AWSIAMType": "ROLE",
4-
"ProjectId": "ProjectId",
5-
"Profile": "default",
4+
"ProjectId": "${MONGODB_ATLAS_PROJECT_ID}",
5+
"Profile": "${MONGODB_ATLAS_PROFILE}",
66
"DatabaseName": "$external",
77
"Roles": [
88
{

0 commit comments

Comments
 (0)