| 1 | package Test::OpenTracing::Interface::Tracer; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Test::OpenTracing::Interface::Tracer - compliance testing | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use Test::OpenTracing::Interface::ContextReference qw/:all/; | ||
| 10 | |||
| 11 | can_all_ok 'MyImplementation::ContextReference', | ||
| 12 | "MyImplementation class does have all subs defined, well done!"; | ||
| 13 | |||
| 14 | # lets be a bit fancy, a proper Implementation should have a C<bootstrap> | ||
| 15 | # method to setup a Tracer, lets see if that works too: | ||
| 16 | |||
| 17 | use MyImplementation; | ||
| 18 | |||
| 19 | my $test_thing = MyImplementation | ||
| 20 | ->bootstrap( @implementation_args ); | ||
| 21 | |||
| 22 | can_all_ok( $test_thing, | ||
| 23 | "An object returned by 'bootstrap' has all required subs defined" | ||
| 24 | ); | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 29 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | |||
| 31 | 3 | our $VERSION = 'v0.23.1'; | |
| 32 | |||
| 33 | |||
| 34 | 3 | ▶ | use Test::OpenTracing::Interface; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | |||
| 36 | 3 | ▶ | use Exporter qw/import/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | |||
| 38 | 3 | our @EXPORT_OK = qw/can_all_ok/; | |
| 39 | 3 | our %EXPORT_TAGS = ( all => [qw/can_all_ok/] ); | |
| 40 | |||
| 41 | 3 | ▶ | use syntax qw/maybe/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | =head1 DESCRIPTION | ||
| 46 | |||
| 47 | This package will provide the tests as described in | ||
| 48 | L<Test::OpenTracing::Interface>. | ||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | =head1 EXPORTED SUBROUTINES | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | =head2 C<can_all_ok> | ||
| 59 | |||
| 60 | Test that all methods mentioned in L<OpenTracing::Interface::Tracer> | ||
| 61 | are defined. | ||
| 62 | |||
| 63 | =cut | ||
| 64 | |||
| 65 | 3 | ▶ | sub can_all_ok { |
|
Subroutine
can_all_ok: called CC=1 SCAR=0.0
Pod
documented
| |||
| 66 | 3 | my $thing = shift; | |
| 67 | 3 | my $message = shift; | |
| 68 | |||
| 69 | 3 | my $Test = Test::OpenTracing::Interface::CanAll->new( | |
| 70 | test_this => $thing, | ||
| 71 | interface_name => 'Tracer', | ||
| 72 | interface_methods => [ | ||
| 73 | 'extract_context', | ||
| 74 | 'get_active_span', | ||
| 75 | 'get_scope_manager', | ||
| 76 | 'inject_context', | ||
| 77 | 'start_active_span', | ||
| 78 | 'start_span', | ||
| 79 | ], | ||
| 80 | maybe | ||
| 81 | message => $message, | ||
| 82 | ); | ||
| 83 | |||
| 84 | 3 | return $Test->run_tests; | |
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | =head1 SEE ALSO | ||
| 90 | |||
| 91 | =over | ||
| 92 | |||
| 93 | =item L<Test::OpenTracing::Interface> | ||
| 94 | |||
| 95 | Test OpenTracing::Interface compliance. | ||
| 96 | |||
| 97 | =item L<OpenTracing::Interface::Tracer> | ||
| 98 | |||
| 99 | Defines the ContextReference. | ||
| 100 | |||
| 101 | =back | ||
| 102 | |||
| 103 | |||
| 104 | |||
| 105 | =head1 AUTHOR | ||
| 106 | |||
| 107 | Theo van Hoesel <tvanhoesel@perceptyx.com> | ||
| 108 | |||
| 109 | |||
| 110 | |||
| 111 | =head1 COPYRIGHT AND LICENSE | ||
| 112 | |||
| 113 | 'Test OpenTracing' is Copyright (C) 2020, Perceptyx Inc | ||
| 114 | |||
| 115 | This library is free software; you can redistribute it and/or modify it under | ||
| 116 | the terms of the Artistic License 2.0. | ||
| 117 | |||
| 118 | This library is distributed in the hope that it will be useful, but it is | ||
| 119 | provided "as is" and without any express or implied warranties. | ||
| 120 | |||
| 121 | For details, see the full text of the license in the file LICENSE. | ||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | =cut | ||
| 126 | |||
| 127 | 3 | 1; | |