Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ability to serve mocked data for MR API calls via cli flag #377

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

alexcreasy
Copy link
Contributor

@alexcreasy alexcreasy commented Sep 11, 2024

Description

This adds scaffolding to be able to serve mocked data for MR API endpoints. It also incudes endpoints to mock all existing BFF endpoints and their tests. The remaining endpoints will be added shortly after in a separate PR

How Has This Been Tested?

  1. Run the backend with the MOCK_MR_API=true flag (See README updates for more info)
  2. Run each of the example curl requests listed in the README and verify the output

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages; the author will squash them after approval or in case of manual merges will ask to merge with squash.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.

If you have UI changes

  • The developer has added tests or explained why testing cannot be added.
  • Included any necessary screenshots or gifs if it was a UI change.
  • Verify that UI/UX changes conform the UX guidelines for Kubeflow.

```shell
make run PORT=8000 MOCK_K8S_CLIENT=true
make run PORT=8000 MOCK_K8S_CLIENT=true MOCK_MR_CLIENT=true
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a review, it's more of a question, are we gonna get 8000 as the default port? We have 4000 in the frontend for the api, if so, I'll do a follow up PR to change the references there.

Copy link
Member

Choose a reason for hiding this comment

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

You are right, the default port seems to be PORT ?= 4000 (on Makefile)

Copy link
Member

Choose a reason for hiding this comment

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

But on those instructions, I just to show how to do with an alternative one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes... if you leave out the PORT param it defaults to 4000 - I think this is just a doc issue of "how to I make that clearer"

```shell
make run PORT=8000 MOCK_K8S_CLIENT=true
make run PORT=8000 MOCK_K8S_CLIENT=true MOCK_MR_CLIENT=true
Copy link
Member

Choose a reason for hiding this comment

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

You are right, the default port seems to be PORT ?= 4000 (on Makefile)

```shell
make run PORT=8000 MOCK_K8S_CLIENT=true
make run PORT=8000 MOCK_K8S_CLIENT=true MOCK_MR_CLIENT=true
Copy link
Member

Choose a reason for hiding this comment

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

But on those instructions, I just to show how to do with an alternative one.

@@ -11,6 +11,8 @@ import (

type Envelope map[string]interface{}

type TypedEnvelope[T any] map[string]T
Copy link
Member

Choose a reason for hiding this comment

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

@alexcreasy in a next iteration shall we remove the untyped one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ederign yes, I'd like to, the only reason I didn't just change it was for speed right now :)

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ederign

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

The pull request process is described here

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

@ederign
Copy link
Member

ederign commented Sep 11, 2024

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Sep 11, 2024
@google-oss-prow google-oss-prow bot merged commit 4ff876f into kubeflow:main Sep 11, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants