fix several bugs:

- properly remove the leading non-flag args from the command line before passing the rest to the executor
  - fix missed "add" after "delete" in merge() when objects are identical
  - properly test for tombstone instead of *api.Node in delete handler
  - basic tests for node registrator
This commit is contained in:
James DeFelice
2016-03-04 03:58:34 +00:00
parent 2a4479fa60
commit 954e25465d
6 changed files with 215 additions and 28 deletions

View File

@@ -119,6 +119,32 @@ func TestFIFO_addUpdate(t *testing.T) {
}
}
func TestFIFO_addDeleteAdd(t *testing.T) {
f := NewHistorical(nil)
testobj := &testObj{"foo", 10}
f.Add(testobj)
f.Delete(testobj)
f.Add(testobj)
_, exists, _ := f.GetByKey("foo")
if !exists {
t.Errorf("item did not get readded")
}
}
func TestFIFO_addPopAdd(t *testing.T) {
f := NewHistorical(nil)
testobj := &testObj{"foo", 10}
f.Add(testobj)
f.Pop(nil)
f.Add(testobj)
_, exists, _ := f.GetByKey("foo")
if !exists {
t.Errorf("item did not get readded")
}
}
func TestFIFO_addReplace(t *testing.T) {
f := NewHistorical(nil)
f.Add(&testObj{"foo", 10})