From 88b9ddde73c4a1543a8535598ff0831566a37445 Mon Sep 17 00:00:00 2001 From: scortier Date: Tue, 5 Apr 2022 20:03:30 +0530 Subject: [PATCH] test: update plugins test --- .github/workflows/plugin_test.yml | 2 +- plugins/extractors/cassandra/cassandra_test.go | 2 ++ plugins/extractors/clickhouse/clickhouse_test.go | 2 ++ plugins/extractors/csv/csv_test.go | 3 +++ plugins/extractors/elastic/elastic_test.go | 2 ++ plugins/extractors/grafana/grafana_test.go | 2 ++ plugins/extractors/kafka/kafka_test.go | 3 +++ plugins/extractors/metabase/testdata/expected.json | 1 + plugins/extractors/mongodb/mongodb_test.go | 3 +++ plugins/extractors/mssql/mssql_test.go | 2 ++ plugins/extractors/mysql/mysql_test.go | 2 ++ plugins/extractors/optimus/testdata/expected.json | 2 ++ plugins/extractors/oracle/oracle_test.go | 2 ++ plugins/extractors/tableau/testdata/dashboards_proto.json | 7 +++++-- 14 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/plugin_test.yml b/.github/workflows/plugin_test.yml index 204528270..2981e2789 100644 --- a/.github/workflows/plugin_test.yml +++ b/.github/workflows/plugin_test.yml @@ -4,7 +4,7 @@ on: push: branches: - main - - fix-plugin-tests + pull_request: workflow_dispatch: jobs: diff --git a/plugins/extractors/cassandra/cassandra_test.go b/plugins/extractors/cassandra/cassandra_test.go index 87b592a76..e57536e34 100644 --- a/plugins/extractors/cassandra/cassandra_test.go +++ b/plugins/extractors/cassandra/cassandra_test.go @@ -187,6 +187,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: keyspace + ".applicant", Name: "applicant", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ @@ -209,6 +210,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: keyspace + ".jobs", Name: "jobs", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ diff --git a/plugins/extractors/clickhouse/clickhouse_test.go b/plugins/extractors/clickhouse/clickhouse_test.go index d41aee099..84bd139b1 100644 --- a/plugins/extractors/clickhouse/clickhouse_test.go +++ b/plugins/extractors/clickhouse/clickhouse_test.go @@ -123,6 +123,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: "mockdata_meteor_metadata_test.applicant", Name: "applicant", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ @@ -148,6 +149,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: "mockdata_meteor_metadata_test.jobs", Name: "jobs", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ diff --git a/plugins/extractors/csv/csv_test.go b/plugins/extractors/csv/csv_test.go index f346e6dce..8707825ef 100644 --- a/plugins/extractors/csv/csv_test.go +++ b/plugins/extractors/csv/csv_test.go @@ -50,6 +50,7 @@ func TestExtract(t *testing.T) { Urn: "test.csv", Name: "test.csv", Service: "csv", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ @@ -84,6 +85,7 @@ func TestExtract(t *testing.T) { Urn: "test-2.csv", Name: "test-2.csv", Service: "csv", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ @@ -98,6 +100,7 @@ func TestExtract(t *testing.T) { Urn: "test.csv", Name: "test.csv", Service: "csv", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ diff --git a/plugins/extractors/elastic/elastic_test.go b/plugins/extractors/elastic/elastic_test.go index 962f24ef6..d2c6dd790 100644 --- a/plugins/extractors/elastic/elastic_test.go +++ b/plugins/extractors/elastic/elastic_test.go @@ -195,6 +195,7 @@ func getExpectedVal() []models.Record { Resource: &commonv1beta1.Resource{ Urn: "elasticsearch.index1", Name: "index1", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ @@ -216,6 +217,7 @@ func getExpectedVal() []models.Record { Resource: &commonv1beta1.Resource{ Urn: "elasticsearch.index2", Name: "index2", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ diff --git a/plugins/extractors/grafana/grafana_test.go b/plugins/extractors/grafana/grafana_test.go index eb6fbc1d9..5ba154194 100644 --- a/plugins/extractors/grafana/grafana_test.go +++ b/plugins/extractors/grafana/grafana_test.go @@ -65,6 +65,7 @@ func TestExtract(t *testing.T) { Service: "grafana", Url: fmt.Sprintf("%s/d/HzK8qNW7z/new-dashboard-copy", testServer.URL), Description: "", + Type: "dashboard", }, Charts: []*assetsv1beta1.Chart{ { @@ -88,6 +89,7 @@ func TestExtract(t *testing.T) { Service: "grafana", Url: fmt.Sprintf("%s/d/5WsKOvW7z/test-dashboard-updated", testServer.URL), Description: "this is description for testing", + Type: "dashboard", }, Charts: []*assetsv1beta1.Chart{ { diff --git a/plugins/extractors/kafka/kafka_test.go b/plugins/extractors/kafka/kafka_test.go index b8bfd3fb7..008d23ca3 100644 --- a/plugins/extractors/kafka/kafka_test.go +++ b/plugins/extractors/kafka/kafka_test.go @@ -129,6 +129,7 @@ func TestExtract(t *testing.T) { Urn: "kafka::my-kafka-cluster/meteor-test-topic-1", Name: "meteor-test-topic-1", Service: "kafka", + Type: "topic", }, Profile: &assetsv1beta1.TopicProfile{ NumberOfPartitions: 1, @@ -139,6 +140,7 @@ func TestExtract(t *testing.T) { Urn: "kafka::my-kafka-cluster/meteor-test-topic-2", Name: "meteor-test-topic-2", Service: "kafka", + Type: "topic", }, Profile: &assetsv1beta1.TopicProfile{ NumberOfPartitions: 1, @@ -149,6 +151,7 @@ func TestExtract(t *testing.T) { Urn: "kafka::my-kafka-cluster/meteor-test-topic-3", Name: "meteor-test-topic-3", Service: "kafka", + Type: "topic", }, Profile: &assetsv1beta1.TopicProfile{ NumberOfPartitions: 1, diff --git a/plugins/extractors/metabase/testdata/expected.json b/plugins/extractors/metabase/testdata/expected.json index 0594ea261..a39d6fcfc 100644 --- a/plugins/extractors/metabase/testdata/expected.json +++ b/plugins/extractors/metabase/testdata/expected.json @@ -3,6 +3,7 @@ "urn": "metabase::https://my-metabase.com/dashboard/1", "name": "Main", "service": "metabase", + "type": "dashboard", "description": "HELPFUL DESCRIPTION" }, "properties": { diff --git a/plugins/extractors/mongodb/mongodb_test.go b/plugins/extractors/mongodb/mongodb_test.go index 169a691f0..f06883470 100644 --- a/plugins/extractors/mongodb/mongodb_test.go +++ b/plugins/extractors/mongodb/mongodb_test.go @@ -165,6 +165,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: testDB + ".connections", Name: "connections", + Type: "table", }, Profile: &assetsv1beta1.TableProfile{ TotalRows: 3, @@ -174,6 +175,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: testDB + ".posts", Name: "posts", + Type: "table", }, Profile: &assetsv1beta1.TableProfile{ TotalRows: 2, @@ -183,6 +185,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: testDB + ".stats", Name: "stats", + Type: "table", }, Profile: &assetsv1beta1.TableProfile{ TotalRows: 1, diff --git a/plugins/extractors/mssql/mssql_test.go b/plugins/extractors/mssql/mssql_test.go index e025cc9dc..c9762536f 100644 --- a/plugins/extractors/mssql/mssql_test.go +++ b/plugins/extractors/mssql/mssql_test.go @@ -148,6 +148,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: "mockdata_meteor_metadata_test.applicant", Name: "applicant", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ @@ -176,6 +177,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: "mockdata_meteor_metadata_test.jobs", Name: "jobs", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ diff --git a/plugins/extractors/mysql/mysql_test.go b/plugins/extractors/mysql/mysql_test.go index d0efaf5a1..6ad8e8c92 100644 --- a/plugins/extractors/mysql/mysql_test.go +++ b/plugins/extractors/mysql/mysql_test.go @@ -154,6 +154,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: "mockdata_meteor_metadata_test.applicant", Name: "applicant", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ @@ -185,6 +186,7 @@ func getExpected() []models.Record { Resource: &commonv1beta1.Resource{ Urn: "mockdata_meteor_metadata_test.jobs", Name: "jobs", + Type: "table", }, Schema: &facetsv1beta1.Columns{ Columns: []*facetsv1beta1.Column{ diff --git a/plugins/extractors/optimus/testdata/expected.json b/plugins/extractors/optimus/testdata/expected.json index f425ede2e..98c5e9287 100644 --- a/plugins/extractors/optimus/testdata/expected.json +++ b/plugins/extractors/optimus/testdata/expected.json @@ -1,6 +1,7 @@ [{ "resource": { "urn": "optimus::optimus:80/project-A.namespace-A.job-A", + "type": "job", "name": "job-A", "service": "optimus", "description": "sample description for job-A" @@ -52,6 +53,7 @@ "urn": "optimus::optimus:80/project-A.namespace-A.job-B", "name": "job-B", "service": "optimus", + "type": "job", "description": "sample description for job-B" }, "ownership": { diff --git a/plugins/extractors/oracle/oracle_test.go b/plugins/extractors/oracle/oracle_test.go index 4b09f6c14..c8c82a33e 100644 --- a/plugins/extractors/oracle/oracle_test.go +++ b/plugins/extractors/oracle/oracle_test.go @@ -160,6 +160,7 @@ func getExpected() []models.Record { Urn: "XE.EMPLOYEE", Name: "EMPLOYEE", Service: "Oracle", + Type: "table", }, Profile: &assetsv1beta1.TableProfile{ TotalRows: 3, @@ -190,6 +191,7 @@ func getExpected() []models.Record { Urn: "XE.DEPARTMENT", Name: "DEPARTMENT", Service: "Oracle", + Type: "table", }, Profile: &assetsv1beta1.TableProfile{ TotalRows: 4, diff --git a/plugins/extractors/tableau/testdata/dashboards_proto.json b/plugins/extractors/tableau/testdata/dashboards_proto.json index b092109f6..9d30926b0 100644 --- a/plugins/extractors/tableau/testdata/dashboards_proto.json +++ b/plugins/extractors/tableau/testdata/dashboards_proto.json @@ -3,7 +3,8 @@ "resource": { "urn": "tableau::https://server.tableau.com/workbook/d74564cf-931c-2df2-fd8f-8b974fbc0b14", "name": "Regional", - "service": "tableau" + "service": "tableau", + "type": "dashboard" }, "charts": [ { @@ -275,6 +276,7 @@ "urn": "tableau::https://server.tableau.com/workbook/e1f0aab7-e3ff-8727-8461-4d4294e220f0", "name": "Superstore", "service": "tableau", + "type": "dashboard", "description": "A sample superstore" }, "charts": [ @@ -751,7 +753,8 @@ "resource": { "urn": "tableau::https://server.tableau.com/workbook/d7db01c0-b311-6f47-31bf-ad1c42e67629", "name": "InMail Engagement", - "service": "tableau" + "service": "tableau", + "type": "dashboard" }, "charts": [ {