Yes no doubt that Allah(swt) has knowledge over everything.
But we can say that Allah’s knowledge is two types.
First of all He knows all about his creations regarding their future happenings also about their nature that how will they deal the affairs fall in their life. Now one thing should be noted here that this knowledge of Allah about His creations doesn’t create any change in the Nature of His creations.
Quran says in Chapter At Rom verses 30
So direct your face toward the religion, inclining to truth. [Adhere to] the fitrah of Allah upon which He has created [all] people. No change should there be in the creation of Allah . That is the correct religion, but most of the people do not know.
Therefore we can say that Allah knowledge doesn’t alter the nature (Fitrat) of His creations.
Secondly His He has two types of determination
One is that when He wishes anything it would be. Secondly He has given a choice to His creations that the way they will live and do Deeds in this world their destiny will be settled.
Now about Allah Test
Yes He knows everything but then why He tests us because He wants to prove that He has given us an intellect. Also any test proves our ability this is very Human Nature that after test he improves his affairs and thirdly after test we can’t blame that we could do this or that but we had no choice so on the Day of Judgement Allah will tell us I have given you many ways to strengthen your will power but we gave up and had no patience.
Quran say after every grief there is an easy.
About circumcision it is also refers that we can change our life according to the need of nature. There are many examples can be set in this regard like why do we use pace maker when our heart doesn’t work properly. Why do we do Kidney transplant. Why do we cut our Nails why do we cut our Hairs? Why do we take bath after sweating.etc….
Hope I have given you clear answer
Allah knows better.