This ALL depends on the style you are asking about. In our style (I teach Shotokan), we have only 5 TRUE Dan grades because Gichin Funakoshi was only 5th Dan when he died. HOWEVER, he was awarded a 10th Dan posthumously, and therefore others can test up to that point. Nakayama-sensei was 9th Dan when he died, for example. However, some other martial arts do not consider these "true" Dan grades, because the founder of the style was only 5th Dan when he died. Therefore, in Shotokan, you are considered a "Master" at 5th degree (Godan) and all Dan grades above that are officially honorific titles.
Other styles are far different though and have "true" Dan grades even above 10th.
Now, I believe what you are asking is more like, "when do you stop working for your grade." That depends GREATLY on the school. In our system (Seishinkai Shotokan Karate) you are still tested rigorously until 4th Degree, when your examinations are more about how your instructor sees you running your classes, how well your school is running, how well you referee, how well you teach an upper grade test...things like that. Instructors above 3rd degree are assumed to know what they are doing as far as technique goes, so it depends more on how well they are passing down that technique.
Hope this helps,
Sensei Brian Cox
EDIT- Learning all the techniques of the style is another open ended question. Commonly, when you earn your 1st Degree black belt, you are supposed to have mastered all the basic techniques. Leanring ALL the techniques of a style will take significantly longer. In a philosophical viewpoint, you will never learn ALL the available techniques. It is a lifetime journey. Seriously, if your reverse punch is perfect and then you try it with a slightly different angle, does this change the technique? A backfist delivered horizontally (like to the opponent's temple) is different from one thrown with an upward arc (like hitting on the chin) or one delivered downward (like to the bridge of the nose)...but it's still a backfist. You NEVER stop learning...never.