Skip to content

Conversation

@geoberle
Copy link
Collaborator

@geoberle geoberle commented Jan 22, 2026

What

add integration tests similar to the backend and frontend ones in /test-integration

  • testsuit framework with cosmos and CS data loading + request/response processing
  • simplified hello-world demo endpoint so it can be served from cosmos and CS data
  • add support for cosmosdb emulator on OSX (there is no arm64 image in the latest tag and x86 emulation with qemu results in segfaults)

this is a preparational PR so followup PRs that introduce first real admin api endpoints can focus on their logic + tests

Why

Special notes for your reviewer

@openshift-ci openshift-ci bot requested review from bennerv and mbarnes January 22, 2026 16:40
@openshift-ci
Copy link

openshift-ci bot commented Jan 22, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: geoberle

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@geoberle geoberle force-pushed the admin-simulation-tests branch 3 times, most recently from 24ac82e to f2d03a1 Compare January 22, 2026 17:53
add integration tests similar to the backend and frontend ones in `/test-integration`

* testsuit framework with cosmos and CS data loading
* simplified hello-world demo endpoint so it can be served from cosmos and CS data
* add support for cosmosdb emulator on OSX (there is no arm64 image in the latest tag and x86 emulation with qemu results in segfaults)

Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
@geoberle geoberle force-pushed the admin-simulation-tests branch from f2d03a1 to adf8c40 Compare January 22, 2026 17:57
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
@geoberle geoberle force-pushed the admin-simulation-tests branch from a027f75 to a13133f Compare January 23, 2026 00:03
return
}

// get first party application token credentials for the HCP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help me understand what's going on here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listing the LBs of the managed RG was just for showcasing the FPA creds in this demo handler. I did not want to spend time introducing fakes for the LB azure service at this point if we will not need it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go in the other direction. Backend wants these creds in @miguelsorianod's PR. Let's actually start an endpoint to pull useful/important azure resources for debugging a cluster.

}
}

func (tc *AdminTestCase) loadTestDefinition(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised you needed to do this (and executeRequest). Why were the primitives in the existing simulation tests insufficient?

cc @deads2k do you recommend a different approach? I am not in the weeds enough to know

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i had another look and now saw that there is the concept of the HTTPTestAccessor with an implementation for frontend. i will check if an implementation for admin api would fit the approach

Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
@geoberle geoberle force-pushed the admin-simulation-tests branch 2 times, most recently from 91451da to c91ba4f Compare January 23, 2026 11:15
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
@geoberle geoberle force-pushed the admin-simulation-tests branch from c91ba4f to 188bcbd Compare January 23, 2026 11:34
to make the steps reusable across frontend and admin tests, i replaced the FrontendClient func in the stepInput with an HTTPAccessorFactory function encapsulating the differences in internal client initialization and usage
func (l *httpCreateStep) RunTest(ctx context.Context, t *testing.T, stepInput StepInput) {
subscriptionID := api.Must(azcorearm.ParseResourceID(l.key.ResourceID)).SubscriptionID
accessor := newFrontendHTTPTestAccessor(stepInput.FrontendURL, stepInput.FrontendClient(subscriptionID))
accessor := stepInput.HTTPAccessorFactory(l.key.ResourceID)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you made the keys different. Admin API keys start with /admin. Use that to determine to the correct client to use and don't require a factory. That will allow us to do "the right thing" in a combined test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# these are the default values of the emulator container.
DEFAULT_COSMOS_ENDPOINT="https://localhost:8081"
# Control whether to restart an existing emulator
RESTART_EXISTING_EMULATOR="${RESTART_EXISTING_EMULATOR:-true}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default to false.

}, nil
}

func (tt *AdminResourceMutationTest) RunTest(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that we have the steps mutually compatible, what is the value of this function compared to the "normal" RunTest in this package.

CosmosContainer *azcosmos.ContainerClient
DBClient database.DBClient
ClusterServiceMockInfo *integrationutils.ClusterServiceMock
ServiceURL string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected two URLS, one for frontend, one for admin API, and both optional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants