Skip to content

Commit

Permalink
Removed parentSnapshotId from generic snapshot object (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakerobinson authored Jan 16, 2025
1 parent 88f0e90 commit 0806718
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 deletions.
15 changes: 0 additions & 15 deletions Tests/e2e/Snapshot.Tests.ps1

This file was deleted.

6 changes: 4 additions & 2 deletions Toolkit/Public/Get-RscSnapshot.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function Get-RscSnapshot {
$cdmSnapshot = $query.field.nodes.FindIndex({param($item) $item.gettype().name -eq "cdmSnapshot"})
$polarisSnapshot = $query.field.nodes.FindIndex({param($item) $item.gettype().name -eq "polarisSnapshot"})

# Generic fields on both types of snapshots or on generic type
# Generic fields on all types of snapshots
$query.field.nodes | ForEach-Object {
$_.id = "FETCH"
$_.date = "1999-01-01"
Expand All @@ -229,7 +229,7 @@ function Get-RscSnapshot {
$_.isDownloadedSnapshot = $true
$_.expiryHint = $true
$_.isExpired = $true
$_.parentSnapshotId = "FETCH"

}

# Polaris snapshot type
Expand All @@ -246,6 +246,7 @@ function Get-RscSnapshot {
#$query.field.nodes[$polarisSnapshot].replicationLocations[0].id = "FETCH"
$query.field.nodes[$polarisSnapshot].hasUnexpiredReplica = $true
$query.field.nodes[$polarisSnapshot].hasUnexpiredArchivedCopy = $true
$query.field.nodes[$polarisSnapshot].parentSnapshotId = "FETCH"

# CDM snapshot type
$query.field.nodes[$cdmSnapshot].isRetentionLocked = $true
Expand Down Expand Up @@ -291,6 +292,7 @@ function Get-RscSnapshot {
$query.field.nodes[$cdmSnapshot].slaDomain.name = "FETCH"
$query.field.nodes[$cdmSnapshot].slaDomain.id = "FETCH"
$query.field.nodes[$cdmSnapshot].consistencyLevel = [RubrikSecurityCloud.Types.SnapshotConsistencyLevel]::CRASH_CONSISTENT
$query.field.nodes[$cdmSnapshot].parentSnapshotId = "FETCH"

$result = Invoke-Rsc -Query $query
$result.nodes
Expand Down
33 changes: 33 additions & 0 deletions Toolkit/Tests/e2e/Get-RscSnapshot.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
BeforeAll {
. "$PSScriptRoot\..\E2eTestInit.ps1"

# variables shared among tests
$Global:data = @{
sla = $null
}
}


Describe -Name 'Get-RscSnapshot Tests' -Tag 'Public' -Fixture {

It -Name 'retrieves Snapshots' -Test {
$data.snapshots = Get-RscVmwareVm | Select-Object -first 1 | Get-RscSnapshot
$data.snapshots | Should -Not -BeNullOrEmpty
}

Context -Name 'Snapshot Count > 0' {
BeforeEach {
# Skip the tests if empty snapshot list
if ($data.snapshots.Count -le 0) {
Set-ItResult -Skipped -Because "At least 1 snapshot is needed"
return
}
}

It -Name 'retrieves single Snapshot by Id' -Test {
$snapshot = Get-RscSnapshot -Id $data.snapshots[0].id
$snapshot.name | Should -Be $data.snapshots[0].name
$snapshot.id | Should -Be $data.snapshots[0].id
}
}
}

0 comments on commit 0806718

Please sign in to comment.