Complete the test suite for dynamic host selection.

It was testing dynamic host selection by command, but not by environment
variable.