Stalin did the Molotov-Ribbentrop pact to (successfully!) buy time and breathing room for the inevitable Nazi assault after his numerous entreaties to Western/Allied powers were rebuffed.
France buckled in months and Wehrmacht then attacked Red army which did not have setup defense positions because they themselves were preparing to attack...