fix for flaky payloadManager test

This commit is contained in:
Samuel Hawksby-Robinson 2022-09-05 14:32:29 +01:00
parent cea3b3db0d
commit 7affd6f488
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package server
import (
"bytes"
"crypto/sha256"
"fmt"
"io/ioutil"
@ -186,7 +187,14 @@ func (pms *PayloadMarshallerSuite) TestPayloadMarshaller_MarshalToProtobuf() {
h := sha256.New()
h.Write(pb)
pms.Require().Exactly([]byte{0x70, 0xf2, 0xe5, 0x37, 0xff, 0x7d, 0x2d, 0x7b, 0x8a, 0x4b, 0x53, 0x1f, 0xfe, 0x3e, 0xea, 0x5e, 0x4d, 0xe1, 0xad, 0x44, 0xe8, 0x22, 0x5c, 0x84, 0x30, 0xd6, 0x75, 0x1a, 0xbd, 0x53, 0x59, 0xce}, h.Sum(nil))
hashA := []byte{0x70, 0xf2, 0xe5, 0x37, 0xff, 0x7d, 0x2d, 0x7b, 0x8a, 0x4b, 0x53, 0x1f, 0xfe, 0x3e, 0xea, 0x5e, 0x4d, 0xe1, 0xad, 0x44, 0xe8, 0x22, 0x5c, 0x84, 0x30, 0xd6, 0x75, 0x1a, 0xbd, 0x53, 0x59, 0xce}
hashB := []byte{0xeb, 0xb7, 0x34, 0x94, 0x1d, 0x8d, 0x88, 0xdf, 0xa2, 0xfa, 0xc2, 0x9e, 0x11, 0xba, 0xa5, 0xc5, 0x95, 0x51, 0x73, 0xb, 0x9a, 0xb1, 0x92, 0xf9, 0xa2, 0x55, 0x5f, 0x50, 0x81, 0xe2, 0xf9, 0x46}
// Because file-walk will pull files in an unpredictable order from a target dir
// there are 2 potential valid hashes, because there are 2 key files in the test dir
if bytes.Compare(hashA, h.Sum(nil)) != 0 {
pms.Require().Exactly(hashB, h.Sum(nil))
}
}
func (pms *PayloadMarshallerSuite) TestPayloadMarshaller_UnmarshalProtobuf() {