Skip to content

Find, verify, and analyze leaked credentials

enforce timeout on circleci test (#3528)

Zachary Riceb44dc244947b
diff --git a/pkg/sources/circleci/circleci_test.go b/pkg/sources/circleci/circleci_test.go
index cf7e21f55..5efad5fc8 100644
--- a/pkg/sources/circleci/circleci_test.go
+++ b/pkg/sources/circleci/circleci_test.go
@@ -16,7 +16,7 @@ import (
)
func TestSource_Scan(t *testing.T) {
- ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
secret, err := common.GetTestSecret(ctx)
@@ -82,11 +82,16 @@ func TestSource_Scan(t *testing.T) {
return
}
}()
- gotChunk := <-chunksCh
- gotChunk.SourceMetadata.Data.(*source_metadatapb.MetaData_Circleci).Circleci.BuildNumber = 0 // override this because we need to periodically re-run the builds
- gotChunk.SourceMetadata.Data.(*source_metadatapb.MetaData_Circleci).Circleci.Link = "" // override this because we need to periodically re-run the builds
- if diff := pretty.Compare(gotChunk.SourceMetadata, tt.wantSourceMetadata); diff != "" {
- t.Errorf("Source.Chunks() %s diff: (-got +want)\n%s", tt.name, diff)
+
+ select {
+ case gotChunk := <-chunksCh:
+ gotChunk.SourceMetadata.Data.(*source_metadatapb.MetaData_Circleci).Circleci.BuildNumber = 0 // override this because we need to periodically re-run the builds
+ gotChunk.SourceMetadata.Data.(*source_metadatapb.MetaData_Circleci).Circleci.Link = "" // override this because we need to periodically re-run the builds
+ if diff := pretty.Compare(gotChunk.SourceMetadata, tt.wantSourceMetadata); diff != "" {
+ t.Errorf("Source.Chunks() %s diff: (-got +want)\n%s", tt.name, diff)
+ }
+ case <-ctx.Done():
+ t.Errorf("Source.Chunks() %s timed out", tt.name)
}
})
}