@@ -15,6 +15,7 @@ deploy_minio
1515
1616desc " create PSMDB sharded cluster without auth"
1717cluster=" some-name"
18+ kubectl_bin apply -f " $conf_dir /secrets.yml"
1819kubectl_bin apply -f " $conf_dir /client.yml"
1920
2021apply_s3_storage_secrets
@@ -62,10 +63,7 @@ run_mongos \
6263 " @$cluster -mongos.$namespace " " " " " " " " $custom_port "
6364
6465desc ' 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
7068desc ' restore from backup (no auth)'
7169run_restore " $backup_name_no_auth "
@@ -74,14 +72,9 @@ wait_restore "$backup_name_no_auth" "$cluster"
7472sleep 20
7573
7674desc ' 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
8277desc ' enable authentication'
83- kubectl_bin apply -f " $conf_dir /secrets.yml"
84-
8578pause_cluster " $cluster "
8679wait_for_cluster_state " ${cluster} " " paused"
8780
@@ -96,10 +89,7 @@ run_mongos \
9689 " userAdmin:userAdmin123456@$cluster -mongos.$namespace " " " " " " " " $custom_port "
9790
9891desc ' 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
10494desc ' insert new data with auth'
10595run_mongos \
@@ -125,10 +115,7 @@ run_mongos \
125115 " myApp:myPass@$cluster -mongos.$namespace " " " " " " " " $custom_port "
126116
127117desc ' 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
133120desc ' restore from backup (with auth)'
134121run_restore " $backup_name_with_auth "
@@ -137,10 +124,7 @@ wait_restore "$backup_name_with_auth" "$cluster"
137124sleep 10
138125
139126desc ' 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
145129desc ' cleanup backups'
146130kubectl_bin delete psmdb-backup --all
0 commit comments