@@ -1355,6 +1355,8 @@ func (p passthroughDecoder) FromChunk(chunk *sources.Chunk) *decoders.DecodableC
13551355
13561356func (p passthroughDecoder ) Type () detectorspb.DecoderType { return detectorspb .DecoderType (- 1 ) }
13571357
1358+ // TestEngine_DetectChunk_UsesVerifyFlag validates that detectChunk correctly forwards detectableChunk.verify to
1359+ // detectors.
13581360func TestEngine_DetectChunk_UsesVerifyFlag (t * testing.T ) {
13591361 ctx := context .Background ()
13601362
@@ -1389,6 +1391,9 @@ func TestEngine_DetectChunk_UsesVerifyFlag(t *testing.T) {
13891391 }
13901392}
13911393
1394+ // TestEngine_ScannerWorker_DetectableChunkHasCorrectVerifyFlag validates that scannerWorker generates detectableChunk
1395+ // structs that have the correct verify flag set. It also validates that the original chunks' SourceVerify flags are
1396+ // unchanged.
13921397func TestEngine_ScannerWorker_DetectableChunkHasCorrectVerifyFlag (t * testing.T ) {
13931398 ctx := context .Background ()
13941399
@@ -1418,13 +1423,18 @@ func TestEngine_ScannerWorker_DetectableChunkHasCorrectVerifyFlag(t *testing.T)
14181423 // correctly set.
14191424 select {
14201425 case chunk := <- e .detectableChunksChan :
1421- assert .True (t , chunk .chunk .SourceVerify )
14221426 assert .True (t , chunk .verify )
1427+ assert .True (t , chunk .chunk .SourceVerify )
14231428 case <- time .After (1 * time .Second ):
14241429 t .Errorf ("expected a detectableChunk but did not get one" )
14251430 }
14261431}
14271432
1433+ // TestEngine_VerificationOverlapWorker_DetectableChunkHasCorrectVerifyFlag validates that the results directly
1434+ // generated by verificationOverlapWorker all came from detector invocations with the verify flag cleared (because these
1435+ // results were generated from verification overlaps). It also validates that detectableChunk structs generated by
1436+ // verificationOverlapWorker have their verify flags correctly set, and that these structs' original chunks'
1437+ // SourceVerify flags are unchanged.
14281438func TestEngine_VerificationOverlapWorker_DetectableChunkHasCorrectVerifyFlag (t * testing.T ) {
14291439 ctx := context .Background ()
14301440
@@ -1486,8 +1496,8 @@ func TestEngine_VerificationOverlapWorker_DetectableChunkHasCorrectVerifyFlag(t
14861496 // CMR: There should be not be any of these chunks. However, due to what I believe is an unrelated bug, there
14871497 // are. This test ensures that even in that erroneous case, their Verify flag is correct.
14881498 for detectableChunk := range processedDetectableChunks {
1489- assert .True (t , detectableChunk .chunk .SourceVerify )
14901499 assert .True (t , detectableChunk .verify )
1500+ assert .True (t , detectableChunk .chunk .SourceVerify )
14911501 }
14921502 })
14931503 t .Run ("no overlap" , func (t * testing.T ) {
@@ -1538,8 +1548,8 @@ func TestEngine_VerificationOverlapWorker_DetectableChunkHasCorrectVerifyFlag(t
15381548
15391549 // Assert: Confirm that SourceVerify flags are unchanged, and verify flags are correctly set.
15401550 for detectableChunk := range processedDetectableChunks {
1541- assert .True (t , detectableChunk .chunk .SourceVerify )
15421551 assert .True (t , detectableChunk .verify )
1552+ assert .True (t , detectableChunk .chunk .SourceVerify )
15431553 }
15441554 })
15451555}
0 commit comments