"And God tested Abraham." Rabbi Yose the Galilean says: He made him great like the banner of a ship. Rabbi Akiva says: He tested him truly, so that the heretics should not say, "He confused him and he did not know what to do," as it is said, "And He said to him, Abraham, and he said, Here I am" (Genesis 22:1). Rabbi Joshua ben Korchah said: In two places Moses likened himself to Abraham. The Holy One, blessed be He, said to him, "Do not glorify yourself before a king, and in the place of the great do not stand" (Proverbs 25:6). Abraham said, "Here I am": here I am for priesthood, here I am for kingship. He merited priesthood, he merited kingship. He merited priesthood, as it is said, "The LORD has sworn and will not relent: You are a priest forever" (Psalms 110:4). He merited kingship, as it is said, "You are a prince of God among us" (Genesis 23:6). Moses said, "Here I am": here I am for priesthood, here I am for kingship. He said to him, "Do not draw near here (halom)" (Exodus 3:5). "Drawing near" refers only to priesthood, as it is said, "And the stranger who draws near shall be put to death" (Numbers 1:51); and "here (halom)" refers only to kingship, as it is said, "For You have brought me thus far (halom)" (2 Samuel 7:18).
Rabbi Akiva Says the Trial Was Real and Abraham Won Priesthood and Kingship
Yalkut Shimoni on Torah 96:1
וְהָאֱלֹהִים נִסָּה אֶת אַבְרָהָם, רַבִּי יוֹסִי הַגְּלִילִי אוֹמֵר גִדְלוֹ כְּנֵס הַזֶּה שֶׁל סְפִינָה. רַבִּי עֲקִיבָא אוֹמֵר, נִסָּה אוֹתוֹ וַדַּאי שֶׁלֹּא יִהְיוּ הָאַפִּיקוֹרְסִים אוֹמְרִים, עִרְבְּבוֹ וְלֹא הָיָה יוֹדֵעַ מַה לַעֲשׂוֹת, שֶׁנֶּאֱמַר, וַיֹּאמֶר אֵלָיו אַבְרָהָם וַיֹּאמֶר הִנֵּנִי. אָמַר רַבִּי יְהוֹשֻׁעַ בֶּן קָרְחָה, בִּשְׁנֵי מְקוֹמוֹת דִּמָּה מֹשֶׁה עַצְמוֹ לְאַבְרָהָם. אָמַר לוֹ הַקָּדוֹשׁ בָּרוּךְ הוּא, (משלי כה, ו) "אַל תִּתְהַדַּר לִפְנֵי מֶלֶךְ וּבִמְקוֹם גְּדֹלִים אַל תַּעֲמֹד". אַבְרָהָם אָמַר הִנֵּנִי, הִנֵּנִי לִכְהוּנָה, הִנֵּנִי לְמַלְכוּת. זָכָה לִכְהוּנָה, זָכָה לְמַלְכוּת. זָכָה לִכְהוּנָה, שֶׁנֶּאֱמַר, (תהלים קי, ד) "נִשְׁבַּע ה' וְלֹא יִנָּחֵם אַתָּה כֹהֵן לְעוֹלָם". זָכָה לְמַלְכוּת, שֶׁנֶּאֱמַר, (בראשית כג, ו) "נְשִׂיא אֱלֹהִים אַתָּה בְּתוֹכֵנוּ". מֹשֶׁה אָמַר "הִנֵּנִי" הִנֵּנִי לִכְהוּנָה, הִנֵּנִי לְמַלְכוּת. אָמַר לוֹ (שם ה) "אַל תִּקְרַב הֲלֹם" אֵין קְרַב אֶלָּא כְּהוּנָה, שֶׁנֶּאֱמַר, "וְהַזָּר הַקָּרֵב יוּמָת". וְאֵין הֲלוֹם אֶלָּא מַלְכוּת, שֶׁנֶּאֱמַר, (שמואל ב ז, יח) "כִּי הֲבִיאֹתַנִי עַד הֲלֹם".