enforce timeout on circleci test (#3528)

* enforce timeout

* bump to 10s, 3s seemed too aggro
This commit is contained in:
Zachary Rice
2024-10-29 15:59:02 -05:00
committed by GitHub
parent 3e12bcb15c
commit b44dc24494
+11 -6
View File
@@ -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)
}
})
}