Skip to content

Commit

Permalink
🧹 Fix azure test. (#3649)
Browse files Browse the repository at this point in the history
Signed-off-by: Preslav <[email protected]>
  • Loading branch information
preslavgerchev authored Mar 26, 2024
1 parent 3483907 commit 3b816bb
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions providers/azure/connection/azureinstancesnapshot/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ import (
)

func TestParseTarget(t *testing.T) {
t.Skip("needs to be fixed")
t.Run("parse snapshot target with just a resource name", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: &instanceInfo{
resourceGroup: "my-rg",
instanceName: "my-instance",
},
resourceGroup: "my-rg",
name: "my-instance",
}
target := "my-other-snapshot"

Expand All @@ -35,10 +32,8 @@ func TestParseTarget(t *testing.T) {
})
t.Run("parse instance target with just a resource name", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: &instanceInfo{
resourceGroup: "my-rg",
instanceName: "my-instance",
},
resourceGroup: "my-rg",
name: "my-instance",
}
target := "my-other-instance"

Expand All @@ -56,10 +51,8 @@ func TestParseTarget(t *testing.T) {
})
t.Run("parse disk target with just a resource name", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: &instanceInfo{
resourceGroup: "my-rg",
instanceName: "my-instance",
},
resourceGroup: "my-rg",
name: "my-instance",
}
target := "my-disk"

Expand All @@ -76,12 +69,7 @@ func TestParseTarget(t *testing.T) {
assert.Equal(t, DiskTargetType, scanTarget.TargetType)
})
t.Run("parse snapshot target with a fully qualified Azure resource ID", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: &instanceInfo{
resourceGroup: "my-rg",
instanceName: "my-instance",
},
}
scanner := &azureScannerInstance{}
target := "/subscriptions/f1a2873a-6c27-4097-aa7c-3df51f103e91/resourceGroups/my-other-rg/providers/Microsoft.Compute/snapshots/test-snp"

conf := &inventory.Config{
Expand All @@ -97,12 +85,7 @@ func TestParseTarget(t *testing.T) {
assert.Equal(t, SnapshotTargetType, scanTarget.TargetType)
})
t.Run("parse instance target with a fully qualified Azure resource ID", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: &instanceInfo{
resourceGroup: "my-rg",
instanceName: "my-instance",
},
}
scanner := &azureScannerInstance{}
target := "/subscriptions/f1a2873a-6b27-4097-aa7c-3df51f103e96/resourceGroups/debian_group/providers/Microsoft.Compute/virtualMachines/debian"

conf := &inventory.Config{
Expand All @@ -118,12 +101,7 @@ func TestParseTarget(t *testing.T) {
assert.Equal(t, InstanceTargetType, scanTarget.TargetType)
})
t.Run("parse disk target with a fully qualified Azure resource ID", func(t *testing.T) {
scanner := &azureScannerInstance{
instanceInfo: &instanceInfo{
resourceGroup: "my-rg",
instanceName: "my-instance",
},
}
scanner := &azureScannerInstance{}
target := "/subscriptions/f1a2873a-6b27-4097-aa7c-3df51f103e96/resourceGroups/debian_group/providers/Microsoft.Compute/disks/disk-1"

conf := &inventory.Config{
Expand Down

0 comments on commit 3b816bb

Please sign in to comment.