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

Extract the mock api url from code to pipeline env #2388

Closed
wants to merge 23 commits into from

Conversation

Yuki-YuXin
Copy link
Contributor

@Yuki-YuXin Yuki-YuXin commented Apr 18, 2024

Summary:

Please go to the PR for further workhttps://github.com//pull/2387
This PR is closed because of the messy state during test.

@SammyO
Copy link
Contributor

SammyO commented Apr 30, 2024

@Yuki-YuXin I'd like to see this PR in action, i.e. run the tests using the new env var. Could you take a look at that?

@SammyO
Copy link
Contributor

SammyO commented Apr 30, 2024

@Yuki-YuXin there are more instances of the mock API URL in the code base, that haven't been replaced as part of this PR. Some of them might be in MSAL. Could you take a look at that?

@Yuki-YuXin Yuki-YuXin added No-4j-Changelog There is no changelog entry for common4j in this PR No-Changelog This Pull-Request has no associated changelog entry. labels May 7, 2024
@Yuki-YuXin Yuki-YuXin marked this pull request as ready for review May 13, 2024 12:19
@Yuki-YuXin Yuki-YuXin requested review from a team as code owners May 13, 2024 12:19
@Yuki-YuXin Yuki-YuXin added Skip-Consumers-Check Only include this if making a breaking change purposefully, and there is an MSAL/ADAL/Broker PR and removed Skip-Consumers-Check Only include this if making a breaking change purposefully, and there is an MSAL/ADAL/Broker PR labels May 13, 2024
@Yuki-YuXin
Copy link
Contributor Author

Summarize the discussion with Silviu in terms of this work item:

IOS don’t run the tests in the yml file. They run them locally, have a stash that we apply and then discard. As in they don’t run as part of the pipeline. They have different suite for unit which run in the pipeline and integration with mock api which run only locally.

@SammyO
Copy link
Contributor

SammyO commented May 16, 2024

Summarize the discussion with Silviu in terms of this work item:

IOS don’t run the tests in the yml file. They run them locally, have a stash that we apply and then discard. As in they don’t run as part of the pipeline. They have different suite for unit which run in the pipeline and integration with mock api which run only locally.

What's your point here @Yuki-YuXin ?

@@ -30,8 +30,8 @@ import java.net.URL
*/
interface ApiConstants {
companion object {
const val BASEPATH = "https://native-auth-mock-api.azurewebsites.net/"
private const val BASE_REQUEST_PATH = BASEPATH + "1234/"
val BASEPATH: String? by lazy { System.getenv("MOCK_API_URL") }
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not how we should be dealing with env vars. They should be set as part of the gradle script, in BuildConfig vars. E.g. look at how the Labs API secret is set in various build.gradle files: buildConfigField("String", "LAB_CLIENT_SECRET", "\"$labClientSecret\"").

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me know if you need some help with this.

@@ -51,7 +50,7 @@ class NativeAuthOAuth2Configuration(

companion object {
//Base url for the mock API to make Native Auth calls. See the swagger at
// https://native-auth-mock-api.azurewebsites.net/doc#/ for all possible urls
// $(MOCK_API_URL)/doc#/ for all possible urls
private const val MOCK_API_URL_WITH_NATIVE_AUTH_TENANT = "https://native-auth-mock-api.azurewebsites.net/lumonconvergedps.onmicrosoft.com"
Copy link
Contributor

Choose a reason for hiding this comment

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

Mock API value is still set here. Can you please do a ctrl-F in the entire project for this API value string and remove all occurrences?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to first let the PR passed first using the concrete string since it's not a test file.

@@ -17,6 +21,8 @@ pool:
jobs:
- job: build_test
displayName: Build & Test
env:
MOCK_API_URL: https://native-auth-mock-api.azurewebsites.net/
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this here? Shouldn't this PR be introducing the integration with the environment var, so we can test that?

@Yuki-YuXin
Copy link
Contributor Author

Yuki-YuXin commented May 16, 2024

Summarize the discussion with Silviu in terms of this work item:
IOS don’t run the tests in the yml file. They run them locally, have a stash that we apply and then discard. As in they don’t run as part of the pipeline. They have different suite for unit which run in the pipeline and integration with mock api which run only locally.

What's your point here @Yuki-YuXin ?

They don't seem to intend to integrate the mock api into the pipeline in the center server and they can easily accept the changes of mock api because every time they use the url locally.

@Yuki-YuXin
Copy link
Contributor Author

@Yuki-YuXin I'd like to see this PR in action, i.e. run the tests using the new env var. Could you take a look at that?

From the experience of cert PR, if we can pass the PR pipeline verification check, we prove that the new env var actually work

@Yuki-YuXin Yuki-YuXin closed this May 17, 2024
@Yuki-YuXin Yuki-YuXin deleted the yuki/mock-api-domain branch May 29, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No-4j-Changelog There is no changelog entry for common4j in this PR No-Changelog This Pull-Request has no associated changelog entry.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants