The tests Peter went through show that his pride and attitude would be shaken and he would grow to become a true son of the Kingdom.
Hebrews 12:26-27 King James Version (KJV)
26 Whose voice then shook the earth: but now he hath promised, saying, Yet once more I shake not the earth only, but also heaven.
27 And this word, Yet once more, signifieth the removing of those things that are shaken, as of things that are made, that those things which cannot be shaken may remain.
At the last supper, Jesus was telling his disciples about his betrayal and crucifixion, but they only argued about who would be greatest in the kingdom. Jesus knew Judas would betray him.
Luke 22:21-24 King James Version (KJV)
21 But, behold, the hand of him that betrayeth me is with me on the table.
22 And truly the Son of man goeth, as it was determined: but woe unto that man by whom he is betrayed!
23 And they began to enquire among themselves, which of them it was that should do this thing.
24 And there was also a strife among them, which of them should be accounted the greatest.
Peter was a dominant personality and could have boasted of his past accomplishments and argued that he would be the greatest in the kingdom of God. Jesus told them they were acting like mere men and not like sons of the kingdom. Here Jesus indicated that Sons of God were mature Christians.