Skip to content

Commit

Permalink
Added unit tests, experimental tag, and constant class variables
Browse files Browse the repository at this point in the history
  • Loading branch information
carolabadeer committed Jul 29, 2022
1 parent 5f119f9 commit ced61fb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
12 changes: 7 additions & 5 deletions src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@
use OpenTelemetry\API\Common\Instrumentation\InstrumentationInterface;
use OpenTelemetry\API\Common\Instrumentation\InstrumentationTrait;

/**
* @experimental
*/
class AwsSdkInstrumentation implements InstrumentationInterface
{
use InstrumentationTrait;

public function __construct()
{
}
public const NAME = 'AWS SDK Instrumentation';
public const VERSION = '0.0.1';

public function getName(): string
{
return 'AWS SDK Instrumentation';
return self::NAME;
}

public function getVersion(): ?string
{
return '0.0.1';
return self::VERSION;
}

public function getSchemaUrl(): ?string
Expand Down
28 changes: 22 additions & 6 deletions tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,36 @@ class AwsSdkInstrumentationTest extends TestCase
{
public function testInstrumentationClassName()
{
$awsSdkInstrumentation = new AwsSdkInstrumentation();

$this->assertEquals(
'AWS SDK Instrumentation',
$awsSdkInstrumentation->getName()
(new AwsSdkInstrumentation())->getName()
);
}

public function testInstrumentationActivated()
public function testInstrumentationVersion()
{
$this->assertEquals(
'0.0.1',
(new AwsSdkInstrumentation())->getVersion()
);
}

public function testInstrumentationSchemaUrl()
{
$awsSdkInstrumentation = new AwsSdkInstrumentation();
$this->assertNull((new AwsSdkInstrumentation())->getSchemaUrl());
}

public function testInstrumentationInit()
{
$this->assertTrue(
(new AwsSdkInstrumentation())->init()
);
}

public function testInstrumentationActivated()
{
$this->assertTrue(
$awsSdkInstrumentation->activate()
(new AwsSdkInstrumentation())->activate()
);
}
}

0 comments on commit ced61fb

Please sign in to comment.