-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f82ec49
commit 6546b70
Showing
28 changed files
with
1,142 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# lion | ||
# prophet | ||
Embedded distributed coordinator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package prophet | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestPeerClone(t *testing.T) { | ||
old := newTestPeer(1, 10) | ||
cloned := old.Clone() | ||
|
||
if cloned.ID != old.ID { | ||
t.Error("peer clone failed with ID") | ||
} | ||
if cloned.ContainerID != old.ContainerID { | ||
t.Error("peer clone failed with ContainerID") | ||
} | ||
|
||
old.ID = 2 | ||
old.ContainerID = 20 | ||
if cloned.ID == old.ID { | ||
t.Error("peer clone failed with ID changed") | ||
} | ||
if cloned.ContainerID == old.ContainerID { | ||
t.Error("peer clone failed with ContainerID changed") | ||
} | ||
} | ||
|
||
func TestPeerStatusClone(t *testing.T) { | ||
old := &PeerStats{ | ||
Peer: newTestPeer(1, 10), | ||
DownSeconds: 10, | ||
} | ||
cloned := old.Clone() | ||
|
||
if cloned.DownSeconds != old.DownSeconds { | ||
t.Error("peer status clone failed with DownSeconds") | ||
} | ||
|
||
old.DownSeconds = 20 | ||
|
||
if cloned.DownSeconds == old.DownSeconds { | ||
t.Error("peer status clone failed with DownSeconds changed") | ||
} | ||
} | ||
|
||
func newTestPeer(id, containerID uint64) *Peer { | ||
return &Peer{ | ||
ID: id, | ||
ContainerID: containerID, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.