ANSWER: Jesus Christ had supreme faith, being born with the Holy Spirit without measure, so we should not think He had doubts regarding His identity as God in the flesh. Notice Peter's confidence in identifying the true nature of Jesus when he said to him the following.
Then Simon Peter answered and said, "You are the Christ, the Son of the living God." And Jesus answered and said to him, "Blessed are you, Simon Bar-Jona, for flesh and blood did not reveal it to you, but My Father, Who is in heaven. (Matthew 16:13 - 17, HBFV throughout)
Although various ideas existed as to who Jesus was, he himself knew His true identity. The Father in heaven blessed Peter by revealing to him his Son's spiritual identity and allowed him to proclaim it to the other disciples.
The Bible does not record any self-doubt Jesus may have had about His identity. His hesitation in the Garden of Gethsemane (Matthew 26:37 - 39), which concerned His temptation to want the cup of His sacrifice to pass by, was not about His identity or a kind of self-doubt.
Since Christ was also a prophet, He had direct knowledge from God the Father that humans never had. Therefore, given that knowledge, He did not need faith to know about him the way we do, since we never have had the kind of direct contact with the Father as He did before his incarnation (That is, before being put into the Virgin Mary's womb).
Jesus certainly had no doubt regarding his identity as the Messiah when he testified before the Sanhedrin (Mark 14:60 - 62, see Daniel 7:13 for the Old Testament text he was alluding to). It was his statement regarding who is was that gave the Jewish religious leaders the excuse they needed to condemn him to death. It is problematic to think Jesus would be uncertain about confessing His identity as the Messiah when such a statement would cost him the pain and suffering of the cross.
There is one interesting section of the Bible that, upon closer inspection, offers quite strong (though possibly not perfect) evidence regarding how early in life Jesus understood he was the Son of God. This passage records that, at the age of twelve, the Lord knew who was his Father, was aware of His will regarding His plan for humans, and accepted that his divine origin required him to do certain things such as teaching others the truth (e.g. preaching the gospel).
When Jesus was twelve he accompanied Mary and Joseph to Jerusalem in order to keep the Passover. Unbeknownst to his parents, he did not leave the city (like the rest of his family) after keeping the Feast period (Luke 2:41 - 45). He stayed behind in the temple carefully listening to what the priests said and asking questions. He also offered profound answers that amazed and astonished all those who heard him (verse 27)!
After his human parents found him, after several days of frantic searching, he was asked why he hung around the temple without first informing them. Jesus stated, "Why is it that you were looking for Me? Don't you realize that I must be about My Father's business?" (Luke 2:49, HBFV).
His answer reveals that he knew God (and not Joseph) was his true Father and that he was his Son. Acknowledging such also meant he claimed to be deity and a member of the Godhead (see John 5:18). Stating he needed to be involved in his "Father's business" (Luke 2:49), especially when Joseph was still alive, shows that Jesus knew his purpose was to preach the gospel.
At a minimum, Jesus knew at the tender age of twelve that he was God in the flesh. As the only begotten Son, he also understood that his will and goals needed to be in sync with those of his heavenly Father. While the Bible is silent regarding whether he knew, at such an early age, that he had to eventually die for mankind's sins, Jesus certainly comprehended his divine origin and true identity.