forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes removed extra blank lines changes regarding param renaming added ssl tests added more detail to the unit test additional import moved pem files out of public folder fixed import chenged import changed import unit tests fix unit test fix fixed unit tests fixed unit test unit test fix changes int test cert and key
- Loading branch information
Showing
8 changed files
with
124 additions
and
14 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
2 changes: 2 additions & 0 deletions
2
src/k8s-extension/azext_k8s_extension/tests/latest/data/cert_and_key_encoded.txt
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,2 @@ | ||
dGVzdGNlcnQ= | ||
dGVzdGtleQ== |
1 change: 1 addition & 0 deletions
1
src/k8s-extension/azext_k8s_extension/tests/latest/data/test_cert.pem
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 @@ | ||
testcert |
1 change: 1 addition & 0 deletions
1
src/k8s-extension/azext_k8s_extension/tests/latest/data/test_key.pem
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 @@ | ||
testkey |
32 changes: 32 additions & 0 deletions
32
src/k8s-extension/azext_k8s_extension/tests/latest/test_azureml_extension.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,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']) |
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 @@ | ||
testcert |
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 @@ | ||
testkey |
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