Skip to content

Commit

Permalink
feat:test ci env GetInstanceDatacenter action
Browse files Browse the repository at this point in the history
  • Loading branch information
gongna-au committed Sep 19, 2024
1 parent 159c8dd commit 4e9b815
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions util/ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ package util

import (
"fmt"
"github.com/stretchr/testify/assert"
"net"
"testing"

"github.com/stretchr/testify/assert"
)

func TestParseIP(t *testing.T) {
Expand Down Expand Up @@ -140,9 +141,10 @@ func TestGetInstanceDatacenter(t *testing.T) {
},
}

for _, tt := range testCases {
for k, tt := range testCases {
t.Run(tt.name, func(t *testing.T) {
dc, err := GetInstanceDatacenter(tt.addr)
t.Logf("Testing Case:%d addr: %s, dc: %v, err: %v", k, tt.addr, dc, err)
if tt.hasErr {
assert.NotNil(t, err)
return
Expand Down Expand Up @@ -198,9 +200,10 @@ func TestGetHostDatacenter(t *testing.T) {
},
}

for _, tt := range testCases {
for k, tt := range testCases {
t.Run(tt.name, func(t *testing.T) {
dc, err := GetHostDatacenter(tt.host)
t.Logf("Testing Case:%d addr: %s, dc: %v, err: %v", k, tt.host, dc, err)
if tt.hasErr {
assert.NotNil(t, err)
return
Expand Down

0 comments on commit 4e9b815

Please sign in to comment.