The Messenger of Allah ﷺ said, "Count for me how many people pronounce Islam."We said, "Messenger of Allah, do you fear for us when we number between six and seven hundred?"He replied, "You do not know. Perhaps you will be tested."And indeed we were tested, until a man among us could not pray except in secret.
حدثنا أبو معاوية حدثنا الأعمش عن شقيق
قال رسول الله ﷺ أحصوا لي كم يلفظ الإسلام قلنا يا رسول الله أتخاف علينا ونحن ما بين الست مائة إلى السبع مائة قال فقال إنكم لا تدرون لعلكم أن تبتلوا قال فابتلينا حتى جعل الرجل منا لا يصلي إلا سرا
Its isnad is sahih. It is found in Bukhari 6/177, no. 3060, in the book of jihad, chapter on the imam writing to the people, in Muslim 1/131, no. 149, in the book of faith, chapter on faith for the fearful, and in Ibn Majah 2/1337, no. 4029, in the book of tribulations, chapter on patience during trials.