This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch refactor-with-go
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git


The following commit(s) were added to refs/heads/refactor-with-go by this push:
     new d166b168 Modify small bugs in unit tests (#1078)
d166b168 is described below

commit d166b168205196f3fdceb0eabe372d6005624cb7
Author: 无言独上机房 <[email protected]>
AuthorDate: Tue Apr 11 19:07:06 2023 +0800

    Modify small bugs in unit tests (#1078)
---
 pkg/admin/services/prometheus_service_impl_test.go | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/pkg/admin/services/prometheus_service_impl_test.go 
b/pkg/admin/services/prometheus_service_impl_test.go
index 46f5ae91..92e20ef3 100644
--- a/pkg/admin/services/prometheus_service_impl_test.go
+++ b/pkg/admin/services/prometheus_service_impl_test.go
@@ -25,6 +25,7 @@ import (
        "net/http/httptest"
        "net/url"
        "reflect"
+       "sort"
        "sync"
        "testing"
 
@@ -163,6 +164,14 @@ func TestPrometheusServiceImpl_PromDiscovery(t *testing.T) 
{
                        }
                        var target []model.Target
                        _ = json.Unmarshal(resp, &target)
+                       for i := 0; i < len(target); i++ {
+                               gots := target[i].Targets
+                               targets := tt.want[i].Targets
+                               sort.Strings(gots)
+                               sort.Strings(targets)
+                               target[i].Targets = gots
+                               tt.want[i].Targets = targets
+                       }
                        if !reflect.DeepEqual(target, tt.want) {
                                t.Errorf("PromDiscovery() got = %v, want %v", 
target, tt.want)
                        }

Reply via email to