And there was a famine in the land. This famine came on account of Isaac to test if he would cry out and complain or not. And he withstood the test and did not cry out to complain, but rather he went to Avimelech, the king of the Philistines, just as his father, Abraham, did.
The Famine Sent to Test Whether Isaac Would Complain
Midrash Aggadah, Genesis 26:1