Skip to content

test: sql input requires uncessary flag #11114

@powersj

Description

@powersj

Relevant telegraf.conf

n/a

Logs from Telegraf

2022/05/17 11:44:35 D! [] Connecting to "root:@tcp(127.0.0.1:3306)/foo"...
2022/05/17 11:44:35 D! [] Testing connectivity...
--- FAIL: TestMariaDB (0.00s)
    --- FAIL: TestMariaDB/metric_one (0.00s)
        sql_test.go:139: 
            	Error Trace:	sql_test.go:139
            	Error:      	Received unexpected error:
            	            	connecting to database failed: Error 1049: Unknown database 'foo'
            	Test:       	TestMariaDB/metric_one
2022/05/17 11:44:35 D! [] Connecting to "postgres://postgres:@127.0.0.1:5432/foo"...
2022/05/17 11:44:35 D! [] Testing connectivity...
--- FAIL: TestPostgreSQL (0.00s)
    --- FAIL: TestPostgreSQL/metric_one (0.00s)
        sql_test.go:258: 
            	Error Trace:	sql_test.go:258
            	Error:      	Received unexpected error:
            	            	connecting to database failed: failed to connect to `host=127.0.0.1 user=postgres database=foo`: server error (FATAL: database "foo" does not exist (SQLSTATE 3D000))
            	Test:       	TestPostgreSQL/metric_one
2022/05/17 11:44:35 D! [] Connecting to "tcp://127.0.0.1:9000?username=default&database=foo"...
2022/05/17 11:44:35 D! [] Testing connectivity...
--- FAIL: TestClickHouse (0.00s)
    --- FAIL: TestClickHouse/metric_one (0.00s)
        sql_test.go:370: 
            	Error Trace:	sql_test.go:370
            	Error:      	Received unexpected error:
            	            	connecting to database failed: dial tcp 127.0.0.1:9000: connect: connection refused
            	Test:       	TestClickHouse/metric_one
FAIL
FAIL	github.com/influxdata/telegraf/plugins/inputs/sql	0.038s
FAIL

System info

master

Docker

No response

Steps to reproduce

go test -count=1 -race -timeout 30s ./plugins/inputs/sql/...

Expected behavior

Tests pass

Actual behavior

It appears that all three server types do not connect to the server. Looking at the code do you learn that there is an additional CLI parameter called "spinup" that will spin up the required test containers.

This is an inconsistent behavior with the other plugins, which generally do not require any unnecessary or additional parameters to run successfully.

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions