From da2abdfa8df3b12b8ec5dc79e910e820c38f96f7 Mon Sep 17 00:00:00 2001 From: David Allen Date: Mon, 12 Aug 2024 13:07:57 -0600 Subject: [PATCH] Updated tests to reflect new API changes --- tests/api_test.go | 25 +++++++++++++++++++------ tests/compatibility_test.go | 6 +++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/api_test.go b/tests/api_test.go index 05f7cd2..4b8ddf3 100644 --- a/tests/api_test.go +++ b/tests/api_test.go @@ -13,18 +13,31 @@ import ( magellan "github.com/OpenCHAMI/magellan/internal" ) +var ( + scanParams = &magellan.ScanParams{ + TargetHosts: [][]string{ + []string{ + "http://127.0.0.1:443", + "http://127.0.0.1:5000", + }, + }, + Scheme: "https", + Protocol: "tcp", + Concurrency: 1, + Timeout: 30, + DisableProbing: false, + Verbose: false, + } +) + func TestScanAndCollect(t *testing.T) { - var ( - hosts = []string{"http://127.0.0.1"} - ports = []int{5000} - ) // do a scan on the emulator cluster with probing disabled and check results - results := magellan.ScanForAssets(hosts, ports, 1, 30, true, false) + results := magellan.ScanForAssets(scanParams) if len(results) <= 0 { t.Fatal("expected to find at least one BMC node, but found none") } // do a scan on the emulator cluster with probing enabled - results = magellan.ScanForAssets(hosts, ports, 1, 30, false, false) + results = magellan.ScanForAssets(scanParams) if len(results) <= 0 { t.Fatal("expected to find at least one BMC node, but found none") } diff --git a/tests/compatibility_test.go b/tests/compatibility_test.go index 5517bd2..b879536 100644 --- a/tests/compatibility_test.go +++ b/tests/compatibility_test.go @@ -13,7 +13,7 @@ import ( "net/http" "testing" - "github.com/OpenCHAMI/magellan/internal/util" + "github.com/OpenCHAMI/magellan/pkg/client" "github.com/OpenCHAMI/magellan/pkg/crawler" ) @@ -30,7 +30,7 @@ func TestRedfishV1Availability(t *testing.T) { body = []byte{} headers = map[string]string{} ) - res, b, err := util.MakeRequest(nil, url, http.MethodGet, body, headers) + res, b, err := client.MakeRequest(nil, url, http.MethodGet, body, headers) if err != nil { t.Fatalf("failed to make request to BMC: %v", err) } @@ -60,7 +60,7 @@ func TestRedfishVersion(t *testing.T) { headers = map[string]string{} ) - util.MakeRequest(nil, url, http.MethodGet, body, headers) + client.MakeRequest(nil, url, http.MethodGet, body, headers) } // Crawls a BMC node and checks that we're able to query certain properties