In Oedipus Tyrannus, Sophocles has the chorus sing "Count no mortal happy until he has reached the very end of his life free from misfortune and pain."
A Modern would read that in the most literal and judgmental way possible: obviously Sophocles is just a pessimist, so we can disregard what he says. Thus the banausic reflex--do not pursue the truth, only what seems useful to machine minds, and disregard the rest. The Greeks considered this play the masterpiece of one of their masters, this statement a pinnacle of insight into the human condition. As with Heraclitus, this statement rolls up layers of wisdom into a deceptively simple package.
It only seems pessimistic to those for whom it is most intended, those who foolishly believe happiness is the highest human achievement, to be captured by deserved good fortune. The Greeks believed happiness is fool's gold, the wrong thing to want, because happiness is transient and outside of our control. To attempt to will the cosmos to satisfy our personal desires is a fool's errand. To wish for happiness is to wish for luck, and the wheel of fortune turns. If we achieve our ends by luck, then we will eventually lose them the same way. Oedipus starts out on top of the world and ends up on the bottom, afflicted by the most terrible crimes and situations, because he has relied upon luck and overweening ego. His life is an object lesson for the rest of us, indeed, it is the object lesson we are most in need of but least likely to heed because it challenges the core of our beliefs.
To the ancient Greeks, the only thing worth having is not happiness but eudaimonea, which is its opposite. Eudaimonea is the condition having cultivated a good daimon, a well ordered inner cosmos that allows one to rise to the occasion at any time, not just when fortune smiles upon us, because the wheel of fortune turns, so sooner or later we will need the resources to be able to rise to the occasion when fortune frowns upon us. With eudaimonea we will often not be happy because that is not within anyone's control, but we may make the best of the hands life deals us. Unlike the pointless and self-atrophying quest for happiness, with the quest for eudaimonea the longer we are at it the better we will get, and thus our efforts are not wasted but grow into something more and more worth having. This is the true gold without which even the richest and most powerful man on Earth remains but a slave to fortune and his own demonic appetites and delusions, but with which even a pauper in a death camp is free. Eudaimonea is the only property you can truly own, that cannot be taken away from you, and therefore the most important thing to seek in life, and the only way to acquire eudaimonea is to work for it your entire life long.
That one line from Sophocles is pregnant with all of that and more, and this one play from ancient Greece is in many ways the signature of their entire civilization. Too bad we don't teach it that way.