You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "mappjzc (via GitHub)" <gi...@apache.org> on 2023/02/21 07:51:20 UTC

[GitHub] [incubator-devlake] mappjzc commented on a diff in pull request #4461: Bamboo scopes and remote api

mappjzc commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112668266


##########
backend/plugins/bamboo/api/blueprint_V200_test.go:
##########
@@ -94,13 +95,17 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
 
 	var expectRepoId = "bamboo:BambooProject:1:TEST"
 
-	var testSubTaskMeta = []plugin.SubTaskMeta{}
+	var testSubTaskMeta = []plugin.SubTaskMeta{
+		tasks.ConvertProjectsMeta,
+	}
 
 	var expectPlans = plugin.PipelinePlan{
 		{
 			{
-				Plugin:   "bamboo",
-				Subtasks: []string{},
+				Plugin: "bamboo",
+				Subtasks: []string{
+					tasks.ConvertProjectsMeta.Name,
+				},

Review Comment:
   we need subtask to unit test the subtask create part.



##########
backend/plugins/bamboo/models/job.go:
##########
@@ -37,17 +37,16 @@ type BambooJob struct {
 	common.NoPKModel
 }
 
-func (BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
-	b := &BambooJob{
-		JobKey:      apiRes.SearchEntity.Key,
-		Id:          apiRes.Id,
-		Name:        apiRes.SearchEntity.JobName,
-		PlanName:    apiRes.SearchEntity.PlanName,
-		ProjectName: apiRes.SearchEntity.ProjectName,
-		Description: apiRes.SearchEntity.Description,
-		BranchName:  apiRes.SearchEntity.BranchName,
-		Type:        apiRes.SearchEntity.Type,
-	}
+func (b *BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {

Review Comment:
   a := &BambooJob{}
   b := a.Convert()
   
   that will make a and b to be diffrent.
   So it need to be fixed.



##########
backend/plugins/bamboo/models/plan.go:
##########
@@ -43,26 +43,25 @@ type BambooPlan struct {
 	common.NoPKModel
 }
 
-func (BambooPlan) Convert(apiProject *ApiBambooPlan) *BambooPlan {
-	b := &BambooPlan{
-		PlanKey:                   apiProject.Key,
-		Name:                      apiProject.Name,
-		Expand:                    apiProject.Expand,
-		ProjectKey:                apiProject.ProjectKey,
-		ProjectName:               apiProject.ProjectName,
-		Description:               apiProject.Description,
-		ShortName:                 apiProject.ShortName,
-		BuildName:                 apiProject.BuildName,
-		ShortKey:                  apiProject.ShortKey,
-		Type:                      apiProject.Type,
-		Enabled:                   apiProject.Enabled,
-		Href:                      apiProject.Href,
-		Rel:                       apiProject.Rel,
-		IsFavourite:               apiProject.IsFavourite,
-		IsActive:                  apiProject.IsActive,
-		IsBuilding:                apiProject.IsBuilding,
-		AverageBuildTimeInSeconds: apiProject.AverageBuildTimeInSeconds,
-	}

Review Comment:
   a := &BambooPlan{}
   b := a.Convert()
   
   that will make a and b to be diffrent.
   So it need to be fixed



##########
backend/plugins/bamboo/tasks/job_extractor.go:
##########
@@ -44,7 +45,7 @@ func ExtractJob(taskCtx plugin.SubTaskContext) errors.Error {
 			if err != nil {
 				return nil, err
 			}
-			body := models.BambooJob{}.Convert(res)
+			body := (&models.BambooJob{}).Convert(res)

Review Comment:
   for Convert changed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org