mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-30 05:18:11 +01:00
test and fix
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
f1360a2bf0
commit
ae31e7f249
|
@ -143,7 +143,7 @@ func isKubernetesDashboard(ip string, port int) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
body := strings.ToLower(string(b))
|
body := strings.ToLower(string(b))
|
||||||
if strings.Contains(body, "kubernetes") ||
|
if (strings.Contains(body, "kubernetes") && strings.Contains(body, "pod")) ||
|
||||||
(strings.Contains(body, "versions") && strings.Contains(body, "serverAddress")) {
|
(strings.Contains(body, "versions") && strings.Contains(body, "serverAddress")) {
|
||||||
logrus.Infof("uri: %s", uri)
|
logrus.Infof("uri: %s", uri)
|
||||||
return true
|
return true
|
||||||
|
@ -157,7 +157,7 @@ type ARINResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type NetJSON struct {
|
type NetJSON struct {
|
||||||
Organization OrganizationJSON `json:"orgReg,omitempty"`
|
Organization OrganizationJSON `json:"orgRef,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrganizationJSON struct {
|
type OrganizationJSON struct {
|
||||||
|
|
20
k8scan/main_test.go
Normal file
20
k8scan/main_test.go
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestARINResponse(t *testing.T) {
|
||||||
|
info, err := getIPInfo("104.40.92.107")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if info.Net.Organization.Handle != "MSFT" {
|
||||||
|
t.Fatalf("expected handle to be MSFT, got %s", info.Net.Organization.Handle)
|
||||||
|
}
|
||||||
|
if info.Net.Organization.Name != "Microsoft Corporation" {
|
||||||
|
t.Fatalf("expected handle to be Microsoft Corporation, got %s", info.Net.Organization.Name)
|
||||||
|
}
|
||||||
|
if info.Net.Organization.Reference != "https://whois.arin.net/rest/org/MSFT" {
|
||||||
|
t.Fatalf("expected reference to be https://whois.arin.net/rest/org/MSFT, got %s", info.Net.Organization.Reference)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user