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

chore/Issue 1016: Replace the use of request with fetch in test cases #1172

Conversation

DevLab2425
Copy link
Contributor

Related Issue

#1016

Summary of Changes


done();
it('should return a 200', function() {
expect(response.status).to.equal(200);
Copy link
Contributor Author

@DevLab2425 DevLab2425 Oct 18, 2023

Choose a reason for hiding this comment

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

@thescientist13
Just wanted to double check on these changes before I start to apply them to the other files. I only really ask because it doesn't seem like anything broke when I changed the specs.

Copy link
Member

@thescientist13 thescientist13 Oct 19, 2023

Choose a reason for hiding this comment

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

yeah, this looks to be on the right track!

I feel like there was a case I tried that was tricky and couldn't get it work. Maybe do a "spot" test on the request.post usages in this spec on the release/0.29.0 branch?

Also worth testing in any serve based test case, I noticed in those cases I had to use .127.0.0.1 and maybe that was where I got stuck?

But if you can get that cross section of test cases working, then I think it should be full steam ahead at that point.

Copy link
Contributor Author

@DevLab2425 DevLab2425 Oct 19, 2023

Choose a reason for hiding this comment

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

@thescientist13

Maybe do a "spot" test....

Was successful on the spot test: release/0.29.0...DevLab2425:greenwood:issue-1016-release-update

I had to use .127.0.0.1 .....

Will report back on the IP-based tests.

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 was also successful with replacing the IP with localhost.

Updated compare: release/0.29.0...DevLab2425:greenwood:issue-1016-release-update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want me to target the v0.29.0 branch for this PR too? It'll have ~90 updates/~25 files with all of the replacements.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, if you've got it all figured out, feel free to target that release branch! 🙏

@DevLab2425 DevLab2425 force-pushed the issue-1016-replace-request-with-fetch branch from 31581fb to d351f55 Compare October 18, 2023 21:51
@DevLab2425 DevLab2425 changed the title Issue 1016: Initital attempt at using fetch over request Issue 1016: Replace the use of request with fetch Oct 18, 2023
@thescientist13 thescientist13 added the chore unit testing, maintenance, etc label Oct 19, 2023
@thescientist13 thescientist13 linked an issue Oct 19, 2023 that may be closed by this pull request
@DevLab2425 DevLab2425 force-pushed the issue-1016-replace-request-with-fetch branch from d351f55 to bc5eb6c Compare October 19, 2023 02:51
@DevLab2425 DevLab2425 changed the base branch from master to release/0.29.0 October 19, 2023 02:51
@DevLab2425 DevLab2425 force-pushed the issue-1016-replace-request-with-fetch branch 4 times, most recently from 9864116 to 76569d9 Compare October 19, 2023 14:25
@thescientist13
Copy link
Member

Got a little time, let me see if I can help with the build failures and merge conflicts.

.mocharc.cjs Outdated
@@ -1,3 +1,5 @@
module.exports = {
timeout: 90000
timeout: 90000,
bail: true,
Copy link
Member

@thescientist13 thescientist13 Nov 7, 2023

Choose a reason for hiding this comment

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

could you expand a little bit on what these options introduce?

edit: looks like bail will kill the test run as soon as it hits an error? (as opposed to running all specs and providing a full report at the end?)

Copy link
Member

Choose a reason for hiding this comment

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

I ended up rolling this one back since it was a little frustrating to have to keep re-running specs and then getting halted when one fails, re-starting the runner, bailing at the next failure, etc. It can be nice to let things keep running to see all the failures in totality during a single run.

Perhaps this could be useful as a CI only flag? So we don't keep wasting build time after a failure? 🤔

@thescientist13 thescientist13 force-pushed the issue-1016-replace-request-with-fetch branch from 90bd9a0 to 4de60da Compare November 7, 2023 14:58
@thescientist13 thescientist13 marked this pull request as ready for review November 7, 2023 15:00
Copy link
Member

@thescientist13 thescientist13 left a comment

Choose a reason for hiding this comment

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

Phew, thanks for getting this effort started @DevLab2425 ! After rebasing and resolving the merge conflicts, I was able to get to the rest of the test cases, so this is all looking good to go now!

Feels a lot more lightweight and intuitive using fetch 💯

@thescientist13 thescientist13 changed the title Issue 1016: Replace the use of request with fetch chore/Issue 1016: Replace the use of request with fetch in test cases Nov 8, 2023
@thescientist13 thescientist13 merged commit 7c9c23f into ProjectEvergreen:release/0.29.0 Nov 8, 2023
8 checks passed
thescientist13 added a commit that referenced this pull request Nov 9, 2023
…#1172)

* Issue 1016: Initital attempt at using fetch over request

* Issue-1016: Refactor IP to use localhost url

* Issue-1016: Initial POST refactor to fetch

* Issue-1016: Progress on removal of request

* Issue-1016: Additional removal of request

* Issue-1016: Finalize plugin tests

* use response.text()

* refactor init spec to fetch

* all specs refactored to use fetch

* refactoring all specs

---------

Co-authored-by: Owen Buckley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore unit testing, maintenance, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor tests to use fetch instead of request
2 participants