Skip to content

MQE-2212: Fix invalid behaviour MAGENTO_BACKEND_BASE_URL #780

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

Merged
merged 5 commits into from
Aug 11, 2020
Merged

Conversation

soumyau
Copy link
Contributor

@soumyau soumyau commented Jul 31, 2020

Description

Ported changes from #547 to develop

Fixed Issues (if relevant)

  1. magento/magento2-functional-testing-framework#<issue_number>: Issue title
  2. ...

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/verification tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
  • Changes to Framework doesn't have backward incompatible changes for tests or have related Pull Request with fixes to tests

@coveralls
Copy link

coveralls commented Jul 31, 2020

Coverage Status

Coverage increased (+0.01%) to 61.332% when pulling cf94261 on MQE-2212 into 20af7fd on develop.

@soumyau soumyau force-pushed the MQE-2212 branch 2 times, most recently from f395707 to 7abcefe Compare July 31, 2020 21:57
*/
class MftfGlobals
class UrlProvider
Copy link
Contributor

Choose a reason for hiding this comment

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

  • This class is a util class that manipulates on the env vars. Let us not move it to top level directory structure.
  • This class is mean to provide some global constants that can be reused across entire framewrok. Not necessary only for urls. I would rather keep it the same name.

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 think the reason why UrlProvider is used is to follow the same design pattern as Magento. Refer to UrlProvider class in Magento. Not a bad idea to have Url builder class separated out from Global constants. But let me know if you still think if this needs to be refactored to the original.

Copy link
Contributor

Choose a reason for hiding this comment

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

Which UrlProvider class you refers to? The Provider on root level file structure feels misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved UrlProvider to Util folder, as per discussion

);
}
return UrlFormatter::format($baseUrl, $withTrailingSeparator);
} catch (TestFrameworkException $e) {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep the logic of caching the $baseUrl and $backendBaseUrl. I remember adding this to fix performance deterioration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

$baseUrl changes based on $customArea specified in AdminFormExecutor and FrontendFormExecutor. Caching resulted in failures. How much of a degradation did you see?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have a build after the change? I remember there were degradation when I make these files change, but I don't remember exactly if it's due to code here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@soumyau soumyau Aug 6, 2020

Choose a reason for hiding this comment

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

I added file level caching for AdminFormExecutor and FrontEndFormExecutor. Will retrigger build after changes look good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if ($backendBaseUrl) {
$backendBaseUrl = UrlFormatter::format($backendBaseUrl, $withTrailingSeparator);
}
return $backendBaseUrl;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this function? I mean will this be the same as getBaseUrl('admin')?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

getBaseUrl('admin') calls this function in the switch case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it need to be public? I mean if the entry point is getBaseUrl('admin')? It seems redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, changed it to private

@soumyau soumyau force-pushed the MQE-2212 branch 3 times, most recently from 117006e to 17898ad Compare August 6, 2020 18:19
Copy link
Contributor

@jilu1 jilu1 left a comment

Choose a reason for hiding this comment

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

  • The Provider directory is unnecessary. What other providers you expected to belong here?
  • The baseUrl and adminBaseUrl are two global constants that will not change during test. I don't think we should change to calculate them every time based on area. Let's keep the original ideas to keep them cached as private static variables and accessible through getter functions of getBaseUrl() and getBackendBaseUrl() across entire framework. No need to store them separately in AdminFormExectuor, FrontendFormExecutor and WebApi Executor related classes. The changes should be much simplified. Let me know if you need more details.

@soumyau
Copy link
Contributor Author

soumyau commented Aug 10, 2020

  • The Provider directory is unnecessary. What other providers you expected to belong here?
  • The baseUrl and adminBaseUrl are two global constants that will not change during test. I don't think we should change to calculate them every time based on area. Let's keep the original ideas to keep them cached as private static variables and accessible through getter functions of getBaseUrl() and getBackendBaseUrl() across entire framework. No need to store them separately in AdminFormExectuor, FrontendFormExecutor and WebApi Executor related classes. The changes should be much simplified. Let me know if you need more details.

Thanks for the comments, AC of this ticket was to port #547 in 3.0. If the AC is not acceptable, it's best to create a new ticket and plan it. What you think?

@soumyau
Copy link
Contributor Author

soumyau commented Aug 11, 2020

  • The Provider directory is unnecessary. What other providers you expected to belong here?
  • The baseUrl and adminBaseUrl are two global constants that will not change during test. I don't think we should change to calculate them every time based on area. Let's keep the original ideas to keep them cached as private static variables and accessible through getter functions of getBaseUrl() and getBackendBaseUrl() across entire framework. No need to store them separately in AdminFormExectuor, FrontendFormExecutor and WebApi Executor related classes. The changes should be much simplified. Let me know if you need more details.

I think I understood what you meant by simpilifying url generation. Updated to code to only pull in relevant pieces from Lukasz's PR just enough to fix the problem.

Build: https://m2build-ur.devops.magento.com/job/All-User-Requested-Tests/35136/

@jilu1
Copy link
Contributor

jilu1 commented Aug 11, 2020

Changes are simplified and Look good. Make sure to run UR build before merge.

@soumyau
Copy link
Contributor Author

soumyau commented Aug 11, 2020

Changes are simplified and Look good. Make sure to run UR build before merge.

Build looks good - https://m2build-ur.devops.magento.com/job/All-User-Requested-Tests/35159/

@soumyau soumyau merged commit 85d4fa6 into develop Aug 11, 2020
@tomreece tomreece deleted the MQE-2212 branch August 19, 2020 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants