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

Convert io_loop_v6.t, subprocess.t, and websocket_proxy.t to use subtests. #1520 #1598

Closed
wants to merge 6 commits into from

Conversation

spazm
Copy link

@spazm spazm commented Nov 1, 2020

Summary

Convert 3 tests to use subtests that converted cleanly.

  • ioloop_ipv6.t : single commented section converted to a single subtest with no other changes.
  • subprocess.t: commented sections converted cleanly to subtests. Three variable names were reused between tests, but they values were not reused or shared. Fix required only redeclaring and reinitializing as needed for $fail, $result, and $subprocess.
  • websocket_proxy_lts.t : commented sections converted cleanly to subtests. Three variable names were reused between tests, but they values were not reused or shared. Fix required only redeclaring and reinitializing as needed for $tx, $keepalive and $result.

Motivation

Requested in #1520

References

See #1520


};

my $reactor = Mojo::IOLoop->singleton->reactor;
Copy link
Member

Choose a reason for hiding this comment

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

This seems like completely new code that changes what the test does.

Copy link
Author

@spazm spazm Nov 1, 2020

Choose a reason for hiding this comment

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

These tests had far too much shared code, which is why so much of it had to be moved out of the subtests. I was hoping to discuss how to better compartmentalize the tests.

But then I got into a fugue state at the end of hacktoberfest, converting more and more -- only to find I was breaking the tests when run on integration, as I was missing local ENV vars to run all the tests. so it goes.


};

my $server;
Copy link
Member

Choose a reason for hiding this comment

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

Variable outside of subtest.

Copy link
Author

Choose a reason for hiding this comment

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

variable shared between tests and moved out of subtest. How best to isolate?


};

my $reactor2;
Copy link
Member

Choose a reason for hiding this comment

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

Variable outside of subtest.

local $ENV{MOJO_CERT_FILE} = 't/mojo/certs/client.crt';
local $ENV{MOJO_KEY_FILE} = 't/mojo/certs/client.key';
local $ENV{MOJO_INSECURE} = 0;
my $ua;
Copy link
Member

Choose a reason for hiding this comment

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

Variable outside of subtest.

Copy link
Author

Choose a reason for hiding this comment

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

variable shared between tests and moved out of subtest. How best to isolate?

Copy link
Member

@kraih kraih left a comment

Choose a reason for hiding this comment

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

Some tests are fine and could be merged, but others have scoping issues and require more attention.

@kraih
Copy link
Member

kraih commented Nov 1, 2020

I'm sorry, but i've decided to close these PRs, because they contain too many converted tests at once. And we don't have the review capacity to re-review the whole thing after every scoping issue fix.

@kraih kraih closed this Nov 1, 2020
@spazm spazm changed the title Convert last 6 mojo tests to use subtests. #1520 Convert io_loop_v6.t, subprocess.t, and websocket_proxy.t to use subtests. #1520 Nov 1, 2020
@spazm
Copy link
Author

spazm commented Nov 1, 2020

Updated PR to remove the tests that did not convert cleanly.
These three had minimal changes (overview provided in the updated PR description) and will hopefully provide minimal review burden.

Hoping some of the effort can be salvaged to get some small part of this conversion off of your plate.

Please consider re-opening and reviewing. Sorry for producing a headache rather than the happy joy of found work.
Have a groovy day!

@kraih
Copy link
Member

kraih commented Nov 1, 2020

Thanks for your effort. But from now on please just one test per PR. This is just too much to review.

@kraih
Copy link
Member

kraih commented Nov 1, 2020

I've also updated #1520 with a few additions (one test per PR and skip tests with lots of shared state).

@kraih
Copy link
Member

kraih commented Nov 2, 2020

If you want to salvage these PRs, limit them to one test file and move everything else in new PRs.

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.

2 participants