Skip to content

Commit 39d3acf

Browse files
author
muhammad.fahlevi
committed
fix: tests
1 parent 7dae296 commit 39d3acf

File tree

8 files changed

+45
-30
lines changed

8 files changed

+45
-30
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,6 @@ test-coverage: # test test-plugins
9292
cp coverage.out coverage-all.out
9393
tail -n +2 coverage-plugins.out >> coverage-all.out
9494
go tool cover -html=coverage-all.out
95+
96+
test-all: test test-plugins test-e2e ##@tests run all tests
97+
@echo " > All tests passed!"

plugins/extractors/bigquery/testdata/expected-assets-mixed.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
}
154154
],
155155
"create_time": "2023-06-13T03:46:12.372974Z",
156+
"ddl_statement": "",
156157
"preview_fields": [
157158
"id",
158159
"name",

plugins/extractors/bigquery/testdata/expected-assets-no-preview.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
}
154154
],
155155
"create_time": "2023-06-13T03:46:12.372974Z",
156+
"ddl_statement": "",
156157
"preview_fields": [],
157158
"preview_rows": null,
158159
"profile": {

plugins/extractors/bigquery/testdata/expected-assets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
}
154154
],
155155
"create_time": "2023-06-13T03:46:12.372974Z",
156+
"ddl_statement": "",
156157
"preview_fields": [
157158
"id",
158159
"name",

plugins/extractors/bigtable/testdata/expected-assets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"columns": [],
1010
"create_time": null,
11+
"ddl_statement": "",
1112
"preview_fields": [],
1213
"preview_rows": null,
1314
"profile": null,

plugins/extractors/redshift/testdata/expected-assets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
}
1818
],
1919
"create_time": null,
20+
"ddl_statement": "",
2021
"preview_fields": [],
2122
"preview_rows": null,
2223
"profile": null,
@@ -54,6 +55,7 @@
5455
}
5556
],
5657
"create_time": null,
58+
"ddl_statement": "",
5759
"preview_fields": [],
5860
"preview_rows": null,
5961
"profile": null,
@@ -91,6 +93,7 @@
9193
}
9294
],
9395
"create_time": null,
96+
"ddl_statement": "",
9497
"preview_fields": [],
9598
"preview_rows": null,
9699
"profile": null,
@@ -128,6 +131,7 @@
128131
}
129132
],
130133
"create_time": null,
134+
"ddl_statement": "",
131135
"preview_fields": [],
132136
"preview_rows": null,
133137
"profile": null,

plugins/sinks/compass/sink_test.go

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ func TestSink(t *testing.T) {
194194
{
195195
description: "should create the right request to compass",
196196
data: &v1beta2.Asset{
197-
Urn: "my-topic-urn",
198-
Name: "my-topic",
199-
Service: "kafka",
200-
Type: "topic",
201-
Description: "topic information",
197+
Urn: "my-table-urn",
198+
Name: "my-table",
199+
Service: "maxcompute",
200+
Type: "table",
201+
Description: "table information",
202202
Url: "http://test.com",
203203
Data: testutils.BuildAny(t, &v1beta2.Table{
204204
Columns: []*v1beta2.Column{
@@ -221,12 +221,12 @@ func TestSink(t *testing.T) {
221221
},
222222
expected: compass.RequestPayload{
223223
Asset: compass.Asset{
224-
URN: "my-topic-urn",
225-
Name: "my-topic",
226-
Service: "kafka",
227-
Type: "topic",
224+
URN: "my-table-urn",
225+
Name: "my-table",
226+
Service: "maxcompute",
227+
Type: "table",
228228
URL: "http://test.com",
229-
Description: "topic information",
229+
Description: "table information",
230230
Data: map[string]interface{}{
231231
"@type": "type.googleapis.com/gotocompany.assets.v1beta2.Table",
232232
"columns": []map[string]interface{}{
@@ -242,6 +242,7 @@ func TestSink(t *testing.T) {
242242
},
243243
},
244244
"create_time": nil,
245+
"ddl_statement": "",
245246
"preview_fields": []interface{}{},
246247
"preview_rows": nil,
247248
"profile": nil,
@@ -258,11 +259,11 @@ func TestSink(t *testing.T) {
258259
{
259260
description: "should build compass labels if labels is defined in config",
260261
data: &v1beta2.Asset{
261-
Urn: "my-topic-urn",
262-
Name: "my-topic",
263-
Service: "kafka",
264-
Type: "topic",
265-
Description: "topic information",
262+
Urn: "my-table-urn",
263+
Name: "my-table",
264+
Service: "maxcompute",
265+
Type: "table",
266+
Description: "table information",
266267
Data: testutils.BuildAny(t, &v1beta2.Table{
267268
Attributes: utils.TryParseMapToProto(map[string]interface{}{
268269
"attrA": "valueAttrA",
@@ -279,11 +280,12 @@ func TestSink(t *testing.T) {
279280
},
280281
expected: compass.RequestPayload{
281282
Asset: compass.Asset{
282-
URN: "my-topic-urn",
283-
Name: "my-topic",
284-
Service: "kafka",
285-
Type: "topic",
286-
Description: "topic information",
283+
URN: "my-table-urn",
284+
Name: "my-table",
285+
Service: "maxcompute",
286+
Type: "table",
287+
URL: "http://test.com",
288+
Description: "table information",
287289
Labels: map[string]string{
288290
"foo": "valueAttrA",
289291
"bar": "valueAttrB",
@@ -296,6 +298,7 @@ func TestSink(t *testing.T) {
296298
},
297299
"columns": []interface{}{},
298300
"create_time": nil,
301+
"ddl_statement": "",
299302
"preview_fields": []interface{}{},
300303
"preview_rows": nil,
301304
"profile": nil,
@@ -307,10 +310,10 @@ func TestSink(t *testing.T) {
307310
{
308311
description: "should merge labels from assets and config",
309312
data: &v1beta2.Asset{
310-
Urn: "my-topic-urn",
311-
Name: "my-topic",
312-
Service: "kafka",
313-
Type: "topic",
313+
Urn: "my-table-urn",
314+
Name: "my-table",
315+
Service: "maxcompute",
316+
Type: "table",
314317
Data: testutils.BuildAny(t, &v1beta2.Table{
315318
Attributes: utils.TryParseMapToProto(map[string]interface{}{
316319
"newFoo": "newBar",
@@ -329,10 +332,10 @@ func TestSink(t *testing.T) {
329332
},
330333
expected: compass.RequestPayload{
331334
Asset: compass.Asset{
332-
URN: "my-topic-urn",
333-
Name: "my-topic",
334-
Service: "kafka",
335-
Type: "topic",
335+
URN: "my-table-urn",
336+
Name: "my-table",
337+
Service: "maxcompute",
338+
Type: "table",
336339
Labels: map[string]string{
337340
"foo1": "bar1",
338341
"foo2": "newBar",
@@ -344,6 +347,7 @@ func TestSink(t *testing.T) {
344347
},
345348
"columns": []interface{}{},
346349
"create_time": nil,
350+
"ddl_statement": "",
347351
"preview_fields": []interface{}{},
348352
"preview_rows": nil,
349353
"profile": nil,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{"urn":"elasticsearch.index1","name":"index1","service":"","type":"table","url":"","description":"","data":{"@type":"type.googleapis.com/gotocompany.assets.v1beta2.Table","profile":{"total_rows":"1","partition_key":"","partition_value":"","usage_count":"0","common_joins":[],"filters":[]},"columns":[{"name":"SomeStr","description":"","data_type":"text","is_nullable":false,"length":"0","profile":null,"columns":[],"attributes":null}],"preview_fields":[],"preview_rows":null,"attributes":null,"create_time":null,"update_time":null},"owners":[],"lineage":null,"labels":{},"is_deleted":false,"event":null,"create_time":null,"update_time":null,"refreshed_at":null}
2-
{"urn":"elasticsearch.index2","name":"index2","service":"","type":"table","url":"","description":"","data":{"@type":"type.googleapis.com/gotocompany.assets.v1beta2.Table","profile":{"total_rows":"1","partition_key":"","partition_value":"","usage_count":"0","common_joins":[],"filters":[]},"columns":[{"name":"SomeStr","description":"","data_type":"text","is_nullable":false,"length":"0","profile":null,"columns":[],"attributes":null}],"preview_fields":[],"preview_rows":null,"attributes":null,"create_time":null,"update_time":null},"owners":[],"lineage":null,"labels":{},"is_deleted":false,"event":null,"create_time":null,"update_time":null,"refreshed_at":null}
1+
{"urn":"elasticsearch.index1","name":"index1","service":"","type":"table","url":"","description":"","data":{"@type":"type.googleapis.com/gotocompany.assets.v1beta2.Table","profile":{"total_rows":"1","partition_key":"","partition_value":"","usage_count":"0","common_joins":[],"filters":[]},"columns":[{"name":"SomeStr","description":"","data_type":"text","is_nullable":false,"length":"0","profile":null,"columns":[],"attributes":null}],"preview_fields":[],"preview_rows":null,"ddl_statement":"","attributes":null,"create_time":null,"update_time":null},"owners":[],"lineage":null,"labels":{},"is_deleted":false,"event":null,"create_time":null,"update_time":null,"refreshed_at":null}
2+
{"urn":"elasticsearch.index2","name":"index2","service":"","type":"table","url":"","description":"","data":{"@type":"type.googleapis.com/gotocompany.assets.v1beta2.Table","profile":{"total_rows":"1","partition_key":"","partition_value":"","usage_count":"0","common_joins":[],"filters":[]},"columns":[{"name":"SomeStr","description":"","data_type":"text","is_nullable":false,"length":"0","profile":null,"columns":[],"attributes":null}],"preview_fields":[],"preview_rows":null,"ddl_statement":"","attributes":null,"create_time":null,"update_time":null},"owners":[],"lineage":null,"labels":{},"is_deleted":false,"event":null,"create_time":null,"update_time":null,"refreshed_at":null}

0 commit comments

Comments
 (0)