-
Notifications
You must be signed in to change notification settings - Fork 765
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
OtlpExporter: Integration test testing https support #1795
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a1b43ff
Enable support for both http and https
alanwest 323ed14
Logic is hard
alanwest d5f6cce
Merge branch 'main' into alanwest/otlp-allow-tls
cijothomas 11a8e85
Merge branch 'main' into alanwest/otlp-allow-tls
cijothomas 852e091
https test that works for netstandard2.1 gRPC library
alanwest 9029055
Apply suggestions from code review
alanwest b161bda
Fix https test for Google gRPC library
alanwest 4e595e9
Merge branch 'alanwest/otlp-allow-tls' of github.com:alanwest/opentel…
alanwest 66e844a
Add some comments
alanwest a63867a
Merge branch 'main' into alanwest/otlp-allow-tls
alanwest bc729c1
Update changelog
alanwest 21bed21
Merge branch 'alanwest/otlp-allow-tls' of github.com:alanwest/opentel…
alanwest 008a9c5
Merge branch 'main' into alanwest/otlp-allow-tls
alanwest e906d8e
Remove cert from repo
alanwest af7ce26
Create certificate each test run
alanwest 09b1189
Update workflow
alanwest 6107e05
Merge remote-tracking branch 'upstream/main' into alanwest/otlp-allow…
alanwest fe51556
Merge branch 'main' into alanwest/otlp-allow-tls
cijothomas 443470e
Merge branch 'main' into alanwest/otlp-allow-tls
cijothomas fccd624
Merge branch 'main' into alanwest/otlp-allow-tls
cijothomas 1db8833
Merge branch 'main' into alanwest/otlp-allow-tls
cijothomas db3ed09
Merge branch 'main' into alanwest/otlp-allow-tls
cijothomas 9d812d0
Merge branch 'main' into alanwest/otlp-allow-tls
cijothomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 3 additions & 0 deletions
3
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/integration-test/.gitignore
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,3 @@ | ||
# Self-signed cert generated by integration test | ||
otel-collector.crt | ||
otel-collector.key |
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
18 changes: 18 additions & 0 deletions
18
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/integration-test/create-cert.sh
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,18 @@ | ||
#!/bin/bash | ||
|
||
# Generate self-signed certificate for the collector | ||
openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 \ | ||
-subj "/CN=otel-collector" \ | ||
-keyout /otel-collector.key -out /otel-collector.crt | ||
|
||
# Copy the certificate and private key file to shared volume that the collector | ||
# container and test container can access | ||
cp /otel-collector.crt /otel-collector.key /cfg | ||
|
||
# The integration test is run via docker-compose with the --exit-code-from | ||
# option. The --exit-code-from option implies --abort-on-container-exit | ||
# which means when any container exits then all containers are stopped. | ||
# Since the container running this script would be otherwise short-lived | ||
# we sleep here. If the test does not finish within this time then the test | ||
# container will be stopped and have a non-zero exit code. | ||
sleep 300 |
20 changes: 15 additions & 5 deletions
20
...elemetryProtocol.Tests/docker-compose.yml → ...Tests/integration-test/docker-compose.yml
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
7 changes: 7 additions & 0 deletions
7
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/integration-test/run-test.sh
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,7 @@ | ||
#!/bin/bash | ||
|
||
# Trust the self-signed certificated used by the collector | ||
cp /cfg/otel-collector.crt /usr/local/share/ca-certificates/ | ||
update-ca-certificates --verbose | ||
|
||
dotnet vstest OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.dll --TestCaseFilter:CategoryName=CollectorIntegrationTests |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to vet out https support, I just changed the test to use https. I plan to follow up and have it test both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use a self-signed cert might need to manually pass validation somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cert gets installed as a trusted cert here, so no need to manually pass validation:
opentelemetry-dotnet/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Dockerfile
Lines 18 to 20 in 21bed21
I had actually tried this first:
For some reason this did not work... I've used this kind of thing in test applications before, but for some reason the callback was not getting invoked by the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServicePointManager.ServerCertificateValidationCallback
doesn't work for the Google library or .NET or both? I'm not too surprised if it doesn't work in the Google library. .NET would be more of a surprise 😄