| 1 | package OpenTelemetry::Instrumentation::Mojo::UserAgent::TestSuiteInjection; | ||
| 2 | # ABSTRACT: Inject the Mojo::UserAgent instrumentation into a third party test suite | ||
| 3 | |||
| 4 | our $VERSION = '0.01'; | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | use warnings; | ||
| 8 | |||
| 9 | INIT { | ||
| 10 | require OpenTelemetry::Instrumentation; | ||
| 11 | OpenTelemetry::Instrumentation->import('Mojo::UserAgent'); | ||
| 12 | } | ||
| 13 | |||
| 14 | 1; | ||
| 15 | |||
| 16 | =encoding utf8 | ||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | TestSuiteInjection - Run OpenTelemetry::Instrumentation::Mojo::UserAgent in existing test suites | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | This is a utility module to inject instrumentation into Mojo::UserAgent instances in existing | ||
| 25 | test suites -like the stock Mojolicious test suite- to make sure we are not introducing | ||
| 26 | unintended regressions. | ||
| 27 | |||
| 28 | $ git clone https://github.com/mojolicious/mojo.git | ||
| 29 | $ cd mojo | ||
| 30 | $ PERL5OPT=-MOpenTelemetry::Instrumentation::Mojo::UserAgent::TestSuiteInjection prove -l t/ | ||
| 31 | |||
| 32 | The installation is deferred to INIT time, so that it happens after all compilation is done. | ||
| 33 | This is important because Mojo modules compile-time constants (eg. TLS and SOCKS support) | ||
| 34 | depend on the environment, and test scripts commonly tweak the environment for this in | ||
| 35 | BEGIN blocks, before they load any Mojo module themselves. | ||
| 36 | |||
| 37 | =head1 SEE ALSO | ||
| 38 | |||
| 39 | L<OpenTelemetry::Instrumentation::Mojo::UserAgent>, L<Mojolicious> | ||
| 40 | |||
| 41 | =cut |