rubrikinc / rubrik-sdk-for-powershell

Rubrik Module for PowerShell
https://build.rubrik.com/sdks/powershell/
MIT License
102 stars 86 forks source link

Tests failing for Start-RubrikDownload on mac #752

Closed jakerobinson closed 3 years ago

jakerobinson commented 3 years ago

Tests fail for file operations on mac due to the usage of mkdir in the tests.

Current Behavior:

Provide information about the failure by issuing the command using the -Verbose command. Ensure that any identifiable information (server names, tokens, passwords) is removed from your logs before sharing this on GitHub.

> Invoke-Pester Tests/Start-RubrikDownload.Tests.ps1
Pester v4.10.1
Executing all tests in 'Tests/Start-RubrikDownload.Tests.ps1'

Executing script Tests/Start-RubrikDownload.Tests.ps1

  Describing Public/Start-RubrikDownload

    Context Context validate correct processing of function with different parameter sets
/bin/mkdir: illegal option -- P
usage: mkdir [-pv] [-m mode] directory ...
New-Item: 
Line |
   7 |              New-Item $OutFile -ItemType File | Out-Null
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not find a part of the path '/private/tmp/1094bcfe-77ee-4540-81f3-5ac2329d9dc0/Temp/MyImportedFileSet.zip'.
Get-Item: /Users/jake/rubrik-sdk-for-powershell/Rubrik/Public/Start-RubrikDownload.ps1:111
Line |
 111 |      return Get-Item $WebRequestSplat.OutFile
     |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path 'TestDrive:/Temp/MyImportedFileSet.zip' because it does not exist.

      [-] Should return a file object 72ms
        Expected the value to have type [System.IO.FileInfo] or any of its subtypes, but got $null with type $null.
        24:                 Should -BeOfType [System.IO.FileInfo]
        at <ScriptBlock>, /Users/jake/rubrik-sdk-for-powershell/Tests/Start-RubrikDownload.Tests.ps1: line 23
/bin/mkdir: illegal option -- P
usage: mkdir [-pv] [-m mode] directory ...
New-Item: 
Line |
   7 |              New-Item $OutFile -ItemType File | Out-Null
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not find a part of the path '/private/tmp/1094bcfe-77ee-4540-81f3-5ac2329d9dc0/Temp/MyImportedFileSet2.zip'.
Get-Item: /Users/jake/rubrik-sdk-for-powershell/Rubrik/Public/Start-RubrikDownload.ps1:111
Line |
 111 |      return Get-Item $WebRequestSplat.OutFile
     |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path 'TestDrive:/Temp/MyImportedFileSet2.zip' because it does not exist.

      [-] Should filename should match when explicitly specified 59ms
        Expected 'MyImportedFileSet2.zip', but got $null.
        29:                 Should -Be 'MyImportedFileSet2.zip'
        at <ScriptBlock>, /Users/jake/rubrik-sdk-for-powershell/Tests/Start-RubrikDownload.Tests.ps1: line 28
/bin/mkdir: illegal option -- P
usage: mkdir [-pv] [-m mode] directory ...
New-Item: 
Line |
   7 |              New-Item $OutFile -ItemType File | Out-Null
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not find a part of the path '/private/tmp/1094bcfe-77ee-4540-81f3-5ac2329d9dc0/Temp/EVep2PMDpJEAWhIQS6Si.zip'.
Get-Item: /Users/jake/rubrik-sdk-for-powershell/Rubrik/Public/Start-RubrikDownload.ps1:111
Line |
 111 |      return Get-Item $WebRequestSplat.OutFile
     |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path 'TestDrive:/Temp/EVep2PMDpJEAWhIQS6Si.zip' because it does not exist.

      [-] Should use filename from Rubrik Cluster when only path is specified 49ms
        Expected 'EVep2PMDpJEAWhIQS6Si.zip', but got $null.
        34:                 Should -Be 'EVep2PMDpJEAWhIQS6Si.zip'
        at <ScriptBlock>, /Users/jake/rubrik-sdk-for-powershell/Tests/Start-RubrikDownload.Tests.ps1: line 33
/bin/mkdir: illegal option -- P
usage: mkdir [-pv] [-m mode] directory ...
New-Item: 
Line |
   7 |              New-Item $OutFile -ItemType File | Out-Null
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not find a part of the path '/private/tmp/1094bcfe-77ee-4540-81f3-5ac2329d9dc0/Temp/ComplicatedPath/MyImportedFileSet2.zip'.
Get-Item: /Users/jake/rubrik-sdk-for-powershell/Rubrik/Public/Start-RubrikDownload.ps1:111
Line |
 111 |      return Get-Item $WebRequestSplat.OutFile
     |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path 'TestDrive:/Temp/ComplicatedPath/MyImportedFileSet2.zip' because it does not exist.

      [-] Path should match 44ms
        Expected like wildcard '*Temp*ComplicatedPath*' to match $null, but it did not match.
        39:                 Should -BeLike '*Temp*ComplicatedPath*'
        at <ScriptBlock>, /Users/jake/rubrik-sdk-for-powershell/Tests/Start-RubrikDownload.Tests.ps1: line 38
Tests completed in 533ms
Tests Passed: 0, Failed: 4, Skipped: 0, Pending: 0, Inconclusive: 0 

Expected Behavior: All tests should pass.

Steps to Reproduce:

Please provide detailed steps for reproducing the issue.

  1. Clone latest code
  2. Invoke-Pester Tests/Start-RubrikDownload.Tests.ps1

Context:

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Darwin 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.1…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
jaapbrasser commented 3 years ago

Fixed by #753 💯