diff --git a/backend/plugins/azuredevops_go/api/blueprint_v200_test.go b/backend/plugins/azuredevops_go/api/blueprint_v200_test.go index ce45e380881..640a296e727 100644 --- a/backend/plugins/azuredevops_go/api/blueprint_v200_test.go +++ b/backend/plugins/azuredevops_go/api/blueprint_v200_test.go @@ -241,6 +241,64 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) { assert.Equal(t, expectPlans, actualPlans) } +func TestMakeDataSourcePipelinePlanV200ConvertsTimelineRecordsWithCicd(t *testing.T) { + data := []struct { + Name string + Type string + Private bool + Entities []string + }{ + // only CICD is planned for repositories hosted outside Azure Repos + {Name: "Private GitHub Repository", Type: models.RepositoryTypeGithub, Private: true, Entities: plugin.DOMAIN_TYPES}, + {Name: "Azure DevOps Repository with CICD only", Type: models.RepositoryTypeADO, Private: false, Entities: []string{plugin.DOMAIN_TYPE_CICD}}, + } + + for _, d := range data { + t.Run(d.Name, func(t *testing.T) { + actualPlans, err := makePipelinePlanV200( + []plugin.SubTaskMeta{ + tasks.CollectBuildsMeta, + tasks.ExtractApiBuildsMeta, + tasks.ConvertBuildsMeta, + tasks.CollectJobsMeta, + tasks.ExtractApiBuildRecordsMeta, + tasks.ConvertApiTimelineRecordsMeta, + }, + &models.AzuredevopsConnection{ + BaseConnection: api.BaseConnection{ + Model: common.Model{ + ID: connectionID, + }, + }, + }, + []*srvhelper.ScopeDetail[models.AzuredevopsRepo, models.AzuredevopsScopeConfig]{ + { + Scope: models.AzuredevopsRepo{ + Id: azuredevopsRepoId, + Type: d.Type, + IsPrivate: d.Private, + }, + ScopeConfig: &models.AzuredevopsScopeConfig{ + ScopeConfig: common.ScopeConfig{ + Entities: d.Entities, + }, + }, + }, + }, + ) + assert.Nil(t, err) + assert.Equal(t, []string{ + tasks.CollectBuildsMeta.Name, + tasks.ExtractApiBuildsMeta.Name, + tasks.ConvertBuildsMeta.Name, + tasks.CollectJobsMeta.Name, + tasks.ExtractApiBuildRecordsMeta.Name, + tasks.ConvertApiTimelineRecordsMeta.Name, + }, actualPlans[0][0].Subtasks) + }) + } +} + func TestMakeRemoteRepoScopes(t *testing.T) { mockAzuredevopsPlugin(t) diff --git a/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_converter.go b/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_converter.go index e5272a014b9..fb595ad6d54 100644 --- a/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_converter.go +++ b/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_converter.go @@ -39,7 +39,7 @@ var ConvertApiTimelineRecordsMeta = plugin.SubTaskMeta{ EntryPoint: ConvertApiTimelineRecords, EnabledByDefault: true, Description: "Convert tool layer table azuredevops_timeline_records into domain layer table cicd_tasks", - DomainTypes: []string{plugin.DOMAIN_TYPE_CODE_REVIEW}, + DomainTypes: []string{plugin.DOMAIN_TYPE_CICD}, DependencyTables: []string{ models.AzuredevopsTimelineRecord{}.TableName(), },