Yes, after I thought about it, I realized that your system was already "seeing" the change in nsswitch.conf because of the different result when you removed dns for test 2.
I had a similar problem where I had to get a value based on yesterday. I came up with the following script. I'm sure it could be shortened a bit but it works for me. Here you go...