Skip to content

Commit

Permalink
调整单元测试用例
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Jul 27, 2023
1 parent 0446409 commit c1f6803
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 34 deletions.
2 changes: 0 additions & 2 deletions test/connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package test
import (
"context"
"github.com/farseer-go/etcd"
"github.com/farseer-go/fs"
"github.com/farseer-go/fs/container"
"github.com/farseer-go/fs/flog"
"github.com/stretchr/testify/assert"
Expand All @@ -12,7 +11,6 @@ import (
)

func TestConnect(t *testing.T) {
fs.Initialize[etcd.Module]("test etcd")
client := container.Resolve[etcd.IClient]("default")
assert.Equal(t, "", client.Original().Username)

Expand Down
28 changes: 0 additions & 28 deletions test/farseer.yaml

This file was deleted.

13 changes: 13 additions & 0 deletions test/init_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package test

import (
"github.com/farseer-go/etcd"
"github.com/farseer-go/fs"
"github.com/farseer-go/fs/configure"
)

func init() {
// 设置配置默认值,模拟配置文件
configure.SetDefault("Etcd.default", "Server=127.0.0.1:2379|127.0.0.1:2379,DialTimeout=5000")
fs.Initialize[etcd.Module]("test etcd")
}
2 changes: 0 additions & 2 deletions test/lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package test
import (
"context"
"github.com/farseer-go/etcd"
"github.com/farseer-go/fs"
"github.com/farseer-go/fs/container"
"github.com/farseer-go/fs/flog"
"github.com/stretchr/testify/assert"
Expand All @@ -12,7 +11,6 @@ import (
)

func TestLease(t *testing.T) {
fs.Initialize[etcd.Module]("test etcd")
client := container.Resolve[etcd.IClient]("default")

_, _ = client.PutJson("/test/lease3", []int{3})
Expand Down
2 changes: 0 additions & 2 deletions test/lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package test

import (
"github.com/farseer-go/etcd"
"github.com/farseer-go/fs"
"github.com/farseer-go/fs/container"
"github.com/farseer-go/fs/flog"
"github.com/stretchr/testify/assert"
Expand All @@ -11,7 +10,6 @@ import (
)

func TestLock(t *testing.T) {
fs.Initialize[etcd.Module]("test etcd")
client := container.Resolve[etcd.IClient]("default")

result := 0
Expand Down

0 comments on commit c1f6803

Please sign in to comment.