MrGlasspoole:
I'm out off ideas
Me too. But of course I don't have any ideas because I don't have your full code, or a code sample that will compile and show the problem.
I see nothing that can change test. What is the callback all about? How do you get to callback? What is MQTT? is test global?