How do you know they were going to shoot?
You don't obviously. In most cases however, and by law in some states, you can assume someone breaking down your door at Oh-Dark-Thirty, doesn't just want to use the phone. Theft during the nighttime, or burglary any time is justification for use of deadly force in Texas, let alone assault with a deadly weapon. Drug investigators are often, but not always of course, pretty scruffy looking individuals, not your typical cop, and in the middle of the night the "police" across their jackets, which usually don't look much like regular police uniforms, may not register.
Maybe one partial solution would be to have warrants, especially the "no knock" type, served only by uniformed officers. Might even save a few officers lives.