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

[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #4490: Bamboo e2e for job,job build,plan,plan build

warren830 commented on code in PR #4490:
URL: https://github.com/apache/incubator-devlake/pull/4490#discussion_r1114347379


##########
backend/plugins/bamboo/e2e/job_build_test.go:
##########
@@ -0,0 +1,105 @@
+/*
+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 (
+	"testing"
+
+	"github.com/apache/incubator-devlake/core/models/common"
+	"github.com/apache/incubator-devlake/core/models/domainlayer/devops"
+	"github.com/apache/incubator-devlake/helpers/e2ehelper"
+	"github.com/apache/incubator-devlake/plugins/bamboo/impl"
+	"github.com/apache/incubator-devlake/plugins/bamboo/models"
+	"github.com/apache/incubator-devlake/plugins/bamboo/tasks"
+)
+
+func TestBambooJobBuildDataFlow(t *testing.T) {
+
+	var bamboo impl.Bamboo
+	dataflowTester := e2ehelper.NewDataFlowTester(t, "bamboo", bamboo)
+
+	taskData := &tasks.BambooTaskData{
+		Options: &tasks.BambooOptions{
+			ConnectionId: 3,
+			ProjectKey:   "TEST1",
+			BambooTransformationRule: &models.BambooTransformationRule{
+				DeploymentPattern: "(?i)compile",
+				ProductionPattern: "(?i)compile",
+			},
+		},
+	}
+	// import raw data table
+	// SELECT * FROM _raw_bamboo_api_job_build INTO OUTFILE "/tmp/_raw_bamboo_api_job_build.csv" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
+	dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_bamboo_api_job_build.csv", "_raw_bamboo_api_job_build")
+
+	// verify extraction
+	dataflowTester.FlushTabler(&models.BambooJobBuild{})
+	dataflowTester.Subtask(tasks.ExtractJobBuildMeta, taskData)
+	dataflowTester.VerifyTable(
+		models.BambooJobBuild{},
+		"./snapshot_tables/_tool_bamboo_job_builds.csv",
+		e2ehelper.ColumnWithRawData(

Review Comment:
   Please use dataflowTester.VerifyTableWithOptions



##########
backend/plugins/bamboo/e2e/job_test.go:
##########
@@ -0,0 +1,76 @@
+/*
+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 (
+	"testing"
+
+	"github.com/apache/incubator-devlake/helpers/e2ehelper"
+	"github.com/apache/incubator-devlake/plugins/bamboo/impl"
+	"github.com/apache/incubator-devlake/plugins/bamboo/models"
+	"github.com/apache/incubator-devlake/plugins/bamboo/tasks"
+)
+
+func TestBambooJobDataFlow(t *testing.T) {
+
+	var bamboo impl.Bamboo
+	dataflowTester := e2ehelper.NewDataFlowTester(t, "bamboo", bamboo)
+
+	taskData := &tasks.BambooTaskData{
+		Options: &tasks.BambooOptions{
+			ConnectionId: 3,
+			ProjectKey:   "TEST1",
+			BambooTransformationRule: &models.BambooTransformationRule{
+				DeploymentPattern: "(?i)compile",
+				ProductionPattern: "(?i)compile",
+			},
+		},
+	}
+	// import raw data table
+	// SELECT * FROM _raw_bamboo_api_job INTO OUTFILE "/tmp/_raw_bamboo_api_job.csv" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
+	dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_bamboo_api_job.csv", "_raw_bamboo_api_job")
+
+	// verify extraction
+	dataflowTester.FlushTabler(&models.BambooJob{})
+	dataflowTester.Subtask(tasks.ExtractJobMeta, taskData)
+	dataflowTester.VerifyTable(
+		models.BambooJob{},
+		"./snapshot_tables/_tool_bamboo_jobs.csv",
+		e2ehelper.ColumnWithRawData(

Review Comment:
   same as above



-- 
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