prometheus/discovery/aws
akunszt 08a7162502
discovery: aws/ec2 unit tests (#14364)
* discovery: add aws/ec2 unit tests 

* discovery: initial skeleton for aws/ec2 unit tests

This is a - very likely - not too useful unit test for the AWS SD. It is
commited so other people can check the basic logic and the
implementation.

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: fix linter complains about ec2_test.go

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: add basic unit test for aws

This tests only the basic labelling, not including the VPC related
information.

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: fix linter complains about ec2_test.go

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: other linter fixes in aws/ec2_test.go

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: implement remaining tests for aws/ec2

The coverage is not 100% but I think it is a good starting point if
someone wants to improve that.

Currently it covers all the AWS API calls.

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: make linter happy in aws/ec2_test.go

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: make utility funtcions private

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discover: no global variable in the aws/ec2 test

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: common body for some tests in ec2

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: try to make golangci-lint happy

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: make every non-test function private

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: test for errors first in TestRefresh

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: move refresh tests into the function

This way people can find both the test cases and the execution of the
test at the same place.

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: fix copyright date

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: remove misleading comment

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: rename test for easier identification

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: use static values for the test cases

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discover: try to make the linter happy

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: drop redundant data from ec2 and use common ptr functions

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: use Error instead of Equal

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* discovery: merge refreshAZIDs tests into one

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

---------

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
2024-10-16 14:36:37 +02:00
..
ec2.go discovery: aws/ec2 unit tests (#14364) 2024-10-16 14:36:37 +02:00
ec2_test.go discovery: aws/ec2 unit tests (#14364) 2024-10-16 14:36:37 +02:00
lightsail.go chore!: adopt log/slog, remove go-kit/log 2024-10-07 15:58:50 -04:00
metrics_ec2.go SD Managers taking over responsibility for registration of debug metrics (#13375) 2024-01-23 16:53:55 +01:00
metrics_lightsail.go SD Managers taking over responsibility for registration of debug metrics (#13375) 2024-01-23 16:53:55 +01:00