Skip to content

Commit

Permalink
enforce timeout on circleci test (#3528)
Browse files Browse the repository at this point in the history
* enforce timeout

* bump to 10s, 3s seemed too aggro
  • Loading branch information
zricethezav authored Oct 29, 2024
1 parent 3e12bcb commit b44dc24
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pkg/sources/circleci/circleci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
})
}
Expand Down

0 comments on commit b44dc24

Please sign in to comment.