Skip to content

Commit 9d98473

Browse files
committed
add fixes for e2e test
1 parent 78cc12a commit 9d98473

File tree

8 files changed

+29
-22
lines changed

8 files changed

+29
-22
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
switched to db myApp
2+
{ "_id" : , "x" : 100500 }
3+
{ "_id" : , "x" : 200500 }
4+
{ "_id" : , "x" : 200501 }
5+
bye
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
switched to db myApp
2+
{ "_id" : , "x" : 100500 }
3+
{ "_id" : , "x" : 100501 }
4+
bye
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
switched to db myApp
2+
{ "_id" : , "x" : 100500 }
3+
{ "_id" : , "x" : 200500 }
4+
bye
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
switched to db myApp
2+
{ "_id" : , "x" : 100500 }
3+
bye
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
switched to db myApp
2+
{ "_id" : , "x" : 100500 }
3+
bye

e2e-tests/disabled-auth/conf/cluster-no-auth.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ spec:
66
image:
77
imagePullPolicy: Always
88
updateStrategy: SmartUpdate
9+
secrets:
10+
users: some-users
911
tls:
1012
mode: disabled
1113
unsafeFlags:

e2e-tests/disabled-auth/conf/cluster-with-auth.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ spec:
66
image:
77
imagePullPolicy: Always
88
updateStrategy: SmartUpdate
9+
secrets:
10+
users: some-users
911
tls:
1012
mode: preferTLS
1113
backup:

e2e-tests/disabled-auth/run

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ deploy_minio
1515

1616
desc "create PSMDB sharded cluster without auth"
1717
cluster="some-name"
18+
kubectl_bin apply -f "$conf_dir/secrets.yml"
1819
kubectl_bin apply -f "$conf_dir/client.yml"
1920

2021
apply_s3_storage_secrets
@@ -62,10 +63,7 @@ run_mongos \
6263
"@$cluster-mongos.$namespace" "" "" "" "$custom_port"
6364

6465
desc 'verify new data exists'
65-
count_no_auth_after=$(run_mongos \
66-
'use myApp\n db.test.find()' \
67-
"@$cluster-mongos.$namespace" "" "" "" "$custom_port")
68-
echo "Find after insert: $count_no_auth_after"
66+
compare_mongos_cmd "find" "@$cluster-mongos.$namespace" "-after-insert" "" "myApp" "test" "$custom_port"
6967

7068
desc 'restore from backup (no auth)'
7169
run_restore "$backup_name_no_auth"
@@ -74,14 +72,9 @@ wait_restore "$backup_name_no_auth" "$cluster"
7472
sleep 20
7573

7674
desc 'verify data was restored to original state'
77-
count_no_auth_restored=$(run_mongos \
78-
'use myApp\n db.test.find()' \
79-
"@$cluster-mongos.$namespace" "" "" "" "$custom_port")
80-
echo "Find after restore: $count_no_auth_restored"
75+
compare_mongos_cmd "find" "@$cluster-mongos.$namespace" "-after-restore" "" "myApp" "test" "$custom_port"
8176

8277
desc 'enable authentication'
83-
kubectl_bin apply -f "$conf_dir/secrets.yml"
84-
8578
pause_cluster "$cluster"
8679
wait_for_cluster_state "${cluster}" "paused"
8780

@@ -96,10 +89,7 @@ run_mongos \
9689
"userAdmin:userAdmin123456@$cluster-mongos.$namespace" "" "" "" "$custom_port"
9790

9891
desc 'verify existing data is still accessible with auth'
99-
count_with_auth=$(run_mongos \
100-
'use myApp\n db.test.find()' \
101-
"myApp:myPass@$cluster-mongos.$namespace" "" "" "" "$custom_port")
102-
echo "Find with auth enabled: $count_with_auth"
92+
compare_mongos_cmd "find" "myApp:myPass@$cluster-mongos.$namespace" "-with-auth" "" "myApp" "test" "$custom_port"
10393

10494
desc 'insert new data with auth'
10595
run_mongos \
@@ -125,10 +115,7 @@ run_mongos \
125115
"myApp:myPass@$cluster-mongos.$namespace" "" "" "" "$custom_port"
126116

127117
desc 'verify new data exists'
128-
count_with_auth_after=$(run_mongos \
129-
'use myApp\n db.test.find()' \
130-
"myApp:myPass@$cluster-mongos.$namespace" "" "" "" "$custom_port")
131-
echo "Find after insert with auth: $count_with_auth_after"
118+
compare_mongos_cmd "find" "myApp:myPass@$cluster-mongos.$namespace" "-after-insert-auth" "" "myApp" "test" "$custom_port"
132119

133120
desc 'restore from backup (with auth)'
134121
run_restore "$backup_name_with_auth"
@@ -137,10 +124,7 @@ wait_restore "$backup_name_with_auth" "$cluster"
137124
sleep 10
138125

139126
desc 'verify data was restored to state before last insert'
140-
count_with_auth_restored=$(run_mongos \
141-
'use myApp\n db.test.find()' \
142-
"myApp:myPass@$cluster-mongos.$namespace" "" "" "" "$custom_port")
143-
echo "Find after restore with auth: $count_with_auth_restored"
127+
compare_mongos_cmd "find" "myApp:myPass@$cluster-mongos.$namespace" "-after-restore-auth" "" "myApp" "test" "$custom_port"
144128

145129
desc 'cleanup backups'
146130
kubectl_bin delete psmdb-backup --all

0 commit comments

Comments
 (0)