Skip to content

Commit 0611526

Browse files
update config_test.go
1 parent d029ec7 commit 0611526

File tree

5 files changed

+7
-44
lines changed

5 files changed

+7
-44
lines changed

receiver/sqlqueryreceiver/config_test.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ func TestLoadConfig(t *testing.T) {
6868
CollectionInterval: 10 * time.Second,
6969
InitialDelay: time.Second,
7070
},
71-
Driver: "mydriver",
71+
Driver: "mydriver",
72+
DataSource: "host=localhost port=5432 user=me password=s3cr3t sslmode=disable",
7273
DataSourceConfig: sqlquery.DataSourceConfig{
7374
Host: "localhost",
7475
Port: 5432,
@@ -144,17 +145,7 @@ func TestLoadConfig(t *testing.T) {
144145
{
145146
fname: "config-invalid-missing-datasource.yaml",
146147
id: component.NewIDWithName(metadata.Type, ""),
147-
errorMessage: "'datasource_config.host' must be specified",
148-
},
149-
{
150-
fname: "config-invalid-missing-datasource-port.yaml",
151-
id: component.NewIDWithName(metadata.Type, ""),
152-
errorMessage: "'datasource_config.port' must be specified",
153-
},
154-
{
155-
fname: "config-invalid-missing-datasource-database.yaml",
156-
id: component.NewIDWithName(metadata.Type, ""),
157-
errorMessage: "'datasource_config.database' must be specified",
148+
errorMessage: "'datasource' must be specified",
158149
},
159150
{
160151
fname: "config-logs.yaml",
@@ -192,7 +183,8 @@ func TestLoadConfig(t *testing.T) {
192183
CollectionInterval: 10 * time.Second,
193184
InitialDelay: time.Second,
194185
},
195-
Driver: "mydriver",
186+
Driver: "mydriver",
187+
DataSource: "host=localhost port=5432 user=me password=s3cr3t sslmode=disable",
196188
DataSourceConfig: sqlquery.DataSourceConfig{
197189
Host: "localhost",
198190
Port: 5432,

receiver/sqlqueryreceiver/testdata/config-datasource-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
sqlquery:
22
collection_interval: 10s
33
driver: mydriver
4+
datasource: host=localhost port=5432 user=me password=s3cr3t sslmode=disable
45
datasource_config:
56
host: localhost
67
port: 5432

receiver/sqlqueryreceiver/testdata/config-invalid-missing-datasource-database.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

receiver/sqlqueryreceiver/testdata/config-invalid-missing-datasource-port.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

receiver/sqlqueryreceiver/testdata/config-logs-datasource-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
sqlquery:
22
collection_interval: 10s
33
driver: mydriver
4+
datasource: host=localhost port=5432 user=me password=s3cr3t sslmode=disable
45
datasource_config:
56
host: localhost
67
port: 5432

0 commit comments

Comments
 (0)