Skip to content

Commit f897d10

Browse files
committed
fix ratelimiter test
1 parent 9e7b55a commit f897d10

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

test/ratelimiter_test.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ func TestRatelimiter(t *testing.T) {
6767
if err != nil {
6868
t.Fatal(err)
6969
}
70-
// cleanup node
71-
err = db.Coordination().DropNode(ctx, testCoordinationNodePath)
72-
if err != nil {
73-
t.Fatal(err)
74-
}
70+
defer func() {
71+
// cleanup node
72+
err = db.Coordination().DropNode(ctx, testCoordinationNodePath)
73+
if err != nil {
74+
t.Fatal(err)
75+
}
76+
}()
7577
// create resource
7678
err = db.Ratelimiter().CreateResource(ctx, testCoordinationNodePath, public.Resource{
7779
ResourcePath: testResource,
@@ -83,11 +85,13 @@ func TestRatelimiter(t *testing.T) {
8385
if err != nil {
8486
t.Fatal(err)
8587
}
86-
// cleanup resource
87-
err = db.Ratelimiter().DropResource(ctx, testCoordinationNodePath, testResource)
88-
if err != nil {
89-
t.Fatal("Cannot drop resource")
90-
}
88+
defer func() {
89+
// cleanup resource
90+
err = db.Ratelimiter().DropResource(ctx, testCoordinationNodePath, testResource)
91+
if err != nil {
92+
t.Fatal("Cannot drop resource")
93+
}
94+
}()
9195
// describe resource
9296
described, err := db.Ratelimiter().DescribeResource(ctx, testCoordinationNodePath, testResource)
9397
if err != nil {

0 commit comments

Comments
 (0)