mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-09-04 12:51:33 +00:00
Rework push reservation w/ datastore
- At Handle creation, first check if an instance of the the respective object is already present in the datastore. - Handle sequence must be saved only if commit to datastore is succesfull - Caller (ipam) needs to manage the retry Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
@@ -87,6 +87,58 @@ func TestSequenceEqual(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSequenceCopy(t *testing.T) {
|
||||
s := &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 8,
|
||||
Next: &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 8,
|
||||
Next: &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 0,
|
||||
Next: &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 0,
|
||||
Next: &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 2,
|
||||
Next: &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 1,
|
||||
Next: &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 1,
|
||||
Next: &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 2,
|
||||
Next: &Sequence{
|
||||
Block: 0x1,
|
||||
Count: 1,
|
||||
Next: &Sequence{
|
||||
Block: 0x0,
|
||||
Count: 2,
|
||||
Next: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
n := s.GetCopy()
|
||||
if !s.Equal(n) {
|
||||
t.Fatalf("copy of s failed")
|
||||
}
|
||||
if n == s {
|
||||
t.Fatalf("not true copy of s")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetFirstAvailable(t *testing.T) {
|
||||
input := []struct {
|
||||
mask *Sequence
|
||||
|
||||
Reference in New Issue
Block a user