NASA deemed the astronaut formation very expensive and wanted to have the best candidates so these could remain astronauts at least up to the age of 40... so the NASA selection tests were based on the US Air Force's "premium man" selection procedure for U-2 pilots.
With the difference that NASA gave "carte blanche" to Doctors, Psychiatrists and behavioral scientists to perform new " Aeromedicine " physical qualification tests... 30 hours per astronaut candidate!
These tests included some gruesome medical experiments during which the candidates were prodded and punctured, delivered stool samples, sat in a dark panic box, or were being held in heat chambers up to 130° F (54° Celsius) during 2 hours!
This all took place at the Lovelace Clinic (Albuquerque - New Mexico) and Wright-Patterson Air Development Center (Dayton - Ohio).
The scene in " The Right Stuff " shows the blowing test, aka "Flack test" ( Valsalva), for which the all time record was set at 94 seconds, but Major John Glenn blew 151 seconds and Lt Scott Carpenter even 177 seconds... nowadays non-smokers easily perform over 180 seconds !
All the details of these tests became known as American author/journalist Tom Wolfe had interviewed Charles "Pete" Conrad who did the tests twice, being selected in NASA group 2 (September 1962).
The Right Stuff - How the Future began. movie based on Tom Wolfe's 1979 bestselling book on test pilots and early astronauts.
(Photo: Warner Bros / The Ladd Company)
.
.
Extra trivia: besides the well-known German engineers in the early US space program (e.g. Wernher von Braun), there were also doctors & engineers (e.g. Dr Ulrich Cameron Luft - physician specialised acclimatisation high altitude) (e.g. Engineer Joachim Jack Kuettner, V1 "test pilot").