dapr icon indicating copy to clipboard operation
dapr copied to clipboard

Add e2e test for root cert installation feature

Open shubham1172 opened this issue 2 years ago • 1 comments

Description

Add end to end test for certificate installation feature. This PR tests the cert installation feature with HTTPS bindings. A web server (part of test app) hosts a secured endpoint that is invoked by the sidecar using HTTP binding. This requires the sidecar to trust the correct SSL certificate.

Overview of the PR:

  1. utils/http-server.go - StartServer supports an enableTLS option to start a secured server based on two environment variables - DAPR_TESTS_TLS_CERT and DAPR_TESTS_TLS_KEY.
  2. utils/tls.go - Helper function to generate new SSL certificate and key
  3. platforms/kubernetes - Two new configurations - AppVolumeMounts to mount volumes to the app container, and DaprEnv to set sidecar environment variables
  4. test/apps/injectorapp-init - Generates new certificate and key before the actual containers start. This is used by (1) app container to start new HTTPS server, and (2) sidecar container to trust them while making HTTPS call.
  5. test/apps.injectorapp - Set the required env var and start another server in background with HTTPS enabled. Also adds a bindingTest method for testing the HTTPS binding.
  6. e2e/injector - Sets up the k8s pods and container and triggers test for testing if SSL cert was installed.

Issue reference

Please reference the issue this PR will close: #4835

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • [ ] Code compiles correctly
  • [ ] Created/updated tests
  • [ ] Unit tests passing
  • [ ] End-to-end tests passing
  • [ ] Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]
  • [ ] Specification has been updated / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]
  • [ ] Provided sample for the feature / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

shubham1172 avatar Jul 22 '22 06:07 shubham1172

Codecov Report

Merging #4931 (6e13cc5) into master (327900f) will increase coverage by 0.02%. The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4931      +/-   ##
==========================================
+ Coverage   65.53%   65.55%   +0.02%     
==========================================
  Files         112      112              
  Lines       12325    12325              
==========================================
+ Hits         8077     8080       +3     
+ Misses       3671     3669       -2     
+ Partials      577      576       -1     
Impacted Files Coverage Δ
pkg/actors/internal/placement.go 89.11% <0.00%> (+1.55%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Jul 22 '22 06:07 codecov[bot]

/ok-to-test

ItalyPaleAle avatar Aug 14 '22 04:08 ItalyPaleAle

Congrats! All end-to-end tests have passed on linux. Thanks for your contribution!

dapr-bot avatar Aug 14 '22 05:08 dapr-bot

End-to-end tests failed on windows. Please check the build logs

dapr-bot avatar Aug 14 '22 05:08 dapr-bot

/ok-to-test

shubham1172 avatar Aug 14 '22 06:08 shubham1172

Congrats! All end-to-end tests have passed on linux. Thanks for your contribution!

dapr-bot avatar Aug 14 '22 07:08 dapr-bot

End-to-end tests failed on windows. Please check the build logs

dapr-bot avatar Aug 14 '22 08:08 dapr-bot

/ok-to-test

shubham1172 avatar Aug 16 '22 06:08 shubham1172

Congrats! All end-to-end tests have passed on linux. Thanks for your contribution!

dapr-bot avatar Aug 16 '22 06:08 dapr-bot

Congrats! All end-to-end tests have passed on windows. Thanks for your contribution!

dapr-bot avatar Aug 16 '22 06:08 dapr-bot

FYI @ItalyPaleAle

shubham1172 avatar Aug 16 '22 06:08 shubham1172

LGTM!

ItalyPaleAle avatar Aug 16 '22 17:08 ItalyPaleAle