likyh commented on code in PR #2314: URL: https://github.com/apache/incubator-devlake/pull/2314#discussion_r903996052
########## plugins/ae/e2e/project_test.go: ########## @@ -0,0 +1,62 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package e2e + +import ( + "fmt" + "testing" + + "github.com/apache/incubator-devlake/helpers/e2ehelper" + "github.com/apache/incubator-devlake/plugins/ae/impl" + "github.com/apache/incubator-devlake/plugins/ae/models" + "github.com/apache/incubator-devlake/plugins/ae/tasks" +) + +func TestAEProjectDataFlow(t *testing.T) { + var ae impl.AE + dataflowTester := e2ehelper.NewDataFlowTester(t, "ae", ae) + + taskData := &tasks.AeTaskData{ + Options: &tasks.AeOptions{ + ConnectionId: 1, + ProjectId: 13, + }, + } + + // import raw data table + dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_ae_project.csv", "_raw_ae_project") + + // verify extraction + dataflowTester.FlushTabler(&models.AEProject{}) + dataflowTester.Subtask(tasks.ExtractProjectMeta, taskData) + dataflowTester.VerifyTable( + models.AEProject{}, + fmt.Sprintf("./snapshot_tables/%s.csv", models.AEProject{}.TableName()), + []string{"id"}, Review Comment: add connection_id here and confirm it's not 0. ########## plugins/ae/models/migrationscripts/updateSchemas20220622.go: ########## @@ -0,0 +1,61 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package migrationscripts + +import ( + "context" + "time" + + "github.com/apache/incubator-devlake/models/migrationscripts/archived" + aearchived "github.com/apache/incubator-devlake/plugins/ae/models/migrationscripts/archived" + "gorm.io/gorm" +) + +type UpdateSchemas20220622 struct{} + +type AEProject20220622 struct { + ConnectionId uint64 `gorm:"primaryKey"` + Id int `gorm:"primaryKey;type:varchar(255)"` + GitUrl string `gorm:"type:varchar(255);comment:url of the repo in github"` + Priority int + AECreateTime *time.Time + AEUpdateTime *time.Time + archived.NoPKModel +} + +func (AEProject20220622) TableName() string { + return "_tool_ae_projects" +} + +func (*UpdateSchemas20220622) Up(ctx context.Context, db *gorm.DB) error { + if !db.Migrator().HasColumn(&aearchived.AEProject{}, "connection_id") { + err := db.Migrator().AddColumn(&AEProject20220622{}, "connection_id") Review Comment: Just drop it and recreate it. Or fill connection_id for exist rows. ########## plugins/ae/e2e/snapshot_tables/_tool_ae_projects.csv: ########## @@ -0,0 +1 @@ +id,git_url,priority,ae_create_time,ae_update_time,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark Review Comment: it's should not be empty. And you need to check it after it's generated auto. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
