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

Unmute tests for amp-experiment variant replacement. #20233

Closed
wants to merge 1 commit into from

Conversation

lannka
Copy link
Contributor

@lannka lannka commented Jan 9, 2019

The root cause of those tests failures are actually the use of rethrowAsync: https://github.com/ampproject/amphtml/blob/master/src/service/url-expander/expander.js#L327

We might consider remove all the usage of rethrowAsync in code base. @rsimha what you think?

This PR is to unblock #20221

also part of #16916

@rsimha
Copy link
Contributor

rsimha commented Jan 9, 2019

From a testing point of view, removing rethrowAsync will greatly reduce the amount of flakiness we see. However, is there a valid use case for doing it in the runtime? Why was it added in the first place? Does it prevent the runtime from blocking when it encounters an error, perhaps?

@jridgewell @erwinmombay @choumx

'The value passed to VARIANT() is not a valid experiment name:' +
experiment);
if (variant === undefined) {
user().error(TAG,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be happening here? Or should we replace rethrowAsync upstream with the user().log()? E.g. the logic that says "ignore errors and return empty string" is already part of this system. This duplicates it slightly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree this is a duplicates. will need a root fix. was plan to have this as a temporary work around to unblock your PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Up to you - you could allow my PR w/o unmuting these 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.

will let your PR go if you can confirm the tests pass locally

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep. Can confirm that it works with patches.

@dvoytenko
Copy link
Contributor

@rsimha Not sure if this is the best forum for rethrowAsync discussion, but to kick it off. The original intent with rethrowAsync was this: "Don't block the code, but still treat it as an error downstream, including reporting to console, analytics services, diagnostics logging". I realize that it caused us some paint with tests, but I think we could try to address that pain in a couple of different ways and maybe that'd be an improvement over the current state. E.g. something like:

function rethrowAsync(error) {
  if (TESTING) {
    // E.g. these errors could be then used for test assertions.
    TESTING.collectErrors(error);
  } else {
    // Normal PROD behavior.
    setInterval(() => {throw error;});
  }
}

With something like this, the if (TESTING) part would be stripped from PROD binary.

Overall, IMHO, I prefer rethrowAsync to user().log() and dev().log(). I'd prefer we relied on logging packages as little as possible. rethrowAsync is essentially a proxy to throw new Error() and reads much cleaner. But that's a bigger conversation.

@rsimha
Copy link
Contributor

rsimha commented Jan 10, 2019

That was really useful, @dvoytenko! Agree, let's kick off a separate discussion.

@lannka
Copy link
Contributor Author

lannka commented Jan 10, 2019

let's discuss the need of rethrowAsync here #20252

@mrjoro
Copy link
Member

mrjoro commented Jan 24, 2019

From the discussions in #20252 it sounds like @torch2424 will be working on this now? Will that be in this PR or will that be a different one?

@lannka
Copy link
Contributor Author

lannka commented Jan 24, 2019

@mrjoro this PR is not needed. closing

@lannka lannka closed this Jan 24, 2019
@lannka lannka deleted the variant-tests branch January 24, 2019 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants