Did All Souls Prostrate Allah?

It's reported that, in the realm of souls some of the souls prostrated Allah while some didn't. Is it true? Were souls subjected to a test  before coming into this world and some became rebellious while the others were obedient?

In the realm of souls, all souls prostrated Allah (swt). The rumours reporting the opposite are not authentic. This event took place in the realm of souls is not a test; it is a promise taken from humanbeings by Allah. Man has been sent to this world in order to be tested. Those who fail their tests are the ones who break their promises.
What aileth you that ye believe not in Allah, when the messenger calleth you to believe in your Lord, and He hath already made a covenant with you, if ye are believers?” (Surah al-Hadid, 8)
And (remember) when thy Lord brought forth from the Children of Adam, from their reins, their seed, and made them testify of themselves, (saying): Am I not your Lord? They said: Yea, verily. We testify. (That was) lest ye should say at the Day of Resurrection: Lo! of this we were unaware; “ (Surah al-A’raf, 172)
As mentioned in the aforesaid ayahs, Allah (swt) has asked the souls: “Am I not your Lord?” they replied: “Yes.” Allah (swt) said: “I make the seven heavens and the seven earths and your father Adam witnesses (to your reply) so that you shall not say “We were unaware of this.” on the Day of Judgment. Never attribute a partner to Me. Verily, I’ll send messengers who will remind you My covenant. I’ll reveal My books to you. They said: “We testify that You are our Lord and Ilah. There is no other lord and illah for us, but You.” and they acknowledged their obedience to Allah. (Ibn-i Kathir)