Skip to content

Commit

Permalink
fix: ReadValues for bgp_monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-te committed Jun 14, 2022
1 parent c5b8e64 commit 1197f2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion thousandeyes/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func FixReadValues(m interface{}, name string) (interface{}, error) {
i := 0
for i < len(monitors) {
monitor := monitors[i].(map[string]interface{})
if monitor["monitor_type"] == "Public" {
if *monitor["monitor_type"].(*string) == "Public" {
// Remove this item from the slice
monitors = append(monitors[:i], monitors[i+1:]...)
} else {
Expand Down
14 changes: 7 additions & 7 deletions thousandeyes/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,19 @@ func TestFixReadValues(t *testing.T) {
// bgp_monitors
monitorsInput := []interface{}{
map[string]interface{}{
"monitor_name": "foo",
"monitor_id": 1,
"monitor_type": "Public",
"monitor_name": thousandeyes.String("foo"),
"monitor_id": thousandeyes.Int(1),
"monitor_type": thousandeyes.String("Public"),
},
map[string]interface{}{
"monitor_name": "bar",
"monitor_id": 2,
"monitor_type": "Private",
"monitor_name": thousandeyes.String("bar"),
"monitor_id": thousandeyes.Int(2),
"monitor_type": thousandeyes.String("Private"),
},
}
monitorsTarget := []interface{}{
map[string]interface{}{
"monitor_id": 2,
"monitor_id": thousandeyes.Int(2),
},
}
output, err = FixReadValues(monitorsInput, "bgp_monitors")
Expand Down

0 comments on commit 1197f2c

Please sign in to comment.