-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from Juniper/feat/47
Introduce support for blueprint anomalies
- Loading branch information
Showing
4 changed files
with
244 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
//go:build integration | ||
// +build integration | ||
|
||
package apstra | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"testing" | ||
) | ||
|
||
func TestGetAnomalies(t *testing.T) { | ||
clients, err := getTestClients(context.Background(), t) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
for clientName, client := range clients { | ||
log.Printf("testing getAnomalies() against %s %s (%s)", client.clientType, clientName, client.client.ApiVersion()) | ||
|
||
anomalies, err := client.client.GetAnomalies(context.TODO()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
log.Printf("%d anomalies retrieved", len(anomalies)) | ||
} | ||
} | ||
|
||
func TestGetBlueprintAnomalies(t *testing.T) { | ||
ctx := context.Background() | ||
|
||
clients, err := getTestClients(context.Background(), t) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
for clientName, client := range clients { | ||
bpClient, bpDelete := testBlueprintB(ctx, t, client.client) | ||
defer func() { | ||
err := bpDelete(ctx) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
}() | ||
|
||
log.Printf("testing GetBlueprintAnomalies() against %s %s (%s)", client.clientType, clientName, client.client.ApiVersion()) | ||
anomalies, err := client.client.GetBlueprintAnomalies(ctx, bpClient.Id()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
log.Printf("%d blueprint anomalies retrieved", len(anomalies)) | ||
} | ||
} | ||
|
||
func TestGetBlueprintNodeAnomalyCounts(t *testing.T) { | ||
ctx := context.Background() | ||
|
||
clients, err := getTestClients(context.Background(), t) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
for clientName, client := range clients { | ||
bpClient, bpDelete := testBlueprintB(ctx, t, client.client) | ||
defer func() { | ||
err := bpDelete(ctx) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
}() | ||
|
||
log.Printf("testing GetBlueprintAnomalies() against %s %s (%s)", client.clientType, clientName, client.client.ApiVersion()) | ||
anomalies, err := client.client.GetBlueprintNodeAnomalyCounts(ctx, bpClient.Id()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
log.Printf("%d node anomaly counts retrieved", len(anomalies)) | ||
} | ||
} | ||
|
||
func TestGetBlueprintServiceAnomalyCounts(t *testing.T) { | ||
ctx := context.Background() | ||
|
||
clients, err := getTestClients(context.Background(), t) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
for clientName, client := range clients { | ||
bpClient, bpDelete := testBlueprintB(ctx, t, client.client) | ||
defer func() { | ||
err := bpDelete(ctx) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
}() | ||
|
||
log.Printf("testing GetBlueprintAnomalies() against %s %s (%s)", client.clientType, clientName, client.client.ApiVersion()) | ||
anomalies, err := client.client.GetBlueprintServiceAnomalyCounts(ctx, bpClient.Id()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
log.Printf("%d service anomaly counts retrieved", len(anomalies)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters