diff --git a/engine/cdn/cdn_sync_test.go b/engine/cdn/cdn_sync_test.go index 34b22762f9..ce2bd9dcbe 100644 --- a/engine/cdn/cdn_sync_test.go +++ b/engine/cdn/cdn_sync_test.go @@ -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()) diff --git a/engine/cdn/storage/storageunit_test.go b/engine/cdn/storage/storageunit_test.go index 17fd2a0f46..c940564970 100644 --- a/engine/cdn/storage/storageunit_test.go +++ b/engine/cdn/storage/storageunit_test.go @@ -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 @@ -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() {