Skip to content

Commit

Permalink
use correct type for Azure Role Definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
kubasobon committed Apr 23, 2024
1 parent d55d09f commit f2f816f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (r *AzureResource) GetElasticCommonData() (map[string]any, error) {
}
m["host.hostname"] = computerName
}
case fetching.AzureRoleDefinitionType:
case inventory.RoleDefinitionsType:
{
m["user.effective.id"] = r.Asset.Id
m["user.effective.name"] = r.Asset.Name
Expand Down
16 changes: 13 additions & 3 deletions internal/resources/fetching/fetchers/azure/assets_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,19 @@ func (s *AzureAssetsFetcherTestSuite) TestFetcher_Fetch() {

ecs, err := result.GetElasticCommonData()
s.Require().NoError(err)
if expected.Type == inventory.VirtualMachineAssetType {
s.Contains(ecs, "host.name")
} else {
switch expected.Type {
case inventory.VirtualMachineAssetType:
{
s.GreaterOrEqual(len(ecs), 1)
s.Contains(ecs, "host.name")
}
case inventory.RoleDefinitionsType:
{
s.Len(ecs, 2)
s.Contains(ecs, "user.effective.id")
s.Contains(ecs, "user.effective.name")
}
default:
s.Empty(ecs)
}
})
Expand Down

0 comments on commit f2f816f

Please sign in to comment.