Skip to content

test: mongodb output tests expect various authenticaiton methods #11121

@powersj

Description

@powersj

Relevant telegraf.conf

n/a

Logs from Telegraf

--- FAIL: TestConnectAndWriteIntegrationNoAuth (30.00s)
    mongodb_test.go:27: 
        	Error Trace:	mongodb_test.go:27
        	Error:      	Received unexpected error:
        	            	unable to get collections from specified metric database: unable to execute ListCollections: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27017, Type: Unknown, Last error: connection() error occurred during connection handshake: dial tcp [::1]:27017: connect: connection refused }, ] }
        	Test:       	TestConnectAndWriteIntegrationNoAuth
--- FAIL: TestConnectAndWriteIntegrationSCRAMAuth (35.00s)
    --- FAIL: TestConnectAndWriteIntegrationSCRAMAuth/success_with_scram_authentication (30.00s)
        mongodb_test.go:53: 
            	Error Trace:	mongodb_test.go:53
            	            				mongodb_test.go:82
            	Error:      	Received unexpected error:
            	            	unable to get collections from specified metric database: unable to execute ListCollections: server selection error: server selection timeout, current topology: { Type: Unknown, Servers: [{ Addr: localhost:27018, Type: Unknown, Last error: connection() error occurred during connection handshake: dial tcp [::1]:27018: connect: connection refused }, ] }
            	Test:       	TestConnectAndWriteIntegrationSCRAMAuth/success_with_scram_authentication
--- FAIL: TestConnectAndWriteIntegrationX509Auth (0.00s)
    --- FAIL: TestConnectAndWriteIntegrationX509Auth/success_with_x509_authentication (0.00s)
        mongodb_test.go:124: 
            	Error Trace:	mongodb_test.go:124
            	            				mongodb_test.go:252
            	Error:      	Received unexpected error:
            	            	unable to connect: open dev/cacert.pem: no such file or directory
            	Test:       	TestConnectAndWriteIntegrationX509Auth/success_with_x509_authentication
    --- FAIL: TestConnectAndWriteIntegrationX509Auth/success_with_x509_authentication_using_encrypted_key_file (0.00s)
        mongodb_test.go:144: 
            	Error Trace:	mongodb_test.go:144
            	            				mongodb_test.go:252
            	Error:      	Received unexpected error:
            	            	unable to connect: open dev/cacert.pem: no such file or directory
            	Test:       	TestConnectAndWriteIntegrationX509Auth/success_with_x509_authentication_using_encrypted_key_file
    --- FAIL: TestConnectAndWriteIntegrationX509Auth/success_with_x509_authentication_missing_ca_and_using_insceure_tls (0.00s)
        mongodb_test.go:162: 
            	Error Trace:	mongodb_test.go:162
            	            				mongodb_test.go:252
            	Error:      	Received unexpected error:
            	            	unable to connect: open dev/client.pem: no such file or directory
            	Test:       	TestConnectAndWriteIntegrationX509Auth/success_with_x509_authentication_missing_ca_and_using_insceure_tls
FAIL
FAIL	github.com/influxdata/telegraf/plugins/outputs/mongodb	65.031s
FAIL

System info

master

Docker

No response

Steps to reproduce

  1. docker-compose up
  2. go test -count=1 -race ./plugins/outputs/mongodb/...

Expected behavior

test pass

Actual behavior

There are several integration tests for the MongoDB output that will attempt to connect with various authentication methods. There is a shell script in the dev directory that will launch various mongo instances with these various scenarios on various ports that are then used by the test.

Additional info

Proposed plan is to update these to use test containers and setup each test case with the necessary authentication method using the existing commands in a startup script as we do for the SQL tests.

Metadata

Metadata

Assignees

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