The S&P 500 Index is on the cusp of a record high but with earnings season just weeks away, the foundation of the rally is about to get a major test.