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

Add a dio_test project and move request integration test #2077

Merged
merged 10 commits into from
Mar 8, 2024

Conversation

kuhnroyal
Copy link
Member

@kuhnroyal kuhnroyal commented Dec 22, 2023

This was supposed to be just an attempt but while moving the integration test, I found a bug since one of the tests failed for the Http2Adapter.
So I think this is a good approach, I will move more tests in future PRs.

  • run tests for all adapters
  • fix redirect bug for Http2Adapter

New Pull Request Checklist

  • I have read the Documentation
  • I have searched for a similar pull request in the project and found none
  • I have updated this branch with the latest main branch to avoid conflicts (via merge from master or rebase)
  • I have added the required tests to prove the fix/feature I'm adding
  • I have updated the documentation (if necessary)
  • I have run the tests without failures
  • I have updated the CHANGELOG.md in the corresponding package

Additional context and info (if any)

@kuhnroyal kuhnroyal added p: dio Targeting `dio` package p: http2_adapter Targeting `http2_adapter` package s: bug Something isn't working e: tests Improvements or additions to tests labels Dec 22, 2023
@kuhnroyal kuhnroyal self-assigned this Dec 22, 2023
@kuhnroyal kuhnroyal force-pushed the chore/test-utils branch 2 times, most recently from aafb558 to 807f2f3 Compare December 22, 2023 15:07
@kuhnroyal kuhnroyal marked this pull request as ready for review December 28, 2023 13:09
@kuhnroyal kuhnroyal requested a review from a team as a code owner December 28, 2023 13:09
@kuhnroyal
Copy link
Member Author

@AlexV525 What do you think about this approach? There is also a bugfix for redirects in here.

publish_to: none

environment:
sdk: '>=3.0.0 <4.0.0'
Copy link
Member

Choose a reason for hiding this comment

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

If we're doing this, we should not be able to run this with our minimum SDK support.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, this is due to the HTTP2 requiring this.
I don't see a way to create a utils package that we can use in all the adapters. We would have a cyclic dependency on dio->util->dio

Copy link
Member

Choose a reason for hiding this comment

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

I mean we cannot run the dio/test/request_integration_test.dart anymore on 2.15 after this, correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I don't see a way to run the same test suite on lower SDK if one of our adapters requires 3.0.0.
Unless we can maybe run the same tests with different pubspec.yaml files?

Copy link
Member Author

Choose a reason for hiding this comment

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

It actually works with a shared util package that we can import as dev dependency.
This way we can run tests on all supported SDK versions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Update this a bit but we now have a shared dio_test package that is imported as dev dependency into dio and http2_adapter. So the tests can be run with all Dart SDK targets.

@AlexV525
Copy link
Member

There is also a bugfix for redirects in here.

Can we extract the fix to another request first?

@kuhnroyal
Copy link
Member Author

There is also a bugfix for redirects in here.

Can we extract the fix to another request first?

Done. See #2101

@kuhnroyal kuhnroyal force-pushed the chore/test-utils branch 7 times, most recently from 2040a63 to f8b1d08 Compare January 22, 2024 00:27
github-merge-queue bot pushed a commit that referenced this pull request Feb 28, 2024
Fixes a redirect bug discovered during
#2077 where the adapter would fail to
properly redirect if the location header contains a relative URL.


<!-- Write down your pull request descriptions. -->

### New Pull Request Checklist

- [x] I have read the
[Documentation](https://pub.dev/documentation/dio/latest/)
- [x] I have searched for a similar pull request in the
[project](https://github.com/cfug/dio/pulls) and found none
- [x] I have updated this branch with the latest `main` branch to avoid
conflicts (via merge from master or rebase)
- [x] I have added the required tests to prove the fix/feature I'm
adding
- [x] I have updated the documentation (if necessary)
- [x] I have run the tests without failures
- [x] I have updated the `CHANGELOG.md` in the corresponding package

### Additional context and info (if any)

<!-- Provide more context and info about the PR. -->
@kuhnroyal
Copy link
Member Author

I moved some tests in to the test package but I think we should move the rest in separate PRs. So I think this is good to go if we want to take that route.

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

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

Thanks for all the work!

@kuhnroyal kuhnroyal added this pull request to the merge queue Mar 8, 2024
Merged via the queue into cfug:main with commit b7d7f34 Mar 8, 2024
3 checks passed
@kuhnroyal kuhnroyal deleted the chore/test-utils branch March 8, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e: tests Improvements or additions to tests p: dio Targeting `dio` package p: http2_adapter Targeting `http2_adapter` package s: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants