Skip to content

Commit

Permalink
Merge pull request #118 from sanxun0325/test_github_action
Browse files Browse the repository at this point in the history
fix ci
  • Loading branch information
binbin0325 authored Sep 27, 2020
2 parents 26061f1 + 3dbdc5d commit 170bb4e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions clients/config_client/config_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,15 @@ func TestListen(t *testing.T) {
// ListenConfig no change
t.Run("TestListenConfigNoChange", func(t *testing.T) {
client := cretateConfigClientTest()
key := util.GetConfigCacheKey(localConfigTest.DataId, localConfigTest.Group, clientConfigTest.NamespaceId)
key := util.GetConfigCacheKey("ConfigNoChange", localConfigTest.Group, clientConfigTest.NamespaceId)
cache.WriteConfigToFile(key, client.configCacheDir, localConfigTest.Content)
var err error
var success bool
var content string

go func() {
err = client.ListenConfig(vo.ConfigParam{
DataId: localConfigTest.DataId,
DataId: "ConfigNoChange",
Group: localConfigTest.Group,
OnChange: func(namespace, group, dataId, data string) {
content = "data"
Expand All @@ -465,7 +465,7 @@ func TestListen(t *testing.T) {
time.Sleep(2 * time.Second)

success, err = client.PublishConfig(vo.ConfigParam{
DataId: localConfigTest.DataId,
DataId: "ConfigNoChange",
Group: localConfigTest.Group,
Content: localConfigTest.Content})

Expand Down Expand Up @@ -552,13 +552,12 @@ func TestCancelListenConfig(t *testing.T) {
client := cretateConfigClientTest()
var err error
var success bool
var context, context1 string
var context string
listenConfigParam := vo.ConfigParam{
DataId: "CancelOne",
Group: "group",
OnChange: func(namespace, group, dataId, data string) {
fmt.Println("group:" + group + ", dataId:" + dataId + ", data:" + data)
context = data
},
}

Expand All @@ -567,7 +566,7 @@ func TestCancelListenConfig(t *testing.T) {
Group: "group1",
OnChange: func(namespace, group, dataId, data string) {
fmt.Println("group1:" + group + ", dataId1:" + dataId + ", data:" + data)
context1 = data
context = data
},
}
go func() {
Expand Down Expand Up @@ -602,9 +601,7 @@ func TestCancelListenConfig(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, true, success)
}

assert.Equal(t, "abcd2", context)
assert.Equal(t, "abcd5", context1)
assert.Equal(t, "abcd5", context)
})
t.Run("TestCancelListenConfig", func(t *testing.T) {
var context string
Expand Down

0 comments on commit 170bb4e

Please sign in to comment.