From St. Isaac the Syrian:
On the Reasons Why God Permits Temptations to Come Upon Those Who Love Him
By the love which the saints show for God on account of the things they suffer for His name’s sake (when they endure straitness and do not forsake that which God loves), their hearts acquire the boldness to gaze toward Him without a veil and to beseech Him with confidence. Great is the power of bold prayer. For this reason God allows His saints to be tried by every sorrow, then to experience anew and to prove His aid, and to understand how great a providence He has for them, in their perils He is found to be their Redeemer. And again, He does this so that they may gain wisdom from temptations, lest they be unlearned men and be deprived of the two parts of learning, and so that they may acquire the knowledge of all things, lest perhaps they be mocked by the demons. For if He exercised them only in that which is good, they would lack training in the other part and would be blind in battles
If we say that God guides His saints without training and without the knowledge of it, we must conclude that He wishes them to become like oxen and asses and creatures which possess no freedom. If a man is not first tried by the experience of evils, he has no taste for the good. Hence when in evils he meets with that which is good, he will be unable in knowledge and freedom to make use of it as being his very own. How sweet is knowledge and freedom that is gained from actual experience and from diligent training, and what power it gives to the man who through much experience has found it within himself, the same is known by those who have been assured of and have seen the help it affords them. They learn the weakness of their nature and the help of Divine power when God first withholds His power from them while they are amid temptations. Thus He makes them conscious of their nature’s impotence, the arduousness of temptations, and the cunning of the enemy. Thus He gives them to understand against whom they must wrestle, what kind of nature they are clothed with, how they are protected by Divine power, how far they have advanced on the way, to what height God’s power has raised them up, and how powerless they are before the face of every passion when the Divine power is withdrawn from them. Through all these things they acquire humility, cleave closely to God, look for His help with expectation, and persevere in prayer. Whence could they have received all these boons, if they had not had experience of the many evils which God allowed them to undergo? As the Apostle says, “And lest I should be exalted above measure by the abundance of the revelations, there was given to me a thorn in the flesh, a messenger of Satan.” But by the experience of many interventions of divine assistance in temptations, a man also acquires firm faith. Henceforth he has no fear, and he gains stout-heartedness in temptations from the training he has received.
Trial is profitable for every man….There is no man who will not feel oppressed at the time of training. And there is no man who will not find the time bitter wherein he is given the virulent potion of trials to drink. Without temptations a man cannot acquire a strong constitution, yet to endure with patience is not within our power. For how should the clay vessel endure the vehemence of the waters, if the divine fire had not hardened it? If we submit ourselves to God, while beseeching Him humbly with perseverance in unceasing desire, we shall certainly receive all, in Christ Jesus our Lord. Amen.
Taken from Homily 61 of The Ascetical Homilies of Saint Isaac the Syrian.