@@ -376,24 +376,14 @@ ava.serial('vm service change', async t => {
376376 await common . cleanup ( ) ;
377377} ) ;
378378
379- [ 'project' , 'user' ] . forEach ( type => {
380- ava . serial ( `vm ssh using ${ type } ssh-key` , async t => {
381- const common = await getCommon ( t . title ) ;
382-
383- const sshKeyPair = await ssh . generateKey ( ) ;
384- const sshFilename = tests . getRandomFile ( sshKeyPair . publicKey ) ;
385-
386- const ssh_name = `vm-ssh-key-${ now } -${ type } -key` ;
387-
388- const credentials = await tests . run ( `${ type } credentials add --name ${ ssh_name } --sshkey-file '${ sshFilename } '` ) ;
379+ ava . serial ( 'vm ssh using ssh-key' , async t => {
380+ const common = await getCommon ( t . title ) ;
389381
390- const vm = await tests . run ( `vm create ${ common . params . createParams } --ssh ${ ssh_name } ` ) ;
382+ const { privateKey, publicKey } = await ssh . generateKey ( ) ;
383+ const vm = await tests . run ( `vm create ${ common . params . createParams } --ssh '${ publicKey } '` ) ;
391384
392- const content = await ssh . execVm ( vm , { privateKey : sshKeyPair . privateKey } , 'uptime' ) ;
393- t . true ( content . includes ( 'load average' ) ) ;
394- fs . unlinkSync ( sshFilename ) ;
385+ const content = await ssh . execVm ( vm , { privateKey } , 'uptime' ) ;
386+ t . true ( content . includes ( 'load average' ) ) ;
395387
396- await tests . remove ( `${ type } credentials` , credentials ) ;
397- await common . cleanup ( ) ;
398- } ) ;
388+ await common . cleanup ( ) ;
399389} ) ;
0 commit comments