@@ -4,7 +4,6 @@ import yaml from "js-yaml";
4
4
import * as path from "path" ;
5
5
import { Config , loadConfiguration } from "../../config" ;
6
6
import * as config from "../../config" ;
7
- import * as keyvault from "../../lib/azure/keyvault" ;
8
7
import * as storage from "../../lib/azure/storage" ;
9
8
import { createTempDir } from "../../lib/ioUtil" ;
10
9
import { deepClone } from "../../lib/util" ;
@@ -15,7 +14,6 @@ import {
15
14
} from "../../logger" ;
16
15
import { AzureAccessOpts , ConfigYaml } from "../../types" ;
17
16
import {
18
- createKeyVault ,
19
17
execute ,
20
18
getStorageAccessKey ,
21
19
CommandOptions ,
@@ -37,7 +35,6 @@ afterAll(() => {
37
35
} ) ;
38
36
39
37
const MOCKED_VALUES : CommandOptions = {
40
- keyVaultName : "testKeyVault" ,
41
38
servicePrincipalId : "servicePrincipalId" ,
42
39
servicePrincipalPassword : "servicePrincipalPassword" ,
43
40
storageAccountName : "testaccount" ,
@@ -49,7 +46,6 @@ const MOCKED_VALUES: CommandOptions = {
49
46
} ;
50
47
51
48
const MOCKED_CONFIG : OnBoardConfig = {
52
- keyVaultName : "testKeyVault" ,
53
49
servicePrincipalId : "servicePrincipalId" ,
54
50
servicePrincipalPassword : "servicePrincipalPassword" ,
55
51
storageAccountName : "testaccount" ,
@@ -108,7 +104,6 @@ const testPopulatedVal = (
108
104
describe ( "test populateValues" , ( ) => {
109
105
it ( "all values are set" , ( ) => {
110
106
const values = populateValues ( getMockedValues ( ) ) ;
111
- expect ( values . keyVaultName ) . toBe ( MOCKED_VALUES . keyVaultName ) ;
112
107
expect ( values . servicePrincipalId ) . toBe ( MOCKED_VALUES . servicePrincipalId ) ;
113
108
expect ( values . servicePrincipalPassword ) . toBe (
114
109
MOCKED_VALUES . servicePrincipalPassword
@@ -152,19 +147,6 @@ describe("test populateValues", () => {
152
147
}
153
148
) ;
154
149
} ) ;
155
- it ( "keyVaultName default to config.introspection.azure.key_vault_name" , ( ) => {
156
- testPopulatedVal (
157
- ( configYaml : ConfigYaml ) => {
158
- configYaml . key_vault_name = "KeyVaultName" ;
159
- } ,
160
- ( values : CommandOptions ) => {
161
- values . keyVaultName = undefined ;
162
- } ,
163
- ( values ) => {
164
- expect ( values . keyVaultName ) . toBe ( "KeyVaultName" ) ;
165
- }
166
- ) ;
167
- } ) ;
168
150
it ( "servicePrincipalId default to config.introspection.azure.service_principal_id" , ( ) => {
169
151
testPopulatedVal (
170
152
( configYaml : ConfigYaml ) => {
@@ -316,37 +298,17 @@ describe("test validateAndCreateStorageAccount function", () => {
316
298
317
299
describe ( "test getStorageAccessKey function" , ( ) => {
318
300
it ( "already exist" , async ( ) => {
319
- jest
320
- . spyOn ( storage , "getStorageAccountKey" )
321
- . mockReturnValueOnce ( Promise . resolve ( "key" ) ) ;
301
+ jest . spyOn ( storage , "getStorageAccountKey" ) . mockResolvedValueOnce ( "key" ) ;
322
302
const values = getMockedConfig ( ) ;
323
303
const accessOpts = getMockedAccessOpts ( values ) ;
324
304
const storageKey = await getStorageAccessKey ( values , accessOpts ) ;
325
305
expect ( storageKey ) . toBe ( "key" ) ;
326
306
} ) ;
327
307
} ) ;
328
308
329
- describe ( "test createKeyVault function" , ( ) => {
330
- it ( "[+ve] not key vault value" , async ( ) => {
331
- const values = getMockedConfig ( ) ;
332
- values . keyVaultName = undefined ;
333
- const accessOpts = getMockedAccessOpts ( values ) ;
334
- // nothing is done
335
- await createKeyVault ( values , accessOpts , "accessString" ) ;
336
- } ) ;
337
- it ( "[+ve] with key vault value" , async ( ) => {
338
- jest . spyOn ( keyvault , "setSecret" ) . mockReturnValueOnce ( Promise . resolve ( ) ) ;
339
- const values = getMockedConfig ( ) ;
340
- const accessOpts = getMockedAccessOpts ( values ) ;
341
- await createKeyVault ( values , accessOpts , "accessString" ) ;
342
- } ) ;
343
- } ) ;
344
-
345
309
describe ( "onboard" , ( ) => {
346
310
test ( "empty location" , async ( ) => {
347
- jest
348
- . spyOn ( storage , "isStorageAccountExist" )
349
- . mockReturnValueOnce ( Promise . resolve ( false ) ) ;
311
+ jest . spyOn ( storage , "isStorageAccountExist" ) . mockResolvedValueOnce ( false ) ;
350
312
351
313
try {
352
314
const values = getMockedConfig ( ) ;
@@ -392,9 +354,6 @@ describe("onboard", () => {
392
354
jest
393
355
. spyOn ( storage , "createStorageAccount" )
394
356
. mockReturnValueOnce ( Promise . resolve ( { location : "test" } ) ) ;
395
- jest
396
- . spyOn ( onboardImpl , "createKeyVault" )
397
- . mockReturnValueOnce ( Promise . resolve ( ) ) ;
398
357
jest . spyOn ( onboardImpl , "setConfiguration" ) . mockReturnValueOnce ( true ) ;
399
358
400
359
const data = {
0 commit comments