I don’t think it was a test. You don’t show your hand until you have to. If this was a test for Iran, Iran would already have been bombed by now.
Probably a demonstration for Iran for them to get in line. As the old saying goes ‘ If you f*** with the bull you get the horns.