Skip to content

Commit

Permalink
Add test for the integration layer
Browse files Browse the repository at this point in the history
  • Loading branch information
dottorblaster committed Mar 4, 2022
1 parent 25407c7 commit dee4c53
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 1 deletion.
56 changes: 56 additions & 0 deletions test/fixtures/discovery/subscriptions_discovery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"agent_id": "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
"discovery_type": "subscription_discovery",
"payload": [
{
"arch": "x86_64",
"type": "internal",
"status": "Registered",
"version": "15.3",
"starts_at": "2021-10-18 06:23:46 UTC",
"expires_at": "2026-10-18 06:23:46 UTC",
"identifier": "SLES_SAP",
"subscription_status": "ACTIVE"
},
{
"arch": "x86_64",
"status": "Registered",
"version": "15.3",
"identifier": "sle-module-basesystem"
},
{
"arch": "x86_64",
"status": "Registered",
"version": "15.3",
"identifier": "sle-module-desktop-applications"
},
{
"arch": "x86_64",
"status": "Registered",
"version": "15.3",
"identifier": "sle-module-server-applications"
},
{
"arch": "x86_64",
"type": "internal",
"status": "Registered",
"version": "15.3",
"starts_at": "2021-10-18 06:23:46 UTC",
"expires_at": "2026-10-18 06:23:46 UTC",
"identifier": "sle-ha",
"subscription_status": "ACTIVE"
},
{
"arch": "x86_64",
"status": "Registered",
"version": "15.3",
"identifier": "sle-module-sap-applications"
},
{
"arch": "x86_64",
"status": "Registered",
"version": "15.3",
"identifier": "sle-module-public-cloud"
}
]
}
2 changes: 1 addition & 1 deletion test/tronto/monitoring/integration/discovery_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Tronto.Monitoring.Integration.DiscoveryTest do
test "cloud_discovery payload with azure provider should return the expected commands" do
assert {
:ok,
%Tronto.Monitoring.Domain.Commands.UpdateProvider{
%UpdateProvider{
host_id: "0a055c90-4cb6-54ce-ac9c-ae3fedaf40d4",
provider: "azure"
}
Expand Down
102 changes: 102 additions & 0 deletions test/tronto/monitoring/integration/subscriptions_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
defmodule Tronto.Monitoring.Integration.SubscriptionsTest do
use ExUnit.Case

import Tronto.DiscoveryFixturesHelper

alias Tronto.Monitoring.Integration.Discovery
alias Tronto.Monitoring.Domain.SlesSubscription
alias Tronto.Monitoring.Domain.Commands.UpdateSlesSubscriptions

describe "cloud_discovery" do
test "cloud_discovery payload with azure provider should return the expected commands" do
assert {
:ok,
%UpdateSlesSubscriptions{
host_id: "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
subscriptions: [
%SlesSubscription{
arch: "x86_64",
expires_at: "2026-10-18 06:23:46 UTC",
host_id: "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
identifier: "SLES_SAP",
starts_at: "2021-10-18 06:23:46 UTC",
status: "Registered",
subscription_status: "ACTIVE",
type: "internal",
version: "15.3"
},
%SlesSubscription{
arch: "x86_64",
expires_at: nil,
host_id: "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
identifier: "sle-module-basesystem",
starts_at: nil,
status: "Registered",
subscription_status: nil,
type: nil,
version: "15.3"
},
%SlesSubscription{
arch: "x86_64",
expires_at: nil,
host_id: "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
identifier: "sle-module-desktop-applications",
starts_at: nil,
status: "Registered",
subscription_status: nil,
type: nil,
version: "15.3"
},
%SlesSubscription{
arch: "x86_64",
expires_at: nil,
host_id: "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
identifier: "sle-module-server-applications",
starts_at: nil,
status: "Registered",
subscription_status: nil,
type: nil,
version: "15.3"
},
%SlesSubscription{
arch: "x86_64",
expires_at: "2026-10-18 06:23:46 UTC",
host_id: "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
identifier: "sle-ha",
starts_at: "2021-10-18 06:23:46 UTC",
status: "Registered",
subscription_status: "ACTIVE",
type: "internal",
version: "15.3"
},
%SlesSubscription{
arch: "x86_64",
expires_at: nil,
host_id: "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
identifier: "sle-module-sap-applications",
starts_at: nil,
status: "Registered",
subscription_status: nil,
type: nil,
version: "15.3"
},
%Tronto.Monitoring.Domain.SlesSubscription{
arch: "x86_64",
expires_at: nil,
host_id: "0fc07435-7ee2-54ca-b0de-fb27ffdc5deb",
identifier: "sle-module-public-cloud",
starts_at: nil,
status: "Registered",
subscription_status: nil,
type: nil,
version: "15.3"
}
]
}
} =
"subscriptions_discovery"
|> load_discovery_event_fixture()
|> Discovery.handle_discovery_event()
end
end
end

0 comments on commit dee4c53

Please sign in to comment.