-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup OTLP exporter compression options, add tests
- Loading branch information
Showing
5 changed files
with
137 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
exporter/opentelemetry-exporter-otlp/tests/test_otlp_exporter_mixin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from unittest import TestCase | ||
from unittest.mock import patch | ||
|
||
from grpc import Compression | ||
|
||
from opentelemetry.exporter.otlp.exporter import environ_to_compression | ||
|
||
|
||
class TestOTLPExporterMixin(TestCase): | ||
def test_environ_to_compression(self): | ||
with patch.dict( | ||
"os.environ", | ||
{ | ||
"test_gzip": "gzip", | ||
"test_deflate": "deflate", | ||
"test_invalid": "some invalid compression", | ||
}, | ||
): | ||
self.assertEqual( | ||
environ_to_compression("test_gzip"), Compression.Gzip | ||
) | ||
self.assertEqual( | ||
environ_to_compression("test_deflate"), Compression.Deflate | ||
) | ||
self.assertIsNone(environ_to_compression("missing_key"),) | ||
with self.assertRaises(Exception): | ||
environ_to_compression("test_invalid") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters