heres the oeds etymology entry for cock-sure:

 Quote:
[According to the regular force of similar formations, e.g. stone-deaf, clay-cold, dog-sick, dirt-cheap, coal-black, etc., the sense ought to be ‘as sure as a cock’. The conjecture that there is some allusion to cockish, cocky, with reference to ‘pert self-confidence’, being founded upon the latest sense, which is only a modern development, is not historically tenable. The word was originally perfectly dignified, and habitually used in the most solemn connexions. And, in early use, the sureness in question was objective, i.e. ‘as secure, safe, certain, trustworthy, reliable, etc., as can be’: this makes it possible that the original reference may have been to the security or certainty of the action of a cock or tap in preventing the escape of liquor, or perhaps of a cock with a removable turning-key (if these go far enough back) in leaving the contents of a tun secure from interference.
The notion ‘as sure as a cock is to crow in the morning’, has also been suggested. It might suit sense 2, but not sense 1.]