Skip to content

Commit

Permalink
fix(cdn): random position (#5842)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored Jun 11, 2021
1 parent df9af61 commit a28bde4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions engine/cdn/cdn_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,17 @@ func TestSyncLog(t *testing.T) {
cdnUnits.Start(ctx, sdk.NewGoRoutines(ctx))
s.Units = cdnUnits

cdsStorage, ok := s.Units.Storages[0].(*cds.CDS)
require.True(t, ok)
var cdsStorage *cds.CDS
for _, sto := range s.Units.Storages {
cdsStorage = sto.(*cds.CDS)
if cdsStorage != nil {
break
}
}

if cdsStorage == nil {
t.Fail()
}

// Mock Http route
gock.InterceptClient(cdsStorage.GetClient().HTTPClient())
Expand Down
4 changes: 2 additions & 2 deletions engine/cdn/storage/storageunit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func TestDeduplicationCrossType(t *testing.T) {
Type: sdk.CDNTypeItemRunResult,
Status: sdk.CDNStatusItemCompleted,
}
iuArtifact, err := cdnUnits.NewItemUnit(ctx, cdnUnits.Buffers[1], itemArtifact)
iuArtifact, err := cdnUnits.NewItemUnit(ctx, cdnUnits.FileBuffer(), itemArtifact)
require.NoError(t, err)

// Create Destination Writer
Expand All @@ -188,7 +188,7 @@ func TestDeduplicationCrossType(t *testing.T) {
itemArtifact.MD5 = md5S
itemArtifact.Size = 0
itemArtifact.Status = sdk.CDNStatusItemCompleted
iuArtifact, err = cdnUnits.NewItemUnit(ctx, cdnUnits.Buffers[1], itemArtifact)
iuArtifact, err = cdnUnits.NewItemUnit(ctx, cdnUnits.FileBuffer(), itemArtifact)
require.NoError(t, err)
require.NoError(t, item.Insert(ctx, m, db, itemArtifact))
defer func() {
Expand Down

0 comments on commit a28bde4

Please sign in to comment.