That’s true. The Soviets were looking for a foothold in Western Europe and the Nazis were testing materials and tactics for their anticipated invasion of neighboring countries.
They both had ideological reasons to support the sides they did as well; why Hitler was hardly a Christian, he was communism’s strongest opponent. Stalin was simply supporting a kindred spirit, with intentions to reduce them to a satellite (his theft of Spain’s gold reserves made that clear).