Pro-immigration demonstrators cheer and hold signs as international passengers arrive at Dulles International Airport on Sunday. (Mike Theiler/Reuters)

President Trump’s executive order on immigration was the first major test of the 2017 Virginia gubernatorial campaign, and it told us a few things about the candidates and the political landscape they face as they wrestle for the keys to the executive mansion.

Progressive champion Tom Perriello joined the crowd protesting at Dulles airport, alongside Gov. Terry McAuliffe and Attorney General Mark Herring.

Meanwhile, Perriello’s competitor for the Democratic gubernatorial nomination, Lt. Gov. Ralph Northam, was in Petersburg. Northam, like McAuliffe and Herring, issued press releases on the issue. But the all-important participation medal goes to Perriello.

Bottom line: Perriello was in the right place at the right time and used social media to scorch Trump’s actions. He gets the advantage.

Republicans generally sided with Trump.  That’s not surprising for some contenders. Corey Stewart was a Virginia co-chairman of Trump’s presidential campaign. Nor is it entirely surprising for Denver Riggleman, the distiller and political tyro, would back the order.

What was a bit surprising was Sen. Frank Wagner’s embrace of the Trump order, and the hit Wagner leveled on frontrunner Ed Gillespie. As Jenna Portnoy and Greg Schneider reported in The Post, Wagner said Gillespie was “hiding in the weeds.”

Perhaps. It’s obvious Gillespie is not entirely comfortable with the new President, and, as a former statewide candidate, Gillespie knows that a successful campaign must acknowledge that the election’s deciding votes are in the Democratic bastion of Northern Virginia.

Embracing Trump is not a winning formula there. So he took his time responding to press inquiries.

Gillespie’s response was a classic straddle – yes, there are problems with the nation’s immigration programs (Department of Homeland Security Inspector General John Roth’s testimony on the matter makes for harrowing reading). In normal political circumstances, a perfectly acceptable response.

These are not normal political circumstances.

Bottom line: Gillespie comes out of the weekend with a Gentleman’s “C” – average work, but a lot of room for improvement.

But all of the candidates, in both parties, are now on notice: At any moment, the president may say or do something that demands an instant reaction.

Candidates who are out of position — as Northam was for the Dulles protests or as Gillespie was by being slow and indecisive in his response — lose ground in a contest that is already shaping up to make the rough and rowdy 2013 governor’s race between Ken Cuccinelli and Terry McAuliffe look like a Cub Scout meeting.

This does not mean Gillespie needs to strip off his K Street conservative duds and adopt populist hot pants. That would be unbecoming and transparently false.

Nor does it mean Northam must shed his establishment Democratic bona fides to become a progressive hero. That just won’t work.

What can they do? Be flexible, be nimble. Understand that the new guy across the Potomac will be throwing all manner of things at the wall to see what sticks, and some of that is going to splatter on to their campaign scripts.

And also know the 2017 race, which should be about transportation, education, taxes and public safety, is going to be about Trump.  Full Stop.

Virginia’s gubernatorial race has always been a sort of referendum on the newly elected president. And for decades – until 2013 – the referendum results favored the opposition party.

Tom Perriello has already staked out this ground, portraying himself as the center of a progressive resistance to Trump in Virginia. In a Facebook post, Perriello said Gillespie would “stand idly by while Trump stokes hatred and fear. I promise: I’ll make Virginia a firewall against it.”

That’s both a rallying cry and an admission that 2017 is all about Donald.

Candidates, plan accordingly.

Norman Leahy is a political reporter for the American Media Institute and producer of the Score radio show.