-
Notifications
You must be signed in to change notification settings - Fork 17
Read SSL cert and key from files #38
Changes from 7 commits
ad8603b
5c07778
23c0338
916691f
0bc89c7
8caf752
ae49b99
26e2a8e
2b21bfd
47f601e
05a6350
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| dGVzdGNlcnQ= | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please put these files in extension-specific directories such as
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tbh, I would actually reverse the order and do data/azure_ml, otherwise it might be confusing for the future, since azureml related test are under src/k8s-extension/azext_k8s_extension/tests/latest/partner_extensions/public/ Hence I think it makes sense to introduce a data director that is going to have extension specific sub directories. Thoughts? |
||
| dGVzdGtleQ== | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| testcert | ||
|
liakaz marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| testkey | ||
|
liakaz marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| import os | ||
| import unittest | ||
|
|
||
| from azext_k8s_extension.partner_extensions.AzureMLKubernetes import AzureMLKubernetes | ||
|
|
||
|
|
||
| TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) | ||
|
|
||
|
|
||
| class TestAzureMlExtension(unittest.TestCase): | ||
|
|
||
| def test_set_up_inference_ssl(self): | ||
| azremlk8sInstance = AzureMLKubernetes() | ||
| config = {'allowInsecureConnections': 'false'} | ||
| # read and encode dummy cert and key | ||
| sslKeyPemFile = os.path.join(TEST_DIR, 'data', 'test_key.pem') | ||
| sslCertPemFile = os.path.join(TEST_DIR, 'data', 'test_cert.pem') | ||
| protected_config = {'sslKeyPemFile': sslKeyPemFile, 'sslCertPemFile': sslCertPemFile} | ||
| azremlk8sInstance._AzureMLKubernetes__set_up_inference_ssl(config, protected_config) | ||
| self.assertTrue('scoringFe.sslCert' in protected_config) | ||
| self.assertTrue('scoringFe.sslKey' in protected_config) | ||
| encoded_cert_and_key_file = os.path.join(TEST_DIR, 'data', 'cert_and_key_encoded.txt') | ||
| with open(encoded_cert_and_key_file, "rb") as text_file: | ||
| cert = text_file.readline().rstrip() | ||
| self.assertEquals(cert, protected_config['scoringFe.sslCert']) | ||
| key = text_file.readline() | ||
| self.assertEquals(key, protected_config['scoringFe.sslKey']) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| testcert | ||
|
liakaz marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| testkey |
Uh oh!
There was an error while loading. Please reload this page.