Skip to content

Conversation

@joekr
Copy link
Member

@joekr joekr commented Oct 13, 2025

What this PR does / why we need it:
Fixes a small issue with #456
If you run this on an instance in the cloud it works, if you run it locally it won't pass. This mocks out the auth provider to allow instance principals to pass locally.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
no open issue for this.

@joekr joekr requested a review from vladcristi October 13, 2025 17:55
@joekr joekr self-assigned this Oct 13, 2025
@joekr joekr added the bug Something isn't working label Oct 13, 2025
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 13, 2025
@joekr
Copy link
Member Author

joekr commented Oct 13, 2025

Unit Test

        github.com/oracle/cluster-api-provider-oci              coverage: 0.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/api/v1beta1  28.209s coverage: 23.3% of statements
ok      github.com/oracle/cluster-api-provider-oci/api/v1beta2  1.394s  coverage: 16.3% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/config 0.689s  coverage: 86.1% of statements
        github.com/oracle/cluster-api-provider-oci/cloud/metrics                coverage: 0.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/ociutil        0.877s  coverage: 15.9% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/ociutil/ptr    1.745s  coverage: 100.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/scope  22.271s coverage: 74.4% of statements
        github.com/oracle/cluster-api-provider-oci/cloud/scope/mocks            coverage: 0.0% of statements
        github.com/oracle/cluster-api-provider-oci/cloud/services/base          coverage: 0.0% of statements
        github.com/oracle/cluster-api-provider-oci/cloud/services/base/mock_base                coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/compute       [no test files]
        github.com/oracle/cluster-api-provider-oci/cloud/services/compute/mock_compute          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/computemanagement     [no test files]
        github.com/oracle/cluster-api-provider-oci/cloud/services/computemanagement/mock_computemanagement              coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine       [no test files]
        github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine/mock_containerengine          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/identity      [no test files]
        github.com/oracle/cluster-api-provider-oci/cloud/services/identity/mock_identity                coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/loadbalancer  [no test files]
        github.com/oracle/cluster-api-provider-oci/cloud/services/loadbalancer/mock_lb          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer   [no test files]
        github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer/mock_nlb          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/vcn   [no test files]
        github.com/oracle/cluster-api-provider-oci/cloud/services/vcn/mock_vcn          coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/cloud/services/workrequests  [no test files]
        github.com/oracle/cluster-api-provider-oci/cloud/services/workrequests/mock_workrequests                coverage: 0.0% of statements
ok      github.com/oracle/cluster-api-provider-oci/cloud/util   1.265s  coverage: 60.5% of statements
ok      github.com/oracle/cluster-api-provider-oci/controllers  3.594s  coverage: 59.2% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1      8.372s  coverage: 15.3% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2      1.524s  coverage: 5.8% of statements
ok      github.com/oracle/cluster-api-provider-oci/exp/controllers      2.576s  coverage: 56.3% of statements
        github.com/oracle/cluster-api-provider-oci/feature              coverage: 0.0% of statements
?       github.com/oracle/cluster-api-provider-oci/version      [no test files]

E2E

Ran 9 of 31 Specs in 3964.612 seconds
SUCCESS! -- 9 Passed | 0 Failed | 0 Pending | 22 Skipped

In order to get these to pass I cherry picked these changes onto a branch created from commit bd49501 (which pre-dates the breaking commit c206fa4)

@joekr joekr changed the title bug: add ability to mock instance principal config fix: add ability to mock instance principal config Oct 15, 2025
In order for this to pass locally this needs to be mocked, otherwise
it attempts to make http calls to pull instance principal info, which
doesn't exist locally.
@joekr joekr merged commit 3aa8888 into oracle:main Oct 17, 2025
2 checks passed
@joekr joekr deleted the fix-unit-tests branch October 21, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants