Not all of WW2 - they jointly invaded Poland:
http://en.wikipedia.org/wiki/Molotov%E2%80%93Ribbentrop_Pact
It was after the Soviet invasion of Poland that the infamous Katyn Massacre occurred:
http://en.wikipedia.org/wiki/Katyn_massacre
Which included 7000 prisoners executed by a single man: