Closed skl closed 11 months ago
As suspected, this error has come back due to the hard dependency on AWS:
=== RUN Test_New
=== RUN Test_New/no_error
aws_test.go:29:
Error Trace: /home/runner/work/cloudcost-exporter/cloudcost-exporter/pkg/aws/aws_test.go:29
Error: Received unexpected error:
operation error ec2imds: GetRegion, failed to get API token, operation error ec2imds: getToken, http response error StatusCode: 400, request to EC2 IMDS failed
Test: Test_New/no_error
--- FAIL: Test_New (0.00s)
--- FAIL: Test_New/no_error (0.00s)
I'll skip the test for now (coverage dropped to 34.5%), that refactor is probably worth a separate PR.
Refactored dependency on
*prometheus.Registry
struct toprovider.Registry
interface to support mocking.New
still needs work but this PR introduces gomock as necessary to create compatible mocks in this package, mockery-generated mocks were not type-compatible for some reason.Note that this means there are duplicate mocks generated for the new interface.
79% coverage.