Skip to content

Commit

Permalink
added multipe path query
Browse files Browse the repository at this point in the history
WAN-2321 #time 10m
  • Loading branch information
shriyanshk128T committed Sep 6, 2023
1 parent bf8370a commit eb49282
Showing 1 changed file with 89 additions and 4 deletions.
93 changes: 89 additions & 4 deletions plugins/inputs/t128_peer_path/t128_peer_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var CollectorTestCases = []struct {
ExpectedRequests: []int{1},
},
{
Name: "full config produces response", //complex processing tested separately
Name: "empty adjacent hostname",
EntryPoint: "allPeers/nodes/paths",
Fields: map[string]string{
"status": "status",
Expand All @@ -102,8 +102,8 @@ var CollectorTestCases = []struct {
"paths": [
{
"node": "node1",
"adjacentAddress": "127.117.97.105",
"adjacentHostname": "ge/0/0/1",
"adjacentAddress": "10.10.10.10",
"adjacentHostname": null,
"status": "UP",
"enabled": true,
"deviceInterface": "wan5",
Expand All @@ -120,18 +120,103 @@ var CollectorTestCases = []struct {
{
Measurement: "test-collector",
Tags: map[string]string{
"adjacentHostname": "ge/0/0/1",
"adjacentAddress": "10.10.10.10",
"deviceInterface": "wan5",
"networkInterface": "wan5",
"node": "node1",
"vlan": "0",
"routerName": "NorthEast",
},
Fields: map[string]interface{}{
"status": "UP",
"enabled": true,
},
},
},
ExpectedErrors: []string{},
ExpectedRequests: []int{1},
},
{
Name: "multiple paths",
EntryPoint: "allPeers/nodes/paths",
Fields: map[string]string{
"status": "status",
"enabled": "enabled",
},
Tags: map[string]string{
"node": "node",
"adjacentAddress": "adjacentAddress",
"adjacentHostname": "adjacentHostname",
"deviceInterface": "deviceInterface",
"networkInterface": "networkInterface",
"vlan": "vlan",
"routerName": "allPeers/nodes/routerName",
},
Query: ValidPeerPathQuery,
Endpoint: Endpoint{"/api/v1/graphql/", 200, ValidPeerPathRequest, `{
"data": {
"allPeers": {
"nodes": [
{
"routerName": "NorthEast",
"paths": [
{
"node": "node1",
"adjacentAddress": "172.16.3.2",
"adjacentHostname": null,
"status": "UP",
"enabled": true,
"deviceInterface": "wan5",
"networkInterface": "wan5",
"vlan": "0"
},
{
"node": "node1",
"adjacentAddress": "127.117.97.105",
"adjacentHostname": "fake-peer",
"status": "DOWN",
"enabled": true,
"deviceInterface": "wan5",
"networkInterface": "wan5",
"vlan": "0"
}
]
}
]
}
}
}`},
ExpectedMetrics: []*testutil.Metric{
&testutil.Metric{
Measurement: "test-collector",
Tags: map[string]string{
"adjacentAddress": "172.16.3.2",
"deviceInterface": "wan5",
"networkInterface": "wan5",
"node": "node1",
"vlan": "0",
"routerName": "NorthEast",
},
Fields: map[string]interface{}{
"status": "UP",
"enabled": true,
},
},
&testutil.Metric{
Measurement: "test-collector",
Tags: map[string]string{
"adjacentHostname": "fake-peer",
"deviceInterface": "wan5",
"networkInterface": "wan5",
"node": "node1",
"vlan": "0",
"routerName": "NorthEast",
},
Fields: map[string]interface{}{
"status": "DOWN",
"enabled": true,
},
},
},
ExpectedErrors: []string{},
ExpectedRequests: []int{1},
Expand Down

0 comments on commit eb49282

Please sign in to comment.