Why do we get punished after being good?
Reb נחמן מברסלב Used to say the following parable. There was once two friends one was Jewish, and one was a gentile. They did business together and ended up Erev Pesach together in a Jewish city. So the jew told the gentile to go to the shul tonight and someone will invite you over for a very lavish meal as the Jews are accustomed to invite a guest to there Pesach meal. So the gentile goes to the shul, and he gets summoned to some rich man's house. He is all excited about what he will be served and sits down to the table with the rest of the guest. He is waiting for the food to come, but he sees the host just praying and telling stories, so he starts losing his patience. After a few hours, he sees they are finally bringing in some food. He looks up, and he gets this hard cracker so he thinks maybe this is just an appetizer and then he finally sees them bringing in something white, so his hopes are lifted. As he was so hungry, he took a huge spoonful of this white thing not realizing that it was a sharp horseradish. As he made this huge bite, he felt like he was going to die. He got up in anger and left the house and runs to find his Jewish friend. He tells him the whole story and his Jewish friend tells him you are so stupid if you would only wait for the next course you would have gotten the sumptuous meal.
The simple lesson we all learn from the story is how we many times lose patience just before salvation comes. I think there is another lesson to be learned here. Many times we invest a lot of effort and time in our spiritual journey to become closer to Hashem to only get this huge slap in our face right after that. It's then effortless to get angry and lose faith and get up and leave, but we have to realize this is really the final test Hashem wants to see are you trying to come close to me for selfish reasons to get the lavish meal or you really wish to Hashem's closeness no matter what happens.if you show you are here because you really want to advance and come back to Hashem no matter what he does you will eventually get to the lavish meal.