Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,4 @@ func TestDeadlockInClose(t *testing.T) {
case <-time.After(3 * time.Second):
t.Fatal("apparent deadlock!")
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the test?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At that time, I wrote a unit test for GetEphemerals, which uses the ZK service of direct connection 127.0.0.1. This requires me to start a ZK service locally. However, after the first two commits were submitted, GitHub's default unit test check failed directly. So I tried to remove this unit test and verify whether the automatic check would pass. Obviously, another problem I mentioned above appeared One question (How to fix the 'Codecov Report'?) Maybe I should comment on the test? Because it seems that there is no corresponding test method for other public methods

}

func TestGetEphemerals(t *testing.T) {
conn, _, err := Connect([]string{"127.0.0.1"}, time.Second) //*10)
if err != nil {
panic(err)
}
defer conn.Close()
conn.Create("/zktest", []byte("placeholder"), 0, WorldACL(PermAll))
conn.Create("/zktest/testblabla", []byte("placeholder"), FlagEphemeral, WorldACL(PermAll))
conn.Create("/zktest/nonono", []byte("placeholder"), FlagEphemeral, WorldACL(PermAll))
conn.Create("/testE", []byte("placeholder"), FlagEphemeral, WorldACL(PermAll))
conn.Create("/testE2", []byte("placeholder"), FlagEphemeral, WorldACL(PermAll))

e1, _ := conn.GetEphemerals("/zktest")
if len(e1) != 2 {
t.Fatalf("/zktest result should be 2, but got %d", len(e1))
}

e2, _ := conn.GetEphemerals("/")
if len(e2) != 4 {
t.Fatalf("/zktest result should be 4, but got %d", len(e2))
}

e3, _ := conn.GetEphemerals("/testE")
if len(e3) != 2 {
t.Fatalf("/zktest result should be 2, but got %d", len(e3))
}

}